Skip to content

Dont know how to Cross compile this to rapsberry pi 0 #9

@Lite5h4dow

Description

@Lite5h4dow

forgive me, I'm very new to cross-compilation and don't know what I'm doing when things like this library are an unexpected dependency. I get the following error when I attempt to cross-compile. (I'm using docker for cross-compilation so I have a clean stable environment)

compile_raspberry0_1  |    Compiling libudev-sys v0.1.4
compile_raspberry0_1  | error: failed to run custom build command for `libudev-sys v0.1.4`
compile_raspberry0_1  | 
compile_raspberry0_1  | Caused by:
compile_raspberry0_1  |   process didn't exit successfully: `/usr/src/target/release/build/libudev-sys-c95e084aca67938b/build-script-build` (exit status: 101)
compile_raspberry0_1  |   --- stdout
compile_raspberry0_1  |   cargo:rerun-if-env-changed=LIBUDEV_NO_PKG_CONFIG
compile_raspberry0_1  |   cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_arm-unknown-linux-gnueabihf
compile_raspberry0_1  |   cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_arm_unknown_linux_gnueabihf
compile_raspberry0_1  |   cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
compile_raspberry0_1  |   cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
compile_raspberry0_1  |   cargo:rerun-if-env-changed=PKG_CONFIG_arm-unknown-linux-gnueabihf
compile_raspberry0_1  |   cargo:rerun-if-env-changed=PKG_CONFIG_arm_unknown_linux_gnueabihf
compile_raspberry0_1  |   cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
compile_raspberry0_1  |   cargo:rerun-if-env-changed=PKG_CONFIG
compile_raspberry0_1  |   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_arm-unknown-linux-gnueabihf
compile_raspberry0_1  |   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_arm_unknown_linux_gnueabihf
compile_raspberry0_1  |   cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
compile_raspberry0_1  |   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
compile_raspberry0_1  | 
compile_raspberry0_1  |   --- stderr
compile_raspberry0_1  |   thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "pkg-config has not been configured to support cross-compilation.\n\n                Install a sysroot for the target platform and configure it via\n                PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\n                cross-compiling wrapper for pkg-config and set it via\n                PKG_CONFIG environment variable."', /root/.cargo/registry/src/github.1485827954.workers.dev-1ecc6299db9ec823/libudev-sys-0.1.4/build.rs:38:41
compile_raspberry0_1  |   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
compile_raspberry0_1  | warning: build failed, waiting for other jobs to finish...
compile_raspberry0_1  | error: build failed
compile_raspberry0_1 exited with code 101

I'm attempting to cross-compile to the rpi0 and I'm using the rpitools supplied by the rpifoundation to do so and don't know how to configure this to compile successfully as this library is a dependency for a dependency.

this is the dockerfile

FROM ubuntu:latest

RUN apt-get update && \
    apt-get install \
    --yes \
    binutils \
    curl \
    zip \
    build-essential \
    libudev-dev

ARG RASPBERRY_PI_TOOLS_COMMIT_ID=5caa7046982f0539cf5380f94da04b31129ed521
RUN curl -sL https://github.com/raspberrypi/tools/archive/$RASPBERRY_PI_TOOLS_COMMIT_ID.tar.gz \
    | tar xzf - -C /usr/local --strip-components=1 tools-${RASPBERRY_PI_TOOLS_COMMIT_ID}/arm-bcm2708

ENV PATH=/usr/local/arm-bcm2708/arm-linux-gnueabihf/bin:$PATH
ENV PATH=/usr/local/arm-bcm2708/arm-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/4.8.3:$PATH

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --verbose
ENV PATH=/root/.cargo/bin:$PATH

RUN rustup target add arm-unknown-linux-gnueabihf
RUN echo '[target.arm-unknown-linux-gnueabihf]\nlinker = "arm-linux-gnueabihf-gcc"' >> /root/.cargo/config

ENV USER=root
WORKDIR /usr/src

and here is the cargo.toml

[package]
name = "test"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
sysfs_gpio = "0.5"
serialport = "4.0.1"
# stick = "0.12.1"
stick = {git="https://github.com/libcala/stick"}
pasts = "0.8"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions