LinearTapeFileSystem / LinearTapeFileSystem/ltfs

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

Open
#394 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Hacktoberfest help wanted
Dominant language
C
Stars
352
Forks
110
Avg merge
2h 50m
Merged PRs (30d)
2

Description

**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): f95a9a4463a0e3dbb0b69aa57324a78e4eb80322

**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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with ./autogen.sh, ./configure, and make, then inspect the generated Makefiles listed in the report for the duplicated -Wp,-Wp flag. Trace the relevant build configuration that produces those flags. Done means Fedora 37 builds successfully without manually editing the generated Makefiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.