boostorg / build

B2 makes it easy to build C++ projects, everywhere.
Boost Software License 1.0
229 stars 46 forks source link

check-target-builds builds wrong variant. #529

Open jzmaddock opened 4 years ago

jzmaddock commented 4 years ago

I have an open regex ticket that appears to be a Boost.Build issue: in short when building release mode Boost, configuration tests are built in debug mode (so it appears).

See https://github.com/boostorg/regex/issues/95.

bebuch commented 4 years ago

For some targets the names icuuc, icui18n and icudata are always used. This is the case even if ICU_ICUUC_NAME, ICU_ICUDT_NAME and ICU_ICUIN_NAME are defined explicitly.

This is my cross build from Linux to Windows via Mingw-w64:

./b2 toolset=gcc variant=release threading=multi link=static target-os=windows architecture=x86 address-model=64 abi=ms binary-format=pe include=/mingw/include library-path=/mingw/lib define=U_DISABLE_VERSION_SUFFIX=1 -sICU_ICUUC_NAME=sicuuc -sICU_ICUDT_NAME=sicudt -sICU_ICUIN_NAME=sicuin --layout=system --prefix=/install --without-python --without-graph_parallel --without-mpi -j $(nproc) install

My /mingw/lib/ dir:

$ ls -l /mingw/lib/
total 19084
drwxr-xr-x 3 root root     4096 Feb  2 16:00 icu
-rw-r--r-- 1 root root   371114 Feb  2 15:58 libbz2.a
-rw-r--r-- 1 root root  1940512 Feb  2 16:08 liblzma.a
-rwxr-xr-x 1 root root      876 Feb  2 16:08 liblzma.la
-rwxr-xr-x 1 root root      736 Feb  2 16:00 libsicudt.a
-rwxr-xr-x 1 root root 10895028 Feb  2 16:00 libsicuin.a
-rwxr-xr-x 1 root root   143990 Feb  2 16:00 libsicuio.a
-rwxr-xr-x 1 root root  5196448 Feb  2 16:00 libsicuuc.a
-rw-r--r-- 1 root root   118758 Feb  2 16:01 libz.a
-rw-r--r-- 1 root root   850738 Feb  2 16:07 libzstd.a
drwxr-xr-x 1 root root     4096 Feb  2 16:00 pkgconfig

From config.log:

...updating 2 targets...
gcc.compile.c++ bin.v2/libs/locale/build/gcc-9.2.0/debug/target-os-windows/threading-multi/visibility-hidden/has_icu_obj.o
libs/locale/src/../build/has_icu_test.cpp: In function 'int main()':
libs/locale/src/../build/has_icu_test.cpp:26:12: warning: unused variable 'c' [-Wunused-variable]
   26 |    UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, "GREEK SMALL LETTER ALPHA", &err);
      |            ^
gcc.link bin.v2/libs/locale/build/gcc-9.2.0/debug/target-os-windows/threading-multi/visibility-hidden/has_icu.exe
/usr/local/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -licudata
/usr/local/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -licui18n
/usr/local/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -licuuc
collect2: error: ld returned 1 exit status

    "x86_64-w64-mingw32-g++" -L"/mingw/lib"   -o "bin.v2/libs/locale/build/gcc-9.2.0/debug/target-os-windows/threading-multi/visibility-hidden/has_icu.exe" -Wl,--start-group "bin.v2/libs/locale/build/gcc-9.2.0/debug/target-os-windows/threading-multi/visibility-hidden/has_icu_obj.o"  -Wl,-Bstatic  -Wl,-Bdynamic -licudata -licui18n -licuuc -Wl,--end-group -m64 -mthreads -g -fvisibility=hidden -fvisibility-inlines-hidden 

...failed gcc.link bin.v2/libs/locale/build/gcc-9.2.0/debug/target-os-windows/threading-multi/visibility-hidden/has_icu.exe...
...failed updating 1 target...
...updated 1 target...
...found 2 targets...
...updating 2 targets...
gcc.compile.c++ bin.v2/libs/locale/build/gcc-9.2.0/debug/target-os-windows/threading-multi/visibility-hidden/has_icu64_obj.o
libs/locale/src/../build/has_icu_test.cpp: In function 'int main()':
libs/locale/src/../build/has_icu_test.cpp:26:12: warning: unused variable 'c' [-Wunused-variable]
   26 |    UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, "GREEK SMALL LETTER ALPHA", &err);
      |            ^
gcc.link bin.v2/libs/locale/build/gcc-9.2.0/debug/target-os-windows/threading-multi/visibility-hidden/has_icu64.exe
/usr/local/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -licudata
/usr/local/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -licui18n
/usr/local/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -licuuc
collect2: error: ld returned 1 exit status

    "x86_64-w64-mingw32-g++" -L"/mingw/lib"   -o "bin.v2/libs/locale/build/gcc-9.2.0/debug/target-os-windows/threading-multi/visibility-hidden/has_icu64.exe" -Wl,--start-group "bin.v2/libs/locale/build/gcc-9.2.0/debug/target-os-windows/threading-multi/visibility-hidden/has_icu64_obj.o"  -Wl,-Bstatic  -Wl,-Bdynamic -licudata -licui18n -licuuc -Wl,--end-group -m64 -mthreads -g -fvisibility=hidden -fvisibility-inlines-hidden 

After applying this patch which fixes another bug in the same area and setting filesystem links for the ICU static archives the compilation succeeds.

mbluett88 commented 4 years ago

This is what I am using under Linux Mint 20:

./b2 threading=multi link=shared library-path=/usr/lib/x86_64-linux-gnu include=/usr/include cxxflags='-std=c++11' define=U_DISABLE_VERSION_SUFFIX=1 -sICU_ICUUC_NAME=sicuuc -sICU_ICUDT_NAME=sicudt -sICU_ICUIN_NAME=sicuin

And it still doesn't recognize ICU.

stale[bot] commented 3 years ago

Thank you for your contributions. Main development of B2 has moved to https://github.com/bfgroup/b2 This issue has been automatically marked as "transition" to indicate the potential for needing transition to the new B2 development project.