1.2.0 fails to build
lightdot opened this issue · 6 comments
Using mock build environment on CentOS 8. Looks like an error when passing options to apxs:
make[1]: Entering directory '/builddir/build/BUILD/mod_maxminddb-1.2.0/src'
/usr/bin/apxs -c -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -lmaxminddb -Wc,"-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -std=c99 -fms-extensions" mod_maxminddb.c
apxs:Error: Unknown option: s.
apxs:Error: Unknown option: s.
apxs:Error: Unknown option: =.
apxs:Error: Unknown option: /.
apxs:Error: Unknown option: u.
apxs:Error: Unknown option: s.
apxs:Error: Unknown option: r.
apxs:Error: Unknown option: /.
Usage: apxs -g [-S <var>=<val>] -n <modname>
apxs -q [-v] [-S <var>=<val>] [<query> ...]
apxs -c [-S <var>=<val>] [-o <dsofile>] [-D <name>[=<value>]]
[-I <incdir>] [-L <libdir>] [-l <libname>] [-Wc,<flags>]
[-Wl,<flags>] [-p] <files> ...
apxs -i [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...
apxs -e [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...
make[1]: Leaving directory '/builddir/build/BUILD/mod_maxminddb-1.2.0/src'
make[1]: *** [Makefile:405: module] Error 1
make: *** [Makefile:336: all-recursive] Error 1
As a stop gap, you could run apxs
manually rather than through make. It doesn't like the -specs
flag that is getting added on your machine.
Do you have any more information about how you're building this? I tried on CentOS 8 and I was able to build it successfully.
One thought is we may need to adjust the Makefile here to something like:
-Wl,"$(LDFLAGS) $(LIBMAXMINDDB_LDFLAGS)"
instead of the part that says
$(LDFLAGS) $(LIBMAXMINDDB_LDFLAGS)
You'd have to run ./bootstrap
to regenerate things to try this.
I am going to close this as we were not able to reproduce it. I'd be happy to re-open it if more occurrences or details emerge. Thanks!
I experienced the same issue when packaging mod_maxminddb for Fedora and EPEL. The underlying issue is that the hardening compile-time flags are not properly passed through your Makefile etc. to axps
. Building without hardening works, but is not acceptable for official Fedora RPM packages. Let me know if you need more details or a specific reproducer, please.
export CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -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'
export CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -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'
export FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -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 -I/usr/lib64/gfortran/modules'
export FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -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 -I/usr/lib64/gfortran/modules'
export LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/mod_maxminddb-1.2.0/.package_note-mod_maxminddb-1.2.0-1.fc36.x86_64.ld'
One thought is we may need to adjust the Makefile here to something like:
-Wl,"$(LDFLAGS) $(LIBMAXMINDDB_LDFLAGS)"
instead of the part that says
$(LDFLAGS) $(LIBMAXMINDDB_LDFLAGS)
You'd have to run
./bootstrap
to regenerate things to try this.
I can confirm.
While building a package on Ubuntu 20.04 was working fine, it began to fail on 22.04 with similar output what the OP wrote.
./bootstrap
dpkg-buildpackage -us -uc --no-sign
was enough to produce the error.
Changing the src/Makefile.am accordingly fixed it and the .deb was build without issue. thx