I'm not sure from which version when it started, but boost-build currently overrides -march and -m32/-m64 by default, no matter what is supplied though the ebuild. Furthermore, in order to support run-time SSSE and AVX detection, dev-libs/boost again overrides -march to CPU types supporting those instruction-sets. This doesn't itself prevent a successful emerge on x86 and/or amd64/multilib, but is fatal to x32, since boost-build attempts to use -march=i686 and -m32 in this case. This behaviour also prevents the use of LTO optimization on non-intel or core-avx-i or earlier, this is due to GCC being unable to use more than one -march= for a given compilation unit, which is the whole-program with LTO, and attempts to use -march=core-avx-i on incompatible CPUs. My solution is to remove all the support from dev-util/boost-build and dev-libs/boost for automagic -march= and -m32/-m64 selection for gcc. I've also back-ported the experimental x32 support from boost/develop branch which supersedes the version in the portage tree.
Created attachment 427032 [details] boost-build ebuild with new sed pass and patches
Created attachment 427034 [details, diff] Add libx32 to search paths
Created attachment 427036 [details, diff] Remove -m32/-m64 automagic flags
Created attachment 427044 [details] dev-libs/boost ebuild with new patches
Created attachment 427046 [details, diff] Back-ported x32 context patch from upstream
Created attachment 427048 [details, diff] Remove -march overrides on SSSE and AVX compile
Obsolete, reopen if issue persists. commit 400e20295bf062a0bf697acce718e78116b143e2 Author: David Seifert <soap@gentoo.org> Date: Tue Apr 4 19:33:14 2017 +0200 dev-libs/boost: Remove old
This is still a problem today with dev-libs/boost-1.65.0 on x32.
This is still an issue. I've been maintaining the patches ever since. Currently when building on x32 dev-libs/boost builds i386 binaries instead of x32. Current ebuild/patches follow...
Created attachment 775808 [details] dev-util/boost-build ebuild with x32 patch
Created attachment 775811 [details, diff] Add libx32 to search paths
Created attachment 775814 [details, diff] Remove -m32/-m64 automagic flags
Created attachment 775817 [details] dev-libs/boost ebuild with new patches and abi override
Created attachment 775820 [details, diff] x32 context support patch
(In reply to Steven Newbury from comment #14) > Created attachment 775820 [details, diff] [details, diff] > x32 context support patch Could you submit this upstream to https://github.com/boostorg/context?
In the latest version attached above I used 32_64 for the address-model to differentiate from x86-32, however this breaks the build of packages using boost_python since the boost_python cmake file then determines that the boost libraries are 64 bit. I'll attach new versions using address-model = 32 instead once I confirm that it resolves this issue. It's how I originally wrote the patch.
(In reply to Sam James from comment #15) > (In reply to Steven Newbury from comment #14) > > Created attachment 775820 [details, diff] [details, diff] [details, diff] > > x32 context support patch > > Could you submit this upstream to https://github.com/boostorg/context? I did originally. As I recall it got side tracked by discussion about forcing gcc flags instead of using the user provided flags and feature tests and/or function attributes, and the weren't very receptive. I guess it was nearly a decade ago, maybe I should try again...?
Created attachment 777722 [details] dev-libs/boost ebuild with new patches and abi override
Created attachment 777725 [details, diff] x32 context support patch
(In reply to Steven Newbury from comment #19) > Created attachment 777725 [details, diff] [details, diff] > x32 context support patch https://github.com/boostorg/context/blob/develop/build/Jamfile.v2#L843 isn't that code identical to your patch? Do you we really still need your patch?
Closing since I believe this to be upstreamed now