Skip to content

Python bindings wont build for linux aarch64 #18

@nleroy917

Description

@nleroy917

With the latest release... the reqwest crate got added such that we can download pre-trained model universes directly inside from within Rust:

use genimtools::tokenizers::TreeTokenzer;

let tokenizer = TreeTokenizer::from_pretrained("databio/r2v-luecken2021-hg38-v2");

reqwest requires openssl to be installed on the actual machine that is building the rust package/crate. This caused the GitHub action builds to start failing. I initially thought that installing openssl headers in the GitHub runner would solve the issue, but that was not sufficient. It turns out that the GitHub runner (a docker container) is downloading another docker container to actually build the wheels. This is all orchestrated through the maturin github action. Thus, we need to install openssl headers inside the secondary docker container.

Luckily for us, the maturin action lets us run scripts inside that very container prior to running the build through the before-script-linux command. So I added a yum -y install openssl-devel command.

This was not sufficient... We are building for several architectures (x86 and aarch64). As it turns out, the subsequent inner docker containers pulled for these use separate package managers. So, while it might work for one, it will fail for the other because, command yum not found.

I enhanced my script a bit to check for a package manager before trying to use it:

# Check for yum and use it if available, otherwise use apt-get
if command -v yum &> /dev/null; then
  echo "Detected yum package manager"
  yum -y install openssl-devel
elif command -v apt-get &> /dev/null; then
  echo "Detected apt-get package manager"
  apt-get update
  echo "Installing libssl-dev pkg-config openssl musl-dev"
  apt-get install -y libssl-dev pkg-config openssl musl-dev
else
  echo "No supported package manager found (yum or apt-get)"
  exit 1
fi

This got the openssl hedaers to install correctly inside the correct containers... great. However there is one final issue: The aarch64 container is actually just x86 trying to cross-compile to aarch64. So, installing openssl just installs the x86 version and then during cross-compilation the header for aarch64 is still missing.

I am stuck here... taking a break since I've wasted so many hours on this. Luckily I am not too alone as someone else has had this exact issue before on stack overflow, but I have less control than them over the compilation since I am restricted to single bash commands.

Will resume later...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions