Hi, Is it possible to build a PEX file with all th...
# general
n
Hi, Is it possible to build a PEX file with all third-party dependencies tailored for a specific computer architecture? For example, I'm constructing my pex_binary on an ARM64 system, but I need all the dependencies within it to be compatible with x86_64 architecture. To provide a bit more context: In our Pants repository, we have multiple applications that work seamlessly on ARM64. However, one app is designed to control a hardware device lacking ARM64 drivers. When built on Intel Macs, it runs smoothly on Silicon Macs via Rosetta. Therefore, we're exploring the possibility of building a PEX package for x86_64 on an ARM64 system. As I understand, this would primarily involve downloading the correct dependencies for the x86_64 architecture. Thanks!
n
Was so focused on resolves and environments that completely missed that one 🤦 Thank you!
r
Here is an example where
complete_platforms
is being used to package aws lambda
👍 1
b
yeah, as others have said, the options are: 1. complete platforms 2. an docker environment that is specified to run on the x86-64 platform specifically (https://www.pantsbuild.org/docs/reference-docker_environment#codeplatformcode) I'd recommend 1 if you can (doing a cross-compile while running natively will be faster); although it can be a bit fiddly if you can't get all your platform-specific dependencies as wheels (which blocks cross compiling). If that's the case, you'll either need to prebuild them somehow (e.g. a private registry) or use 2.
n
It worked great, thanks a lot for the help!
it allows packaging platform-specific dependencies (prebuilt ones) in a single platform by just changing the CLI option to the
pants
command
🙏 1