boostorg / context

307 stars 150 forks source link

`binary-format` and `abi` detection does not support cross-compilation, nor multiarch #193

Closed Kojoley closed 2 years ago

Kojoley commented 2 years ago

Values for binary-format and abi are calculated using information about host, not the target: https://github.com/boostorg/context/blob/83f998828c377ebd27d32455154f1f9cebf09b93/build/Jamfile.v2#L57-L65 https://github.com/boostorg/context/blob/83f998828c377ebd27d32455154f1f9cebf09b93/build/Jamfile.v2#L77-L86

The actual user was hit by this https://github.com/bfgroup/b2/issues/105#issuecomment-996115240

The logic also will yield incorrect results where a compiler is producing multiarch binaries, for example on apple clang it should at the same time deduce both x86 and arm for <architecture>, and sysv and aapcs for <abi>.

olk commented 2 years ago

Support for multiarch/cross-comp. must be implemented inside boost.build.

Kojoley commented 2 years ago

Cross compilation is implemented for some toolsets in B2 already, the mentioned code above which is not compatible with cross compilation is in Context.

olk commented 2 years ago

Boost.Build does not detect the ABI and BIANRY_FORMAT for which the code has to be compiled (I think there is no proper way to do it). The only way is that Boost.Context guesses the ABI and BINARY_FORMAT depending on the platform it is build on. For cross compilation you can override the properties at command line - for instance abi=aapcs binary_format=elf