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

m4/boost.m4: fix rpath option check for static linking #15

Merged
merged 1 commit into from
Jul 29, 2020
Merged

m4/boost.m4: fix rpath option check for static linking #15

merged 1 commit into from
Jul 29, 2020

Conversation

ffontaine
Copy link

When statically linking, the order in which -l options are passed is
important. The contents of the LIBS option passed to the configure
environment should be passed after other -l options used internally
by the package.

For example, libboost_program_options may used symbols from the
libatomic library, and in this case, one need to pass LIBS="-latomic"
to cc-tool's configure script. When using dynamic linking, this works
fine, because the rpath test does "-latomic
-lboost_program_options". However, when statically linking, this
doesn't work because libboost_program_options uses symbols from
libatomic, so -latomic must be passed after -lboost_program_options.

Therefore, this commit inverts the list of variables used to construct
LIBS before doing the _BOOST_AC_LINK_IFELSE() test detecting the rpath
option to be used. Indeed, $boost_save_LIBS contains the previously
saved LIBS variable, and should be passed after $Boost_lib_LIBS.

Signed-off-by: Thomas Petazzoni thomas.petazzoni@free-electrons.com
[Retrieved from:
https://git.buildroot.net/buildroot/tree/package/cc-tool/0004-m4-boost.m4-fix-rpath-option-check-for-static-linkin.patch]
Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

When statically linking, the order in which -l options are passed is
important. The contents of the LIBS option passed to the configure
environment should be passed *after* other -l options used internally
by the package.

For example, libboost_program_options may used symbols from the
libatomic library, and in this case, one need to pass LIBS="-latomic"
to cc-tool's configure script. When using dynamic linking, this works
fine, because the rpath test does "-latomic
-lboost_program_options". However, when statically linking, this
doesn't work because libboost_program_options uses symbols from
libatomic, so -latomic must be passed *after* -lboost_program_options.

Therefore, this commit inverts the list of variables used to construct
LIBS before doing the _BOOST_AC_LINK_IFELSE() test detecting the rpath
option to be used. Indeed, $boost_save_LIBS contains the previously
saved LIBS variable, and should be passed after $Boost_lib_LIBS.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Retrieved from:
https://git.buildroot.net/buildroot/tree/package/cc-tool/0004-m4-boost.m4-fix-rpath-option-check-for-static-linkin.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
@dashesy dashesy merged commit 51fd9df into dashesy:master Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants