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

Compilation does not respect LDFLAGS #325

Closed
ConiKost opened this issue Apr 18, 2024 · 3 comments
Closed

Compilation does not respect LDFLAGS #325

ConiKost opened this issue Apr 18, 2024 · 3 comments
Assignees
Labels
bug Something isn't working platform issue Issue is specific to an OS or desktop priority-high
Milestone

Comments

@ConiKost
Copy link

ConiKost commented Apr 18, 2024

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
@michaelrsweet
Copy link
Owner

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

@michaelrsweet michaelrsweet self-assigned this Apr 18, 2024
@michaelrsweet michaelrsweet added bug Something isn't working platform issue Issue is specific to an OS or desktop priority-high labels Apr 18, 2024
@michaelrsweet michaelrsweet added this to the Stable milestone Apr 18, 2024
@ConiKost
Copy link
Author

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.

@michaelrsweet
Copy link
Owner

[master ef6b468] Default DSOFLAGS to LDFLAGS (Issue #325)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform issue Issue is specific to an OS or desktop priority-high
Projects
None yet
Development

No branches or pull requests

2 participants