crossenv icon indicating copy to clipboard operation
crossenv copied to clipboard

Making Android toolchain portable

Open FeodorFitsner opened this issue 1 year ago • 2 comments

Thank you for the great tool!

In our case host Python distributive is built on VM with Android SDK installed at /usr/lib/android-sdk/ndk/26.2.11394342/toolchains/llvm/prebuilt/linux-x86_64 and if a user has toolchain installed in a different location this host python, obviously, does not work with crossenv on their machine.

I see original toolchain path presents in multiple files:

  • bin/python3-config
  • bin/python3.12-config
  • lib/python3.12/_sysconfigdata__linux_.py
  • lib/python3.12/config-3.12/Makefile

What would be the solution to make crossenv and host-python to work with Android toolchain in location, different from the one Python was built with?

Is there an already some option in crossenv? Would simple find-replace over those files work?

FeodorFitsner avatar Apr 25 '24 17:04 FeodorFitsner

Sorry, I somehow missed this issue.

Crossenv has a --relative-toolchain option that should do what you want. You will just need to make sure that the SDK binaries are in $PATH.

benfogle avatar Aug 10 '24 17:08 benfogle

Will give it a try!

FeodorFitsner avatar Aug 10 '24 17:08 FeodorFitsner

In my experience, if you set the relevant environment variables (CC, etc.), then they will always override the paths in the sysconfigdata.

mhsmith avatar Apr 25 '25 15:04 mhsmith

Yeah, this is what I get mostly!

@mhsmith while you are here :) I've been following the addition of iOS and Android into cibuildwheel and was wondering if it's using this project (crossenv) under the hood to cross-build to iOS/Android?

FeodorFitsner avatar Apr 25 '25 16:04 FeodorFitsner

We're not using it directly, but we're using many of the same techniques.

mhsmith avatar Apr 25 '25 17:04 mhsmith