Prefer target-os when detecting the default binary-format#335
Open
uilianries wants to merge 1 commit into
Open
Prefer target-os when detecting the default binary-format#335uilianries wants to merge 1 commit into
uilianries wants to merge 1 commit into
Conversation
Signed-off-by: Uilian Ries <uilianries@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Greetings! 👋
Companion fix to #334, which fixeds
<abi>default to derivefrom the deduced target architecture instead of the host CPU, the
<binary-format>has the same class of problem: its default is derived purely from the host
[ os.name ], never from the deduced target, and passingtarget-osdoes notcorrect it.
This breaks cross-OS builds - for instance building from a macOS or Windows
host to Android/Linux. Instead of a b2 "No best alternative" message, the
wrong-but-existing
<toolset>clangalternative is picked anyway and fails atthe assembler/linker stage, e.g.:
You can check the full build log with the error, cross-building from Mac M1 to Android here boost-1.91.0-darwin-android.log
This happens because
binary-formatdefaulted tomach-oon a macOS host(or
peon a Windows host) regardless oftarget-os=android, so Contextpicked
make_arm64_aapcs_macho_gas.S/*_pe_armclang.Sinstead of theELF variant expected by the Android NDK's clang.
This PR makes b2 derive Context's
binary-formatfrom the deduced<target-os>, but preserves the current implementation as fallback for native builds.With this change, Context picks the expected and correct files like
make_arm64_aapcs_elf_gas.Sandjump_arm64_aapcs_elf_gas.S. The builtlibboost_context.sois a valid ELF shared object for the target:You can check the same build as before, but using this proposed patch. It builds Boost Context with success now: boost-1.91.0-darwin-android-patched.log
Steps to Reproduce
On my local machine, I'm using
/Users/uilian/Library/Android/sdk/ndk/30.0.15729638/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang++, just to let you know. My NDK is installed via Android Studio to avoid any mistakes.Let me know if you need more information about this case or about this proposal. Regards!