Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encountered a build error: "unrecognized command-line option '-Wp'" on Fedora 37 #394

Open
heartofrain opened this issue Apr 12, 2023 · 2 comments
Labels
Hacktoberfest Good first issue for new contributors coming from @Hacktoberfest help wanted

Comments

@heartofrain
Copy link

heartofrain commented Apr 12, 2023

Describe the bug
When I was building LTFS on Fedora 37, I encountered a build error: unrecognized command-line option '-Wp'.

To Reproduce
Run the build command:

./autogen.sh
./configure
make

Then gcc complained:

cc1: error: unrecognized command-line option '-Wp'

in verbose:

/bin/sh ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../..  -D_GNU_SOURCE -I../../src -DLTFS_CONFIG_FILE='"/usr/local/etc/ltfs.conf"' -DLTFS_BASE_DIR='"NONE"' -DUSE_NEW_LOCKING  -D USE_UNORM2  -D USE_UNORM2 -I ..  -Wall -Wsign-compare -fsigned-char -I/usr/include/fuse -D_FILE_OFFSET_BITS=64 -I/usr/include/uuid -I/usr/include/libxml2 -D ENABLE_SNMP -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIE -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -DNETSNMP_REMOVE_U64 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIE -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib64/perl5/CORE -I. -I/usr/include -fkeep-inline-functions -rdynamic -g -O2 -D_FORTIFY_SOURCE=0 -O0 -ggdb -MT libltfs_la-ltfs.lo -MD -MP -MF .deps/libltfs_la-ltfs.Tpo -c -o libltfs_la-ltfs.lo `test -f 'ltfs.c' || echo './'`ltfs.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -D_GNU_SOURCE -I../../src -DLTFS_CONFIG_FILE=\"/usr/local/etc/ltfs.conf\" -DLTFS_BASE_DIR=\"NONE\" -DUSE_NEW_LOCKING -D USE_UNORM2 -D USE_UNORM2 -I .. -Wall -Wsign-compare -fsigned-char -I/usr/include/fuse -D_FILE_OFFSET_BITS=64 -I/usr/include/uuid -I/usr/include/libxml2 -D ENABLE_SNMP -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -DNETSNMP_REMOVE_U64 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib64/perl5/CORE -I. -I/usr/include -fkeep-inline-functions -rdynamic -g -O2 -D_FORTIFY_SOURCE=0 -O0 -ggdb -MT libltfs_la-ltfs.lo -MD -MP -MF .deps/libltfs_la-ltfs.Tpo -c ltfs.c  -fPIC -DPIC -o .libs/libltfs_la-ltfs.o
cc1: error: unrecognized command-line option '-Wp'
cc1: error: unrecognized command-line option '-Wp'
cc1: error: unrecognized command-line option '-Wp'

Then I checked the Makefile and found an option:

-Wp,-Wp,-D_GLIBCXX_ASSERTIONS

There seems to be a redundant "-Wp", so I ran the command:

sed -i 's/-Wp,-Wp/-Wp/g' src/libltfs/Makefile \
    src/iosched/Makefile \
    src/utils/Makefile \
    src/kmi/Makefile \
    src/Makefile \
    src/tape_drivers/linux/sg/Makefile \
    src/tape_drivers/generic/itdtimg/Makefile \
    src/tape_drivers/generic/file/Makefile

Then I ran the build command again:

make

Then, LTFS was built successfully!

Desktop:
My Fedora, GCC, autoconf and automake versions:

$ uname -a
Linux fedora 6.2.9-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 30 22:31:57 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ gcc --version
gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)
Copyright © 2022 Free Software Foundation, Inc.
$ autoconf --version
autoconf (GNU Autoconf) 2.71
$ automake --version
automake (GNU automake) 1.16.5

LTFS source code version(commit hash): f95a9a4

Additional context
Given that the Makefile was generated by autotools, the real cause of the problem may be related to autotools configurations. Could you do a check? Thanks in advance!
I am very interested in how it happened.

@TulioLazarini
Copy link

Dear @heartofrain thanks for letting us know! I've came across your issue when I was trying to compile ltfs on Fedora 38, and got the -Wp issue as well. It was a different one this time, several Makefiles were generated with ',-Wp' rather than ' -Wp'. The extra comma before -Wp caused make to fail. I also used sed to correct all makefiles:

sed -i 's/,-Wp/ -Wp/g' src/libltfs/Makefile ./conf/Makefile ./init.d/Makefile ./man/Makefile ./messages/Makefile ./src/iosched/Makefile ./src/kmi/Makefile ./src/libltfs/Makefile ./src/tape_drivers/freebsd/cam/Makefile ./src/tape_drivers/generic/file/Makefile ./src/tape_drivers/generic/itdtimg/Makefile ./src/tape_drivers/linux/lin_tape/Makefile ./src/tape_drivers/linux/sg/Makefile ./src/tape_drivers/netbsd/scsipi-ibmtape/Makefile ./src/tape_drivers/osx/iokit/Makefile ./src/utils/Makefile ./src/Makefile ./Makefile

And I was able to build LTFS successfully, as well. It's a Fedora Workstation 38 (desktop) and these are the versions:

$ uname -a
Linux fedora 6.3.4-201.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Sat May 27 15:08:36 UTC 2023 x86_64 GNU/Linux
$ gcc --version
gcc (GCC) 13.1.1 20230511 (Red Hat 13.1.1-2)
$ autoconf --version
autoconf (GNU Autoconf) 2.71
$ automake --version
automake (GNU automake) 1.16.5

@piste-jp piste-jp added help wanted Hacktoberfest Good first issue for new contributors coming from @Hacktoberfest labels Jun 12, 2023
@TulioLazarini
Copy link

Dear @piste-jp-ibm good afternoon, just to let you know I've just cloned master branch and re-installed in Fedora 40 successfully, however we still need to tweak the auto-generated Makefiles by using the following command after configure:

sed -i 's/,-Wp/ -Wp/g' src/libltfs/Makefile ./conf/Makefile ./init.d/Makefile ./man/Makefile ./messages/Makefile ./src/iosched/Makefile ./src/kmi/Makefile ./src/libltfs/Makefile ./src/tape_drivers/freebsd/cam/Makefile ./src/tape_drivers/generic/file/Makefile ./src/tape_drivers/generic/itdtimg/Makefile ./src/tape_drivers/linux/lin_tape/Makefile ./src/tape_drivers/linux/sg/Makefile ./src/tape_drivers/netbsd/scsipi-ibmtape/Makefile ./src/tape_drivers/osx/iokit/Makefile ./src/utils/Makefile ./src/Makefile ./Makefile

Tested with Fedora 39 and Fedora 40, and works a treat. As stated before, there's something odd happening with configure when running on latest Fedora versions. Maybe something worth looking in a near future. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest Good first issue for new contributors coming from @Hacktoberfest help wanted
Projects
None yet
Development

No branches or pull requests

3 participants