Closed Danvil closed 1 year ago
You need to install libudev inside the container for aarch64 using pre-exec hooks.
this should solve your issue. See also the wiki
# Cross.toml
[target.aarch64-unknown-linux-gnu]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get install --assume-yes ",
"apt-get update && apt-get install -y pkg-config libudev-dev:$CROSS_DEB_ARCH"
]
@Emilgardis I tried the suggested solution, but now cross build seems to hang forever on the command line.
Previously a build would print:
PS I:\myproj> cross build --release -p myapp --target=aarch64-unknown-linux-gnu
workspace: /project/Cargo.toml
Compiling libc v0.2.147
...
With the Cross.toml
file above it now hangs at:
PS I:\myproj> cross build --release -p myapp --target=aarch64-unknown-linux-gnu
without further progress and with casual CPU consumption between 5% - 10%.
Add -v
to the command to see what its doing, i suspect its docker buildx that is stalling
Here is the console output with -v
:
PS I:\myproj> cross build --release -p myapp --target=aarch64-unknown-linux-gnu -v
+ cargo metadata --format-version 1 --filter-platform aarch64-unknown-linux-gnu
+ rustc --print sysroot
+ rustup toolchain list
+ rustup target list --toolchain stable-x86_64-unknown-linux-gnu
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
+ "C:\Program Files\RedHat\Podman\podman.exe"
+ "I:\\myproj" "C:\Program Files\RedHat\Podman\podman.exe" build --label 'org.cross-rs.for-cross-target=aarch64-unknown-linux-gnu' --label 'org.cross-rs.workspace_root=I:\myproj' --tag cross-custom-myproj:aarch64-unknown-linux-gnu-207c1-pre-build --build-arg 'CROSS_CMD=dpkg --add-architecture $CROSS_DEB_ARCH
apt-get update && apt-get install -y pkg-config libudev-dev:$CROSS_DEB_ARCH' --build-arg 'CROSS_DEB_ARCH=arm64' --file 'I:\myproj\target\aarch64-unknown-linux-gnu\Dockerfile.aarch64-unknown-linux-gnu-custom' 'I:\myproj'
It seems to hang at the install
command.
I tried to play around with it a little. Basically any command, even ls -l
, will make it hang. If the list of commands is empty it proceeds.
As an additional comment the solution does work under Linux. So this seems to be a Windows specific problem.
As this seems to be a different problem now I filed a new issue for it: https://github.com/cross-rs/cross/issues/1303
Thank you for the help here!
Checklist
Describe your issue
Cross-compiling a binary which indirectly depends on
libudev-sys v0.1.4
gives an error:What target(s) are you cross-compiling for?
aarch64-unknown-linux-gnu
Which operating system is the host (e.g computer cross is on) running?
What architecture is the host?
What container engine is cross using?
cross version
0.2.5
Example
No response
Additional information / notes
No response