Skip to content
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

Failed to link lib ring when trying to build binary files in aarch64-unknown-* #2141

Open
xlouis027 opened this issue Sep 4, 2024 · 4 comments

Comments

@xlouis027
Copy link

xlouis027 commented Sep 4, 2024

I'm trying to build bins file of kuksa-databroker:

git clone https://github.com/eclipse-kuksa/kuksa-databroker.git
cargo build --bins --release --target aarch64-unknown-linux-gnu // or aarch64-unknown-nto-qnx710

I configured and build lib ring successfully but I got these errors when creating binary files, the last steps:

/home/nd/qnx710/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.1.0-ld: /tmp/rustcvdXfHX/libring-af233445ca34a4b5.rlib(0b57cc7e47bb3e90-curve25519.o): Relocations in generic ELF (EM: 62)
 /home/nd/qnx710/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.1.0-ld: /tmp/rustcvdXfHX/libring-af233445ca34a4b5.rlib: error adding symbols: file in wrong format

I did successfully in x86_64 arch but I failed when I configured in aarch64-unknown-* arch.

@xlouis027 xlouis027 changed the title Failed to link lib ring when trying to build binary files in aarch64-unknown-nto-qnx710 Failed to link lib ring when trying to build binary files in aarch64-unknown-* Sep 5, 2024
@andrewdavidmackenzie
Copy link

andrewdavidmackenzie commented Sep 17, 2024

I have a similar error. When I searched the web for it, some entries suggest it is due to having some object files compiled for the wrong architecture (x86 vs aarch64), although I am not 100% convinced.

Example: ninja-build/ninja#2112 (comment)

@andrewdavidmackenzie
Copy link

I also have issues reported against ring, but for armv7, aarch64 seems to work fine for me 🤷

@bjorn3
Copy link

bjorn3 commented Sep 20, 2024

If you are cross-compiling you need to tell it where to find a C compiler that can cross-compile. See https://docs.rs/cc/latest/cc/#external-configuration-via-environment-variables for the env vars you can use to configure this.

@andrewdavidmackenzie
Copy link

I have tried setting CC="aarch64-elf-gcc" when trying to compile for target=aarch64-unknown-linux-gnu, but now realize that the problem (I think) is cross-compiling to linux from mac, not so much the arch. I guess I would need to setup a sysroot and all that stuff to get it to work, so I might reconsider and just use cross for linux builds.

The following warnings were emitted during compilation:

warning: [email protected]: In file included from include/ring-core/base.h:64,
warning: [email protected]:                  from include/ring-core/mem.h:60,
warning: [email protected]:                  from crypto/curve25519/curve25519.c:22:
warning: [email protected]: /opt/homebrew/Cellar/aarch64-elf-gcc/14.2.0/lib/gcc/aarch64-elf/14.2.0/include/stdint.h:9:16: fatal error: stdint.h: No such file or directory
warning: [email protected]:     9 | # include_next <stdint.h>
warning: [email protected]:       |                ^~~~~~~~~~
warning: [email protected]: compilation terminated.

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

No branches or pull requests

3 participants