Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Spaces in paths don't quite work #128

Open
Jasper-Bekkers opened this issue Aug 17, 2023 · 3 comments
Open

Spaces in paths don't quite work #128

Jasper-Bekkers opened this issue Aug 17, 2023 · 3 comments

Comments

@Jasper-Bekkers
Copy link

Currently xbuild doesn't work on our windows machines that have a username that contains a space. Unfortunately in some cases this is preventing us from running with xbuild and folks have to fall back on a (for us, no longer supported) workflow of using cargo-apk.

@Jasper-Bekkers
Copy link
Author

Maybe this issue belongs on our fork, but I'm creating it here for visibility: mostly because this used to work just fine in cargo-apk.

@MarijnS95
Copy link
Member

MarijnS95 commented Aug 22, 2023

I previously dissected why this is happening in #124. The tl;dr: is that xbuild invokes the host clang compiler and uses C(XX)FLAGS to pass the unpacked NDK - somewhere within the users' home directory - via a --sysroot parameter. C(XX)FLAGS cannot contain spaces (nor does it look like this is a thing we can unanimously fix in cc-rs).

Since cargo-apk uses an unmodified NDK including the compiler, and the compiler resides in ./bin/clang next to a ./sysroot folder, it automatically figures out that this is the sysroot (on Android only!):

https://github.com/llvm/llvm-project/blob/d82f0b74dec133cb90767edb032f987930d53772/clang/lib/Driver/ToolChains/Linux.cpp#L373-L380

So there are no problems with having to pass this path explicitly when using an unmodified NDK.


The solutions are either:

  1. Can we unpack the temporaries in a path that is known not to contain spaces?
  2. Should we go back to packaging the whole NDK or at least leave the toolchain in there, also fixing Embed / pre-download adb and LLVM (or don't strip the NDK as harshly) #124 / winget missing packages #129?
  3. Somehow support spaces in C(XX)FLAGS.

@MarijnS95
Copy link
Member

MarijnS95 commented Aug 14, 2024

Upstream cc-rs rejected my proposed change at rust-lang/cc-rs#847 but now merged in a very hacky variant of it: rust-lang/cc-rs#1181

Upgrade to cc-rs 1.1.11, hack the paths a bit more based on 7742876, set CC_SHELL_ESCAPED_FLAGS=1 and insert quotes around paths that are passed to C(XX)FLAGS and this should start working?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants