tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.81k stars 320 forks source link

Support for `__aarch64__` flag #333

Open lmtr0 opened 2 years ago

lmtr0 commented 2 years ago

As pointed out in https://github.com/briansmith/ring/issues/1442 it appears that the o64h-clang is not setting any arm flags:

tpoechtrager commented 2 years ago

OS? Clang compiler version?

lmtr0 commented 2 years ago

Well clang was 13 and the os i tested was arch Linux container but it also doesn't work in Ubuntu, Manjaro and fedora with MacOS SDK 11.3

lmtr0 commented 2 years ago

I was compiling a project in rust that had dependency in ring which is the crate broke the build. Btw starting the compilation with system clang fails but then switching to osxcross then works

JimChenWYU commented 1 year ago

how about it? I met the same error, can not compile briansmith/ring

lmtr0 commented 1 year ago

use -Daarch64

lmtr0 commented 1 year ago

in .cargo/config.toml:

[target.aarch64-apple-darwin]
rustflags = ["-C", "link-args=-D__aarch64__"]
linker = "o64h-clang"
ar = "aarch64-apple-darwin20.4-ar"
JimChenWYU commented 1 year ago

@lmtr0 got same error I had run cargo clean

.cargo/config.toml

[build]
target = "aarch64-apple-darwin"

[target.aarch64-apple-darwin]
rustflags = ["-C", "link-args=-D__aarch64__"]
linker = "/osxcross/bin/aarch64-apple-darwin20.4-clang"
ar = "/osxcross/bin/aarch64-apple-darwin20.4-ar"

o64h-clang I found it is same as /osxcross/bin/aarch64-apple-darwin20.4-clang

lmtr0 commented 1 year ago

can you switch to sodiumoxide? I did that since I couldn't solve it

JimChenWYU commented 1 year ago

I can not, it's not my application depend on ring, it's other package

lmtr0 commented 1 year ago

Sorry then, this sounds to be a problem with the compiler.... maybe @tpoechtrager can help more, I just switched to libsodium cause I couldn't solve it then and I can't solve it now

briansmith commented 9 months ago

The latest version of ring (0.17.0) doesn't use __aarch64__ any more. It uses __ARM_ARCH. If clang isn't defining these automatically __ARM_ARCH for an aarch64-* target then there is indeed something wrong.