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

[BUG] --enable-static-boost=yes still links against dynamic boost libraries. #384

Closed
gottaeat opened this issue May 9, 2020 · 1 comment
Assignees
Labels

Comments

@gottaeat
Copy link

gottaeat commented May 9, 2020

Describe the bug
building the latest state of the repo using the --enable-static-boost=yes flag, it builds just fine but still links against dynamic boost libraries. if there's only static .a libraries, it simply fails saying configure: error: cannot find the flags to link with Boost locale.

To Reproduce
i have boost-1.72.0 installed at /mss/work/table/usr.

./configure \
 --prefix=/usr         \
\
 --enable-static-boost=yes        \
 --with-boost=/mss/work/table/usr \
\
 --enable-clock      \
 --enable-outputs    \
 --enable-unicode    \
 --enable-visualizer \
\
 --with-curl \
 --with-fftw \
 --with-taglib

after running configure with these exact flags, you'll see that it builds fine if you have dynamic boost libraries installed, but it still looks for them when you execute the binary.
if you have only static boost libraries installed, it'll simply fail saying:
configure: error: cannot find the flags to link with Boost locale

Expected behavior
to link boost libraries statically when it is said so.

Screenshots/Logs
If applicable, add screenshots or logs to help explain your problem.

checking for Boost headers version >= 1.60.0... /mss/work/table/usr/include
checking for Boost's header version... 1_72
checking boost/algorithm/string.hpp usability... yes
checking boost/algorithm/string.hpp presence... yes
checking for boost/algorithm/string.hpp... yes
checking boost/format.hpp usability... yes
checking boost/format.hpp presence... yes
checking for boost/format.hpp... yes
checking boost/functional/hash.hpp usability... yes
checking boost/functional/hash.hpp presence... yes
checking for boost/functional/hash.hpp... yes
checking boost/cast.hpp usability... yes
checking boost/cast.hpp presence... yes
checking for boost/cast.hpp... yes
checking boost/lexical_cast.hpp usability... yes
checking boost/lexical_cast.hpp presence... yes
checking for boost/lexical_cast.hpp... yes
checking boost/math/special_functions.hpp usability... yes
checking boost/math/special_functions.hpp presence... yes
checking for boost/math/special_functions.hpp... yes
checking boost/optional.hpp usability... yes
checking boost/optional.hpp presence... yes
checking for boost/optional.hpp... yes
checking boost/range/adaptors.hpp usability... yes
checking boost/range/adaptors.hpp presence... yes
checking for boost/range/adaptors.hpp... yes
checking boost/tokenizer.hpp usability... yes
checking boost/tokenizer.hpp presence... yes
checking for boost/tokenizer.hpp... yes
checking boost/tuple/tuple.hpp usability... yes
checking boost/tuple/tuple.hpp presence... yes
checking for boost/tuple/tuple.hpp... yes
checking boost/variant/variant_fwd.hpp usability... yes
checking boost/variant/variant_fwd.hpp presence... yes
checking for boost/variant/variant_fwd.hpp... yes
checking boost/variant.hpp usability... yes
checking boost/variant.hpp presence... yes
checking for boost/variant.hpp... yes
checking for the toolset name used by Boost for x86_64-apathy-linux-musl-g++... configure: WARNING: could not figure out which toolset name to use
for x86_64-apathy-linux-musl-g++

checking boost/date_time/posix_time/posix_time.hpp usability... yes
checking boost/date_time/posix_time/posix_time.hpp presence... yes
checking for boost/date_time/posix_time/posix_time.hpp... yes
checking for the Boost date_time library... yes
checking boost/system/error_code.hpp usability... yes
checking boost/system/error_code.hpp presence... yes
checking for boost/system/error_code.hpp... yes
checking for the Boost system library... (cached) yes
checking boost/filesystem/path.hpp usability... yes
checking boost/filesystem/path.hpp presence... yes
checking for boost/filesystem/path.hpp... yes
checking for the Boost filesystem library... (cached) yes
checking for boost/system/error_code.hpp... (cached) yes
checking for the Boost system library... (cached) yes
checking boost/locale.hpp usability... yes
checking boost/locale.hpp presence... yes
checking for boost/locale.hpp... yes
checking for the Boost locale library... no
configure: error: cannot find the flags to link with Boost locale

Desktop (please complete the following information):

  • os: x86_64 musl linux host
  • shell: yash-2.49, busybox-1.31 ash
