Skip to content

Conversation

@antoinefaure
Copy link

Hi,

Thanks for this project :)

I encountered an issue when trying to cross compile vector using Yocto Scarthgap for an aarch64 platform (e.g. Raspberry Pi 4) :

| error: failed to run custom build command for `krb5-src v0.3.2+1.19.2`
| 
| Caused by:
|   process didn't exit successfully: `/workspaces/omnios_rust_bin/build/tmp/work/cortexa72-poky-linux/vector/0.44.0/target/release/build/krb5-src-7d691da815ca739d/build-script-build` (exit status: 101)
|   --- stdout
|   checking for aarch64-unknown-linux-gnu-gcc... /workspaces/omnios_rust_bin/build/tmp/work/cortexa72-poky-linux/vector/0.44.0/wrappers/cc-native-wrapper.sh
|   checking whether the C compiler works... no
| 
|   --- stderr
|   configure: error: in `/workspaces/omnios_rust_bin/build/tmp/work/cortexa72-poky-linux/vector/0.44.0/target/aarch64-unknown-linux-gnu/release/build/krb5-src-7712872c0cb50834/out/build':
|   configure: error: C compiler cannot create executables

By the look of it the build system was trying to use the gcc from the host (in my case it's running in Docker but that's irrelevant) and was therefore failing. I have changed the values set in CC and CXX to match what is done in cargo_bin_do_configure :

echo "${CC} \"\$@\"" >>"${WRAPPER_DIR}/cc-wrapper.sh"
echo "${CXX} \"\$@\"" >>"${WRAPPER_DIR}/cxx-wrapper.sh"

And with this the build is successful.

Please let me know if this is not the right approach.

Thanks,
Antoine

@antoinefaure
Copy link
Author

The LD variable may also need to be changed to use linker-wrapper.sh. From my understanding Yocto will set CC to the compiler that we need (if building a native recipe then gcc, if cross compiling then the appropriate compiler).
Any opinion on the matter @eldruin ?

Copy link
Member

@eldruin eldruin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me, thank you!

@eldruin eldruin merged commit 96c802d into rust-embedded:master Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants