New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
boost: fix cross-compile support #105478
boost: fix cross-compile support #105478
Conversation
cc @peti |
$ECHO -n "Building Boost.Build engine with toolset $TOOLSET... " | ||
pwd=`pwd` | ||
- (cd "$my_dir/tools/build/src/engine" && ./build.sh "$TOOLSET") > bootstrap.log 2>&1 | ||
+ (cd "$my_dir/tools/build/src/engine" && CXX="$CXX_FOR_BUILD" ./build.sh "$TOOLSET") > bootstrap.log 2>&1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it not work to properly set the value of toolset
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need to set BUILD_CXX instead https://github.com/boostorg/build/blob/495b7ee9970787319dad6c70707ee8f4f18363e8/src/engine/build.sh#L41-L48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BUILD_CXX
is only used if TOOLSET
is set to cross-cxx
. Moreover doing so just sets CXX
to BUILD_CXX
. https://github.com/boostorg/build/blob/495b7ee9970787319dad6c70707ee8f4f18363e8/src/engine/build.sh#L429
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And then B2_CXX
is set to the value of CXX
, so that might be how cross compiling is implemented.
(My force push just adds the Fixes: tag, since this PR fixes #96336) |
@@ -114,7 +114,8 @@ stdenv.mkDerivation { | |||
then ./darwin-1.55-no-system-python.patch | |||
else ./darwin-no-system-python.patch) | |||
++ optional (and (versionAtLeast version "1.70") (!versionAtLeast version "1.73")) ./cmake-paths.patch | |||
++ optional (versionAtLeast version "1.73") ./cmake-paths-173.patch; | |||
++ optional (versionAtLeast version "1.73") ./cmake-paths-173.patch | |||
++ optional (stdenv.hostPlatform != stdenv.buildPlatform) ./cross.patch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch doesn't apply to boost 1.75. After fixing up the patch, I was able to cross-compile to riscv64.
IMO patches should be applied unconditionally whenever possible. If they're conditional on certain architectures or setups, they can break silently after version bumps. In this case, that means a mass rebuild, so we'll want to send this through staging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you post the correct patch, please?
Or push it here or open a new PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heads up that this probably won't apply to all versions, I only tested this on 1.75.
index ca0b08d58..5d4105ffe 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -225,4 +225,4 @@
pwd=`pwd`
- (cd "$my_dir/tools/build/src/engine" && ./build.sh)
+ (cd "$my_dir/tools/build/src/engine" && CXX="$CXX_FOR_BUILD" ./build.sh)
if [ $? -ne 0 ]; then
Motivation for this change
boost fails to cross-compile, for example when targeting mingw. This is a simple fix.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)