Opened 6 years ago

Last modified 6 years ago

#12570 new Bugs

b2 ignores Iconv and disabled boost-locale lib, even though has_iconv.cpp passed

Reported by: hbadger@… Owned by: Artyom Beilis
Milestone: To Be Determined Component: locale
Version: Boost 1.62.0 Severity: Showstopper
Keywords: icu iconv Cc:

Description

Building boost from sources git tag 1.62.0 (4f2bdeb93a4be13ba0dc5e9f44920a2bf67191fc) I want to crossbuild it, on linux (ubuntu) host, for Mac OS X target.

Goal: crossbuild the lib boost, with boost-locale

Result: boost says that locale needs either ICU or iconv, and it does not build library for locale.

Expected result: it would build the library for boost locale.

Error messages:

...

  • iconv (libc) : no
  • iconv (separate) : no

...

  • Boost.Locale needs either iconv or ICU library to be built.

... ls stage/lib/ libboost_atomic-mt-s.a libboost_filesystem-mt-s.a libboost_program_options-mt-s.a libboost_system-mt-s.a libboost_thread-mt-s.a libboost_atomic-mt-sd.a libboost_filesystem-mt-sd.a libboost_program_options-mt-sd.a libboost_system-mt-sd.a libboost_thread-mt-sd.a

Environment:

Crosscompiler and it's toolchain is built in /home/ubuntu/build/osxcross/target/bin/ and is proven to work (builds Mach-O executables, they work when copied ontop real Mac OS X).

Mac SDK is available in /home/ubuntu/build/macsdk/MacOSX10.11.sdk/ And it provides the iconv.h file (though I do not see any .a or other file for it - is that ok?)

find /home/ubuntu/build/macsdk/MacOSX10.11.sdk/usr/include | grep iconv /home/ubuntu/build/macsdk/MacOSX10.11.sdk/usr/include/iconv.h

Executed command (in place where I downloaded boost, with needed submodules)

export WITH_ICONV="/home/ubuntu/build/macsdk/MacOSX10.11.sdk/usr/" && git clean -xdf ; git submodule foreach git clean -xdf; ./bootstrap.sh --with-icu && ./b2 headers && export OSX_CPU_ARCH="core2" && export OSX_VERSION_MIN="10.8" && time ./b2 --toolset=clang --build-type=complete --with-filesystem --with-system --with-program_options --with-thread --with-locale cxxflags=-mmacosx-version-min=${OSX_VERSION_MIN} cxxflags=-march=${OSX_CPU_ARCH} target-os=darwin architecture=x86 address-model=64 --layout=tagged link=static runtime-link=static -sNO_BZIP2=1 --sNO_ZLIB=1 --prefix=/home/ubuntu/build/boost/build-osx/ threading=multi boost.locale.icu=off boost.locale.std=off boost.locale.iconv=on -sICONV_PATH="$WITH_ICONV"

Running strace debug (strace b2), I can confirm that Boost does try to build the has_ionv.cpp program, and it seems to work fine. All invocations I seen return with 0 exit code.

E.g:

[pid 22980] execve("/home/ubuntu/build/osxcross/target/bin/x86_64-apple-darwin15-clang++", ["/home/ubuntu/build/osxcross/target/bin/x86_64-apple-darwin15-clang++", "-c", "-x", "c++", "-march=core2", "-mmacosx-version-min=10.8", "-O0", "-g", "-fno-inline", "-Wall", "-g", "-fPIC", "-m64", "-march=core2", "-mmacosx-version-min=10.8", "-DBOOST_ALL_NO_LIB=1", "-I.", "-I/home/ubuntu/build/macsdk/MacOSX10.11.sdk/usr/include", "-o", "bin.v2/libs/locale/build/clang-linux-3.8.0/debug/target-os-darwin/has_iconv_libc_ext.o", "libs/locale/src/../build/has_iconv.cpp"], 22 vars */) = 0

Repeating this test manually also works, creates the .o file, and it is indeed in Mach-O format.

No idea why then it still tells me that iconv was not enabled, and as result does not build locale.

This bug disallows me from at all using Boost until fixed.

Attachments (1)

workaround-boost-12570.patch (449 bytes ) - added by hbadger@… 6 years ago.
patch to work around this bug

Download all attachments as: .zip

Change History (8)

comment:1 by hbadger@…, 6 years ago

Actually, the .tbd library files are there too, in addition to iconv.h