@gottaeat
Copy link
Author

gottaeat commented May 9, 2020

there seems to be a problem with the build system, because doing the linking manually works as expected and produces a binary with boost statically linked to it.

1. export:

export CPPFLAGS="-I/mss/work/table/usr/include"
export LDFLAGS="-L/mss/work/table/usr/lib"
export LIBRARY_PATH="/mss/work/table/usr/lib"

2. configure:

./configure \
 --build=$CBUILD       \
 --host=$CHOST         \
 --prefix=/usr         \
\
 --enable-static-boost            \
 --with-boost=/mss/work/table/usr \
\
 --enable-clock      \
 --enable-outputs    \
 --enable-unicode    \
 --enable-visualizer \
\
 --with-curl \
 --with-fftw \
 --with-taglib

3. build:

make -j2 -f Makefile

4. remove the binary and link it manually, statically linking boost libraries:

cd src/
rm -rfv ncmpcpp

x86_64-apathy-linux-musl-g++ \
 -march=native -mtune=native        \
 -std=c++14                         \
 -L/mss/work/table/usr/lib          \
\
 -o ncmpcpp \
 curses/formatted_color.o   curses/scrollpad.o         \
 curses/window.o            screens/browser.o          \
 screens/clock.o            screens/help.o             \
 screens/lastfm.o           screens/lyrics.o           \
 screens/media_library.o    screens/outputs.o          \
 screens/playlist.o         screens/playlist_editor.o  \
 screens/screen.o           screens/screen_type.o      \
 screens/search_engine.o    screens/sel_items_adder.o  \
 screens/server_info.o      screens/song_info.o        \
 screens/sort_playlist.o    screens/tag_editor.o       \
 screens/tiny_tag_editor.o  screens/visualizer.o       \
\
 utility/comparators.o      utility/html.o             \
 utility/option_parser.o    utility/string.o           \
 utility/type_conversions.o utility/wide_string.o      \
\
 actions.o bindings.o charset.o configuration.o        \
 curl_handle.o display.o enums.o format.o global.o     \
 helpers.o lastfm_service.o lyrics_fetcher.o           \
 macro_utilities.o mpdpp.o mutable_song.o ncmpcpp.o    \
 settings.o song.o song_list.o status.o statusbar.o    \
 tags.o title.o                                        \
\
 -Wl,-Bstatic  -lboost_date_time -lboost_filesystem    \
 -lboost_locale -lboost_program_options -lboost_regex  \
 -lboost_thread -lboost_system                         \
\
 -Wl,-Bdynamic -licui18n -licuuc -licudata -lmpdclient \
 -lreadline -lpthread -lncursesw -lfftw3 -lcurl -ltag

5. do readelf -d on the binary:

 $ [src]: readelf -d ./ncmpcpp

Dynamic section at offset 0x573c68 contains 36 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libicui18n.so.65]
 0x0000000000000001 (NEEDED)             Shared library: [libicuuc.so.65]
 0x0000000000000001 (NEEDED)             Shared library: [libicudata.so.65]
 0x0000000000000001 (NEEDED)             Shared library: [libmpdclient.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libreadline.so.8]
 0x0000000000000001 (NEEDED)             Shared library: [libncursesw.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libfftw3.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libcurl.so.4]
 0x0000000000000001 (NEEDED)             Shared library: [libtag.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so]
 0x000000000000000c (INIT)               0x63000
 0x000000000000000d (FINI)               0x3bcb11
 0x0000000000000019 (INIT_ARRAY)         0x556e20
 0x000000000000001b (INIT_ARRAYSZ)       480 (bytes)
 0x0000000000000004 (HASH)               0x2e8
 0x000000006ffffef5 (GNU_HASH)           0x2658
 0x0000000000000005 (STRTAB)             0xa3a0
 0x0000000000000006 (SYMTAB)             0x2ff0
 0x000000000000000a (STRSZ)              47947 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x575000
 0x0000000000000002 (PLTRELSZ)           20136 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x5dc70
 0x0000000000000007 (RELA)               0x168d0
 0x0000000000000008 (RELASZ)             291744 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffb (FLAGS_1)            Flags: PIE
 0x000000006ffffffe (VERNEED)            0x16890
 0x000000006fffffff (VERNEEDNUM)         2
 0x000000006ffffff0 (VERSYM)             0x15eec
 0x000000006ffffff9 (RELACOUNT)          10150
 0x0000000000000000 (NULL)               0x0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants