Failed to build boost.locale with iconv - cross compiling on linux targetting Mac OSX arm64
Hi, I'm trying to build boost 1.92 on linux targetting arm64-apple-darwin21.4 but it fails on boost.locale because it cannot compile has_external_iconv. iconv is correctly build with libraries for the right architecture. I'm able to run the iconv binary on a mac without any issue. I found why has_external_iconv fails to build but do not know what to do to change the automatic settings to make it works. To compile has_external_iconv and confirm that I have the library in the path I provided, boost.build adds the following flags that make the compilation fail: -m64 --target=arm64-apple-darwin What makes it work is to remove -m64 and have --target=arm64-apple-darwin21.4 How can I have that? Here is my user-config.jam: using clang-darwin : : arm64-apple-darwin21.4-clang++ : <archiver>arm64-apple-darwin21.4-ar <ranlib>arm64-apple-darwin21.4-ranlib <cxxflags
"-I/softs/arm64-clang-22.1.8/release/iconv/include" <cxxflags>"-I/softs/arm64-clang-22.1.8/release/gettext/include" <cxxflags>"-I/softs/ar m64-clang-22.1.8/release/bzip2/include" <cxxflags>"-I/softs/arm64-clang-22.1.8/release/zlib/include" <cxxflags>"-I/softs/arm64-clang-22.1.8 /release/jpeg-turbo/include" <cxxflags>"-I/softs/arm64-clang-22.1.8/release/xz/include" <cxxflags>"-I/softs/arm64-clang-22.1.8/release/tiff /include" <cxxflags>"-I/softs/arm64-clang-22.1.8/release/png/include" <cxxflags>"--target=arm64-apple-darwin21.4" <cxxflags>"-std=c++14" <c xxflags>"-mmacosx-version-min=12.3" <cxxflags>"-O2" <cxxflags>"-DNDEBUG" <linkflags>"-mmacosx-version-min=12.3" <linkflags>"-L/softs/arm64- clang-22.1.8/release/iconv/lib" <linkflags>"-L/softs/arm64-clang-22.1.8/release/gettext/lib" <linkflags>"-L/softs/arm64-clang-22.1.8/releas e/bzip2/lib" <linkflags>"-L/softs/arm64-clang-22.1.8/release/zlib/lib" <linkflags>"-L/softs/arm64-clang-22.1.8/release/jpeg-turbo/lib" <lin kflags>"-L/softs/arm64-clang-22.1.8/release/xz/lib" <linkflags>"-L/softs/arm64-clang-22.1.8/release/tiff/lib" <linkflags>"-L/softs/arm64-cl ang-22.1.8/release/png/lib" ;
Here is my b2 command: CC="arm64-apple-darwin21.4-clang" CFLAGS="-O2 -DNDEBUG --target=arm64-apple-darwin21.4 -mmacosx-version-min=12.3" CXX="arm64-apple-darwin21 .4-clang++" CXXFLAGS="-O2 -DNDEBUG --target=arm64-apple-darwin21.4 -std=c++14 -mmacosx-version-min=12.3" OBJCXXFLAGS="-O2 -DNDEBUG --target =arm64-apple-darwin21.4 -std=c++14 -mmacosx-version-min=12.3" CPPFLAGS="-I/softs/arm64-clang-22.1.8/release/iconv/include -I/softs/arm64-cl ang-22.1.8/release/gettext/include -I/softs/arm64-clang-22.1.8/release/bzip2/include -I/softs/arm64-clang-22.1.8/release/zlib/include -I/so fts/arm64-clang-22.1.8/release/jpeg-turbo/include -I/softs/arm64-clang-22.1.8/release/xz/include -I/softs/arm64-clang-22.1.8/release/tiff/i nclude -I/softs/arm64-clang-22.1.8/release/png/include" LDFLAGS="-mmacosx-version-min=12.3 -L/softs/arm64-clang-22.1.8/release/iconv/lib -L /softs/arm64-clang-22.1.8/release/gettext/lib -L/softs/arm64-clang-22.1.8/release/bzip2/lib -L/softs/arm64-clang-22.1.8/release/zlib/lib -L /softs/arm64-clang-22.1.8/release/jpeg-turbo/lib -L/softs/arm64-clang-22.1.8/release/xz/lib -L/softs/arm64-clang-22.1.8/release/tiff/lib -L /softs/arm64-clang-22.1.8/release/png/lib" AR="arm64-apple-darwin21.4-ar" AS="arm64-apple-darwin21.4-as" RANLIB="arm64-apple-darwin21.4-ran lib" BUILD_MACHINE="x86_64-unknown-linux-gnu" HOST_MACHINE="arm64-apple-darwin21.4" ./b2 -d2 -j16 boost.locale.iconv=on boost.locale.icu=of f boost.locale.std=off -sICONV_PATH=/softs/arm64-clang-22.1.8/release/iconv -sBZIP2_INCLUDE=/softs/arm64-clang-22.1.8/release/bzip2/include -sBZIP2_LIBPATH=/softs/arm64-clang-22.1.8/release/bzip2/lib -sZLIB_INCLUDE=/softs/arm64-clang-22.1.8/release/zlib/include -sZLIB_LIBPATH=/ softs/arm64-clang-22.1.8/release/zlib/lib --layout=system --user-config=user-config.jam --without-mpi --without-python --without-context -- without-coroutine link=static threading=multi runtime-link=shared target-os=darwin architecture=arm binary-format=mach-o threadapi=pthread define=BOOST_FILESYSTEM_NO_DEPRECATED define=BOOST_LOG_WITHOUT_EVENT_LOG variant=release install Thanks for help, F
Hi, Is there a b2 guru who could help me find a way to have b2 find the external iconv library while cross compiling to arm64? I would like b2 to not add -m64 --target=arm64-apple-darwin while trying to build has_external_iconv but I do not know how to achive that. Thanks, F Le mer. 14 oct. 2026 à 06:05, Frédéric <ufospoke@gmail.com> a écrit :
Hi,
I'm trying to build boost 1.92 on linux targetting arm64-apple-darwin21.4 but it fails on boost.locale because it cannot compile has_external_iconv. iconv is correctly build with libraries for the right architecture. I'm able to run the iconv binary on a mac without any issue.
I found why has_external_iconv fails to build but do not know what to do to change the automatic settings to make it works.
To compile has_external_iconv and confirm that I have the library in the path I provided, boost.build adds the following flags that make the compilation fail:
-m64 --target=arm64-apple-darwin
What makes it work is to remove -m64 and have --target=arm64-apple-darwin21.4
How can I have that?
Here is my user-config.jam: using clang-darwin : : arm64-apple-darwin21.4-clang++ : <archiver>arm64-apple-darwin21.4-ar <ranlib>arm64-apple-darwin21.4-ranlib <cxxflags
"-I/softs/arm64-clang-22.1.8/release/iconv/include" <cxxflags>"-I/softs/arm64-clang-22.1.8/release/gettext/include" <cxxflags>"-I/softs/ar m64-clang-22.1.8/release/bzip2/include" <cxxflags>"-I/softs/arm64-clang-22.1.8/release/zlib/include" <cxxflags>"-I/softs/arm64-clang-22.1.8 /release/jpeg-turbo/include" <cxxflags>"-I/softs/arm64-clang-22.1.8/release/xz/include" <cxxflags>"-I/softs/arm64-clang-22.1.8/release/tiff /include" <cxxflags>"-I/softs/arm64-clang-22.1.8/release/png/include" <cxxflags>"--target=arm64-apple-darwin21.4" <cxxflags>"-std=c++14" <c xxflags>"-mmacosx-version-min=12.3" <cxxflags>"-O2" <cxxflags>"-DNDEBUG" <linkflags>"-mmacosx-version-min=12.3" <linkflags>"-L/softs/arm64- clang-22.1.8/release/iconv/lib" <linkflags>"-L/softs/arm64-clang-22.1.8/release/gettext/lib" <linkflags>"-L/softs/arm64-clang-22.1.8/releas e/bzip2/lib" <linkflags>"-L/softs/arm64-clang-22.1.8/release/zlib/lib" <linkflags>"-L/softs/arm64-clang-22.1.8/release/jpeg-turbo/lib" <lin kflags>"-L/softs/arm64-clang-22.1.8/release/xz/lib" <linkflags>"-L/softs/arm64-clang-22.1.8/release/tiff/lib" <linkflags>"-L/softs/arm64-cl ang-22.1.8/release/png/lib" ;
Here is my b2 command:
CC="arm64-apple-darwin21.4-clang" CFLAGS="-O2 -DNDEBUG --target=arm64-apple-darwin21.4 -mmacosx-version-min=12.3" CXX="arm64-apple-darwin21 .4-clang++" CXXFLAGS="-O2 -DNDEBUG --target=arm64-apple-darwin21.4 -std=c++14 -mmacosx-version-min=12.3" OBJCXXFLAGS="-O2 -DNDEBUG --target =arm64-apple-darwin21.4 -std=c++14 -mmacosx-version-min=12.3" CPPFLAGS="-I/softs/arm64-clang-22.1.8/release/iconv/include -I/softs/arm64-cl ang-22.1.8/release/gettext/include -I/softs/arm64-clang-22.1.8/release/bzip2/include -I/softs/arm64-clang-22.1.8/release/zlib/include -I/so fts/arm64-clang-22.1.8/release/jpeg-turbo/include -I/softs/arm64-clang-22.1.8/release/xz/include -I/softs/arm64-clang-22.1.8/release/tiff/i nclude -I/softs/arm64-clang-22.1.8/release/png/include" LDFLAGS="-mmacosx-version-min=12.3 -L/softs/arm64-clang-22.1.8/release/iconv/lib -L /softs/arm64-clang-22.1.8/release/gettext/lib -L/softs/arm64-clang-22.1.8/release/bzip2/lib -L/softs/arm64-clang-22.1.8/release/zlib/lib -L /softs/arm64-clang-22.1.8/release/jpeg-turbo/lib -L/softs/arm64-clang-22.1.8/release/xz/lib -L/softs/arm64-clang-22.1.8/release/tiff/lib -L /softs/arm64-clang-22.1.8/release/png/lib" AR="arm64-apple-darwin21.4-ar" AS="arm64-apple-darwin21.4-as" RANLIB="arm64-apple-darwin21.4-ran lib" BUILD_MACHINE="x86_64-unknown-linux-gnu" HOST_MACHINE="arm64-apple-darwin21.4" ./b2 -d2 -j16 boost.locale.iconv=on boost.locale.icu=of f boost.locale.std=off -sICONV_PATH=/softs/arm64-clang-22.1.8/release/iconv -sBZIP2_INCLUDE=/softs/arm64-clang-22.1.8/release/bzip2/include -sBZIP2_LIBPATH=/softs/arm64-clang-22.1.8/release/bzip2/lib -sZLIB_INCLUDE=/softs/arm64-clang-22.1.8/release/zlib/include -sZLIB_LIBPATH=/ softs/arm64-clang-22.1.8/release/zlib/lib --layout=system --user-config=user-config.jam --without-mpi --without-python --without-context -- without-coroutine link=static threading=multi runtime-link=shared target-os=darwin architecture=arm binary-format=mach-o threadapi=pthread define=BOOST_FILESYSTEM_NO_DEPRECATED define=BOOST_LOG_WITHOUT_EVENT_LOG variant=release install
Thanks for help,
F
On Sat, Oct 17, 2026 at 6:52 AM Frédéric via Boost <boost@lists.boost.org> wrote:
Hi, Is there a b2 guru who could help me find a way to have b2 find the external iconv library while cross compiling to arm64? I would like b2 to not add -m64 --target=arm64-apple-darwin while trying to build has_external_iconv but I do not know how to achive that. Thanks,
Frédéric, is it possible for you to hop on the cpplang.slack.com server boost channel. Resolving this will take some iteration that's easier "live". :-) -- -- René Ferdinand Rivera Morell -- Don't Assume Anything -- No Supongas Nada -- Robot Dreams - http://robot-dreams.net
В письме от среда, 14 октября 2026 г. 07:05:03 MSK пользователь Frédéric via Boost написал:
Hi,
I'm trying to build boost 1.92 on linux targetting arm64-apple-darwin21.4 but it fails on boost.locale because it cannot compile has_external_iconv. iconv is correctly build with libraries for the right architecture. I'm able to run the iconv binary on a mac without any issue.
I found why has_external_iconv fails to build but do not know what to do to change the automatic settings to make it works.
To compile has_external_iconv and confirm that I have the library in the path I provided, boost.build adds the following flags that make the compilation fail:
-m64 --target=arm64-apple-darwin
What makes it work is to remove -m64 and have --target=arm64-apple-darwin21.4
How can I have that?
Clang toolset recently was updated to have a <triple> option. The option allows suppressing and overriding clang's target triple guessing. So, you should be able to use <triple>arm64-apple-darwin21.4 as an option. I don't think there's a way to make the toolset to not add -m64 flag. But it looks like this shouldn't create problems for clang compiler. Also, a suggestion: rather then adding <cxxflags>"-std=c++14" to clang-darwin options add cxxstd=14 to the build request. In order to simplify your command you can add that property to a custom variant defined in your configuration file, e.g. variant myrelease : release : <cxxstd>14 ;
Hi, thank you so much Dmitry and René. Is it preferable to continue the discussion in slack rather than here (took me so long to get access to slack but I'm now ready :=))? I tried to add <triple>arm64-apple-darwin21.4 to my user-config.jam but I still cannot build has_external_iconv as the flag is not taken into account by boost.locale. When I see the full built log of boost, it seems that <triple> is not used. Thanks, F Le dim. 18 oct. 2026 à 11:33, Dmitry Arkhipov via Boost <boost@lists.boost.org> a écrit :
В письме от среда, 14 октября 2026 г. 07:05:03 MSK пользователь Frédéric via Boost написал:
Hi,
I'm trying to build boost 1.92 on linux targetting arm64-apple-darwin21.4 but it fails on boost.locale because it cannot compile has_external_iconv. iconv is correctly build with libraries for the right architecture. I'm able to run the iconv binary on a mac without any issue.
I found why has_external_iconv fails to build but do not know what to do to change the automatic settings to make it works.
To compile has_external_iconv and confirm that I have the library in the path I provided, boost.build adds the following flags that make the compilation fail:
-m64 --target=arm64-apple-darwin
What makes it work is to remove -m64 and have --target=arm64-apple-darwin21.4
How can I have that?
Clang toolset recently was updated to have a <triple> option. The option allows suppressing and overriding clang's target triple guessing. So, you should be able to use <triple>arm64-apple-darwin21.4 as an option.
I don't think there's a way to make the toolset to not add -m64 flag. But it looks like this shouldn't create problems for clang compiler.
Also, a suggestion: rather then adding <cxxflags>"-std=c++14" to clang-darwin options add cxxstd=14 to the build request. In order to simplify your command you can add that property to a custom variant defined in your configuration file, e.g.
variant myrelease : release : <cxxstd>14 ;
_______________________________________________ Boost mailing list -- boost@lists.boost.org To unsubscribe send an email to boost-leave@lists.boost.org https://lists.boost.org/mailman3/lists/boost.lists.boost.org/ Archived at: https://lists.boost.org/archives/list/boost@lists.boost.org/message/VSQV45K2...
On Sun, Oct 18, 2026 at 12:42 PM Frédéric via Boost <boost@lists.boost.org> wrote:
Hi,
thank you so much Dmitry and René. Is it preferable to continue the discussion in slack rather than here (took me so long to get access to slack but I'm now ready :=))?
Would be great if we continue in Slack. Much easier to ask you for file contents, and try things out. :-)
I tried to add <triple>arm64-apple-darwin21.4 to my user-config.jam but I still cannot build has_external_iconv as the flag is not taken into account by boost.locale.
It may be that it's not something in the bundled b2 of the particular Boost release you are using. -- -- René Ferdinand Rivera Morell -- Don't Assume Anything -- No Supongas Nada -- Robot Dreams - http://robot-dreams.net
participants (3)
-
Dmitry Arkhipov -
Frédéric -
René Ferdinand Rivera Morell