Compilation does not respect LDFLAGS
ConiKost opened this issue · 3 comments
In Gentoo, we have an internal check, so we know, if the build systems does respect the CFLAGS and LDFLAGS set by user.
In this example, my *FLAGS are:
CFLAGS: -march=native -mfpmath=sse,387 -mtune=intel -O3 -frecord-gcc-switches -fomit-frame-pointer -malign-data=abi -mtls-dialect=gnu2 -pipe
LDFLAGS: -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-O1 -Wl,--sort-common -Wl,-z,now
With mxml3, all is fine, but with mxml4, the checks fails, as LDFLAGS are not used the same as set by user.
* QA Notice: Files built without respecting LDFLAGS have been detected
* Please include the following list of files in your report:
* /usr/lib64/libmxml4.so.2
>>> Emerging (1 of 1) dev-libs/mxml-4.0.2::galactica
* mxml-4.0.2.tar.gz BLAKE2B SHA512 size ;-) ... [ ok ]
>>> Unpacking source...
>>> Unpacking mxml-4.0.2.tar.gz to /var/tmp/portage/dev-libs/mxml-4.0.2/work
>>> Source unpacked in /var/tmp/portage/dev-libs/mxml-4.0.2/work
>>> Preparing source in /var/tmp/portage/dev-libs/mxml-4.0.2/work/mxml-4.0.2 ...
* Applying mxml-4.0.2-rename-man-page.patch ... [ ok ]
* Running 'autoconf' ... [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-libs/mxml-4.0.2/work/mxml-4.0.2 ...
* econf: updating mxml-4.0.2/config.guess with /usr/share/gnuconfig/config.guess
* econf: updating mxml-4.0.2/config.sub with /usr/share/gnuconfig/config.sub
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --docdir=/usr/share/doc/mxml-4.0.2 --htmldir=/usr/share/doc/mxml-4.0.2/html --libdir=/usr/lib64 --disable-static --enable-threads --with-docdir=/usr/share/doc/mxml-4.0.2
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... yes
checking for x86_64-pc-linux-gnu-gcc option to enable C11 features... none needed
checking for x86_64-pc-linux-gnu-ranlib... x86_64-pc-linux-gnu-ranlib
checking for ar... /usr/bin/ar
checking for codesign... no
checking for true... /bin/true
checking for install-sh script... using /var/tmp/portage/dev-libs/mxml-4.0.2/work/mxml-4.0.2/install-sh
checking for ldconfig... /sbin/ldconfig
checking for mkdir... /bin/mkdir
checking for rm... /bin/rm
checking for rmdir... /bin/rmdir
checking for ln... /bin/ln
checking for inline... inline
checking for unsigned long long int... yes
checking for long long int... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for pthread.h... yes
checking for pthread_create using -lpthreads... no
checking for pthread_create using -lpthread... yes
checking whether compiler supports -Wno-char-subscripts... yes
checking whether compiler supports -Wno-deprecated-declarations... yes
checking whether compiler supports -Wno-format-truncation... yes
checking whether compiler supports -Wno-format-y2k... yes
checking whether compiler supports -Wno-switch... yes
checking whether compiler supports -Wno-unused-result... yes
checking whether compiler supports -fPIE... yes
checking for OS-specific compiler options... -D__USE_MISC -D_GNU_SOURCE -Wl,-z,relro,-z,now
configure: creating ./config.status
config.status: creating Makefile
config.status: creating mxml4.pc
config.status: creating config.h
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-libs/mxml-4.0.2/work/mxml-4.0.2 ...
make -j9 -l8
echo Compiling mxml-attr.c
echo Compiling mxml-file.c
echo Compiling mxml-get.c
echo Compiling mxml-index.c
Compiling mxml-attr.c
echo Compiling mxml-node.c
x86_64-pc-linux-gnu-gcc -fPIC -march=native -mfpmath=sse,387 -mtune=intel -O3 -frecord-gcc-switches -fomit-frame-pointer -malign-data=abi -mtls-dialect=gnu2 -pipe -D_THREAD_SAFE -D_REENTRANT -D__USE_MISC -D_GNU_SOURCE -g -Os -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result -c -o mxml-attr.o mxml-attr.c
Compiling mxml-file.c
x86_64-pc-linux-gnu-gcc -fPIC -march=native -mfpmath=sse,387 -mtune=intel -O3 -frecord-gcc-switches -fomit-frame-pointer -malign-data=abi -mtls-dialect=gnu2 -pipe -D_THREAD_SAFE -D_REENTRANT -D__USE_MISC -D_GNU_SOURCE -g -Os -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result -c -o mxml-file.o mxml-file.c
echo Compiling mxml-options.c
Compiling mxml-get.c
Compiling mxml-index.c
x86_64-pc-linux-gnu-gcc -fPIC -march=native -mfpmath=sse,387 -mtune=intel -O3 -frecord-gcc-switches -fomit-frame-pointer -malign-data=abi -mtls-dialect=gnu2 -pipe -D_THREAD_SAFE -D_REENTRANT -D__USE_MISC -D_GNU_SOURCE -g -Os -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result -c -o mxml-get.o mxml-get.c
x86_64-pc-linux-gnu-gcc -fPIC -march=native -mfpmath=sse,387 -mtune=intel -O3 -frecord-gcc-switches -fomit-frame-pointer -malign-data=abi -mtls-dialect=gnu2 -pipe -D_THREAD_SAFE -D_REENTRANT -D__USE_MISC -D_GNU_SOURCE -g -Os -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result -c -o mxml-index.o mxml-index.c
Compiling mxml-node.c
x86_64-pc-linux-gnu-gcc -fPIC -march=native -mfpmath=sse,387 -mtune=intel -O3 -frecord-gcc-switches -fomit-frame-pointer -malign-data=abi -mtls-dialect=gnu2 -pipe -D_THREAD_SAFE -D_REENTRANT -D__USE_MISC -D_GNU_SOURCE -g -Os -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result -c -o mxml-node.o mxml-node.c
echo Compiling mxml-search.c
echo Compiling mxml-set.c
Compiling mxml-options.c
x86_64-pc-linux-gnu-gcc -fPIC -march=native -mfpmath=sse,387 -mtune=intel -O3 -frecord-gcc-switches -fomit-frame-pointer -malign-data=abi -mtls-dialect=gnu2 -pipe -D_THREAD_SAFE -D_REENTRANT -D__USE_MISC -D_GNU_SOURCE -g -Os -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result -c -o mxml-options.o mxml-options.c
Compiling mxml-search.c
x86_64-pc-linux-gnu-gcc -fPIC -march=native -mfpmath=sse,387 -mtune=intel -O3 -frecord-gcc-switches -fomit-frame-pointer -malign-data=abi -mtls-dialect=gnu2 -pipe -D_THREAD_SAFE -D_REENTRANT -D__USE_MISC -D_GNU_SOURCE -g -Os -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result -c -o mxml-search.o mxml-search.c
Compiling mxml-set.c
x86_64-pc-linux-gnu-gcc -fPIC -march=native -mfpmath=sse,387 -mtune=intel -O3 -frecord-gcc-switches -fomit-frame-pointer -malign-data=abi -mtls-dialect=gnu2 -pipe -D_THREAD_SAFE -D_REENTRANT -D__USE_MISC -D_GNU_SOURCE -g -Os -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result -c -o mxml-set.o mxml-set.c
echo Compiling mxml-private.c
Compiling mxml-private.c
x86_64-pc-linux-gnu-gcc -fPIC -march=native -mfpmath=sse,387 -mtune=intel -O3 -frecord-gcc-switches -fomit-frame-pointer -malign-data=abi -mtls-dialect=gnu2 -pipe -D_THREAD_SAFE -D_REENTRANT -D__USE_MISC -D_GNU_SOURCE -g -Os -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result -c -o mxml-private.o mxml-private.c
echo Creating libmxml4.so.2...
Creating libmxml4.so.2...
x86_64-pc-linux-gnu-gcc -Wl,-soname,`basename libmxml4.so.2` -shared -g -Os -o libmxml4.so.2 mxml-attr.o mxml-file.o mxml-get.o mxml-index.o mxml-node.o mxml-options.o mxml-search.o mxml-set.o mxml-private.o -lpthread -lm
/bin/rm -f `basename libmxml4.so.2 .2`
/bin/ln -sf libmxml4.so.2 `basename libmxml4.so.2 .2`
>>> Source compiled.
* QA Notice: Files built without respecting LDFLAGS have been detected
* Please include the following list of files in your report:
* /usr/lib64/libmxml4.so.2
That's probably because DSOFLAGS gets used when building a shared library instead of LDFLAGS. I can look at updating the configure script to use the LDFLAGS value if DSOFLAGS is not set...
That's probably because DSOFLAGS gets used when building a shared library instead of LDFLAGS. I can look at updating the configure script to use the LDFLAGS value if DSOFLAGS is not set...
Yes, you are right. I just tried and added DSOFLAGS=${LDFLAGS} and it worked for me.