-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
NDK r25 does not handle quoted parameters to clang on Windows #92
Comments
Which version of cargo-ndk? If it's not v3, try with v3. |
|
Still the same error, unfortunately. |
So I tried manually invoking whatever the compiler script NDK had, and apparently removing the quotes from the arguments ( |
I will need you to provide a repository with a reproduction case, as with my simple repositories I cannot reproduce this. |
I'll close this, feel free to re-open if more information comes about. |
same error xD simple to reproduce in windows .. cargo new sad --lib |
Hm, okay, I'll look into it. Thanks! |
how did u remove it.. |
and i put this
and the result is = note: "D:\\AndroidSDK\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\armv7a-linux-androideabi21-clang.cmd" "-Wl,--version-script=C:\\Users\\redacted\\AppData\\Local\\Temp\\rustcfOdF9F\\list" "-march=armv7-a" "C:\\Users\\redacted\\AppData\\Local\\Temp\\rustcfOdF9F\\symbols.o" "D:\\rustpj\\learn\\sad\\target\\armv7-linux-androideabi\\release\\deps\\sad.sad.c609ceec-cgu.0.rcgu.o" "D:\\rustpj\\learn\\sad\\target\\armv7-linux-androideabi\\release\\deps\\sad.lvl3fyn229r5lzw.rcgu.o" "-Wl,--as-needed" "-L" "D:\\rustpj\\learn\\sad\\target\\armv7-linux-androideabi\\release\\deps" "-L" "D:\\rustpj\\learn\\sad\\target\\release\\deps" "-L" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib" "-Wl,-Bstatic" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libstd-9d5134f0ea4594d8.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libpanic_unwind-01b1c5f80e0e7f9b.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libobject-ae30fd2e510e40d6.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libmemchr-9ad4b962e90cf093.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libaddr2line-6c5f47bc28436fe1.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libgimli-ff6b9ee0b9139d30.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\librustc_demangle-4ddc39bc389bb6df.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libstd_detect-00cad421ee04a0db.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libhashbrown-1470100c3925e285.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libminiz_oxide-61a0eae65236d4ab.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libadler-946535f5774d69b3.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\librustc_std_workspace_alloc-151b8b3dd2d9d9bf.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libunwind-7138631d4908511a.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libcfg_if-a40e9b397e82f2d1.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\liblibc-fe55f15858518399.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\liballoc-ab9bdff74387450f.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\librustc_std_workspace_core-1e49a5531690b2be.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libcore-7a614fc5f2c1e83e.rlib" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib\\libcompiler_builtins-a7b4a7b4024efe3d.rlib" "-Wl,-Bdynamic" "-ldl" "-llog" "-lunwind" "-ldl" "-lm" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "C:\\Users\\redacted\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\armv7-linux-androideabi\\lib" "-o" "D:\\rustpj\\learn\\sad\\target\\armv7-linux-androideabi\\release\\deps\\libsad.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs"
= note: --version-script=C:\Users\redacted\AppData\Local\Temp\rustcfOdF9F\list"" was unexpected at this time. |
|
i searched all the internet and it's look like that this is just our problem |
This is a bug in the NDK. I can reproduce it by passing just: cargo build --release --target armv7-linux-androideabi --config target.armv7-linux-androideabi.linker="'D:\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\armv7a-linux-androideabi21-clang.cmd'" |
This comment was marked as off-topic.
This comment was marked as off-topic.
It's a known issue. Some kind of depressing workaround is likely needed. I won't have time to do that for a while, so consider using an older NDK or building on either Linux and Windows for now. |
This comment was marked as off-topic.
This comment was marked as off-topic.
I'm going to lock this issue since it's likely others are going to come here. I will work on a workaround some time in the next few weeks, as it will require essentially replacing the .cmd files that come with NDK r25, as specific configuration of each of the targets is handled in those .cmd files, and cannot handle quoted paths. Since it is the LTS version, this is going to linger around for a long-ass time. So once again, cargo-ndk will become full of hacks because Google has done a silly thing and likes to create work for open source developers. 😶🌫️ |
Follow #99 for the fix. |
This is an alternative workaround for bbqsrc#92 that's similar to the solution used in ndk-build except that the `-Clink-arg rustflag` is injected via a RUSTC_WRAPPER instead of trying to modify CARGO_ENCODED_RUSTFLAGS. It turned out to be practically impossible to be able to reliably set CARGO_ENCODED_RUSTFLAGS without risking trampling over rustflags that might be configured via Cargo (for example `target.<cfg>.rustflags` are especially difficult to read outside of cargo itself) This approach avoids hitting the command line length limitations of the current workaround and avoids needing temporary hard links or copying the cargo-ndk binary to the target/ directory. Even though we've only seen quoting issues with the Windows `.cmd` wrappers this change to avoid using the wrapper scripts is being applied consistently for all platforms. E.g. considering the upstream recommendation to avoid the wrapper scripts if possible: https://android-review.googlesource.com/c/platform/ndk/+/2134712 Fixes: bbqsrc#92 Fixes: bbqsrc#104 Addresses: android/ndk#1856
This is an alternative workaround for bbqsrc#92 that's similar to the solution used in ndk-build except that the `-Clink-arg rustflag` is injected via a RUSTC_WRAPPER instead of trying to modify CARGO_ENCODED_RUSTFLAGS. It turned out to be practically impossible to be able to reliably set CARGO_ENCODED_RUSTFLAGS without risking trampling over rustflags that might be configured via Cargo (for example `target.<cfg>.rustflags` are especially difficult to read outside of cargo itself) This approach avoids hitting the command line length limitations of the current workaround and avoids needing temporary hard links or copying the cargo-ndk binary to the target/ directory. Even though we've only seen quoting issues with the Windows `.cmd` wrappers this change to avoid using the wrapper scripts is being applied consistently for all platforms. E.g. considering the upstream recommendation to avoid the wrapper scripts if possible: https://android-review.googlesource.com/c/platform/ndk/+/2134712 Fixes: bbqsrc#92 Fixes: bbqsrc#104 Addresses: android/ndk#1856
This is an alternative workaround for bbqsrc#92 that's similar to the solution used in ndk-build except that the `--target=<triple><api-level>` argument for Clang is injected by using cargo-ndk as a linker wrapper instead of trying to modify CARGO_ENCODED_RUSTFLAGS. It turned out to be practically impossible to be able to reliably set CARGO_ENCODED_RUSTFLAGS without risking trampling over rustflags that might be configured via Cargo (for example `target.<cfg>.rustflags` are especially difficult to read outside of cargo itself) This approach avoids hitting the command line length limitations of the current workaround and avoids needing temporary hard links or copying the cargo-ndk binary to the target/ directory. Even though we've only seen quoting issues with the Windows `.cmd` wrappers this change to avoid using the wrapper scripts is being applied consistently for all platforms. E.g. considering the upstream recommendation to avoid the wrapper scripts if possible: https://android-review.googlesource.com/c/platform/ndk/+/2134712 Fixes: bbqsrc#92 Fixes: bbqsrc#104 Addresses: android/ndk#1856
This is an alternative workaround for #92 that's similar to the solution used in ndk-build except that the `--target=<triple><api-level>` argument for Clang is injected by using cargo-ndk as a linker wrapper instead of trying to modify CARGO_ENCODED_RUSTFLAGS. It turned out to be practically impossible to be able to reliably set CARGO_ENCODED_RUSTFLAGS without risking trampling over rustflags that might be configured via Cargo (for example `target.<cfg>.rustflags` are especially difficult to read outside of cargo itself) This approach avoids hitting the command line length limitations of the current workaround and avoids needing temporary hard links or copying the cargo-ndk binary to the target/ directory. Even though we've only seen quoting issues with the Windows `.cmd` wrappers this change to avoid using the wrapper scripts is being applied consistently for all platforms. E.g. considering the upstream recommendation to avoid the wrapper scripts if possible: https://android-review.googlesource.com/c/platform/ndk/+/2134712 Fixes: #92 Fixes: #104 Addresses: android/ndk#1856
Running
cargo ndk -t x86_64 -p 33 build
gives me this error:I'm on a x86_64 Windows 10 machine, and I have installed both Android SDK and Android NDK.
The text was updated successfully, but these errors were encountered: