-
Notifications
You must be signed in to change notification settings - Fork 528
Open
Labels
Description
cc
's auto-detection for NDK supplies --target arm-linux-android
instead of something like --target armv7a-linux-androideabi35
, causing the wrong (and non-existent) sysroot to be used and leading to this error:
ld.lld: error: cannot open crtbegin_dynamic.o: No such file or directory
ld.lld: error: cannot open crtend_android.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
NobodyXu commentedon Mar 20, 2025
We use the information extracted from
rustc
, so I suppose maybe rustc has the wrong information?GglLfr commentedon Mar 20, 2025
Actually, it might've been caused by these lines.
armv7a-linux-androideabi16-clang
doesn't exist at all in my installation (that I obtained usingsdkmanager --install "ndk;29.0.13113456"
).armv7a-linux-androideabi21-clang
does exist, however.GglLfr commentedon Mar 20, 2025
Manually setting
CC=aarch64-linux-android35-clang.cmd
andCXX=aarch64-linux-android35-clang++.cmd
makes the project compile. I'll create a minimum reproducible example soon.GglLfr commentedon Mar 21, 2025
I've pushed this example, which is just a stripped version of
android-activity
; the error was different, but caused by wrong sysroots nonetheless:I tried running this code separately:
Which does throw that undefined
pthread_cond_clockwait
error. I tried running it again, except I changed--target=aarch64-linux-android
to--target=aarch64-linux-android35
, and it compiles.This creates another issue though: How exactly do we pass the intended Android API level to
cc
? Right now it seems to be hardcoded to API level 21 (and 16 forarmv7-linux-androideabi
).GglLfr commentedon Mar 21, 2025
Manually setting
.flag("--target=aarch64-linux-android35")
does make compiling withcargo build --target aarch64-linux-android
work, but it seems quite hacky 😓