usr/lib/ | grep iconv /home/ubuntu/build/macsdk/MacOSX10.11.sdk/usr/lib/libiconv.2.4.0.tbd /home/ubuntu/build/macsdk/MacOSX10.11.sdk/usr/lib/libiconv.tbd /home/ubuntu/build/macsdk/MacOSX10.11.sdk/usr/lib/libiconv.2.tbd

comment:2 by hbadger@…, 6 years ago

When forcing build of locale (by editing libs/locale/build/Jamfile.v2 and disabling result += <build>no ; in line 274) I get following errors:

clang-linux.compile.c++.without-pth bin.v2/libs/locale/build/clang-linux-3.8.0/release/boost.locale.iconv-on/boost.locale.icu-off/boost.locale.std-off/link-static/runtime-link-static/target-os-darwin/threading-multi/encoding/codepage.o
libs/locale/src/encoding/codepage.cpp:42:35: error: use of undeclared identifier 'converter_between'; did you mean 'convert_between'?
                    std::auto_ptr<converter_between> cvt;
                                  ^~~~~~~~~~~~~~~~~
                                  convert_between
libs/locale/src/encoding/codepage.cpp:36:29: note: 'convert_between' declared here
                std::string convert_between(char const *begin,
                            ^
libs/locale/src/encoding/codepage.cpp:42:35: error: template argument for template type parameter must be a type
                    std::auto_ptr<converter_between> cvt;
                                  ^~~~~~~~~~~~~~~~~
/home/ubuntu/build/osxcross/target/bin/../SDK/MacOSX10.11.sdk/usr/include/c++/4.2.1/memory:173:21: note: template parameter is declared here
  template<typename _Tp>
                    ^
libs/locale/src/encoding/codepage.cpp:68:35: error: use of undeclared identifier 'converter_to_utf'
                    std::auto_ptr<converter_to_utf<CharType> > cvt;
                                  ^
libs/locale/src/encoding/codepage.cpp:68:52: error: 'CharType' does not refer to a value
                    std::auto_ptr<converter_to_utf<CharType> > cvt;
                                                   ^
libs/locale/src/encoding/codepage.cpp:61:35: note: declared here
                template<typename CharType>
                                  ^
libs/locale/src/encoding/codepage.cpp:68:62: error: expected unqualified-id
                    std::auto_ptr<converter_to_utf<CharType> > cvt;
                                                             ^
libs/locale/src/encoding/codepage.cpp:94:35: error: no template named 'converter_from_utf'; did you mean 'convert_from'?
                    std::auto_ptr<converter_from_utf<CharType> > cvt;
                                  ^~~~~~~~~~~~~~~~~~
                                  convert_from
libs/locale/src/encoding/codepage.cpp:88:29: note: 'convert_from' declared here
                std::string convert_from(
                            ^
libs/locale/src/encoding/codepage.cpp:94:35: error: template argument for template type parameter must be a type
                    std::auto_ptr<converter_from_utf<CharType> > cvt;
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/build/osxcross/target/bin/../SDK/MacOSX10.11.sdk/usr/include/c++/4.2.1/memory:173:21: note: template parameter is declared here
  template<typename _Tp>
                    ^
7 errors generated.

comment:3 by hbadger@…, 6 years ago

If any more information is required, please contact the email, or on IRC chat (freenode server) poke user "rafalcpp" (we can debug it together on a configured box that shows the problem).

comment:4 by hbadger@…, 6 years ago

Following work-around resolves this problem for me - by advice from jhunold1:

Copy the lines 225 & 226 between 228 and 229.

After this change, the library files are created, and appear correct:

stage/lib/libboost_locale-mt-s.a: current ar archive stage/lib/libboost_locale-mt-sd.a: current ar archive

and unpacked (ar x) :

codecvt.o: Mach-O 64-bit x86_64 object

comment:5 by hbadger@…, 6 years ago

This above change is to be applied in file libs/locale/build/Jamfile.v2

by hbadger@…, 6 years ago

patch to work around this bug

comment:6 by Kohei Takahashi, 6 years ago

Component: Building Boostlocale
Owner: set to Artyom Beilis

comment:7 by hbadger@…, 6 years ago

Hi, I will buy a beer (send 20$ in Bitcoin) to who ever solves this issue if this leads to boost locale working on Mac OS X in crossbuild (so that of course a cross-builded progra using cross-builded libboost can work using boost::locale).

Please notify me on email, thanks. hbadger /at\ protonmail \dot/ com

Note: See TracTickets for help on using tickets.