-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kn - static binary build issue with openssl #3
Comments
Even on raspberrypi could not build Downloaded cargo_toml v0.13.0
Compiling libc v0.2.137
Compiling cfg-if v1.0.0
Compiling autocfg v1.1.0
Compiling proc-macro2 v1.0.47
error[E0463]: can't find crate for `core`
|
= note: the `x86_64-unknown-linux-musl` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-unknown-linux-musl`
error[E0463]: can't find crate for `compiler_builtins`
For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-deb v1.40.5`, intermediate artifacts can be found at `/tmp/cargo-installEMaQgR`
The command '/bin/sh -c env CARGO_HOME=/opt/rust/cargo cargo install -f cargo-deb && rm -rf /opt/rust/cargo/registry/' returned a non-zero code: 101 Here is Dockerfile: # Use Ubuntu 18.04 LTS as our base image.
FROM --platform=${TARGETPLATFORM:-linux/arm64} ubuntu:18.04
# The Rust toolchain to use when building our image. Set by `hooks/build`.
ARG TOOLCHAIN=stable
# The OpenSSL version to use. Here is the place to check for new releases:
#
# - https://www.openssl.org/source/
#
# ALSO UPDATE hooks/build!
ARG OPENSSL_VERSION=1.1.1m
# Versions for other dependencies. Here are the places to check for new
# releases:
#
# - https://github.com/rust-lang/mdBook/releases
# - https://github.com/dylanowen/mdbook-graphviz/releases
# - https://github.com/EmbarkStudios/cargo-about/releases
# - https://github.com/rustsec/rustsec/releases
# - https://github.com/EmbarkStudios/cargo-deny/releases
# - http://zlib.net/
# - https://ftp.postgresql.org/pub/source/
#
# We're stuck on PostgreSQL 11 until we figure out
# https://github.com/emk/rust-musl-builder/issues.
ARG MDBOOK_VERSION=0.4.14
ARG MDBOOK_GRAPHVIZ_VERSION=0.1.3
ARG CARGO_ABOUT_VERSION=0.4.4
ARG CARGO_AUDIT_VERSION=0.16.0
ARG CARGO_DENY_VERSION=0.11.0
ARG ZLIB_VERSION=1.2.13
ARG POSTGRESQL_VERSION=11.14
# Make sure we have basic dev tools for building C libraries. Our goal here is
# to support the musl-libc builds and Cargo builds needed for a large selection
# of the most popular crates.
#
# We also set up a `rust` user by default. This user has sudo privileges if you
# need to install any more software.
RUN apt-get update && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get install -yq \
build-essential \
cmake \
curl \
file \
git \
graphviz \
musl-dev \
musl-tools \
libpq-dev \
libsqlite-dev \
libssl-dev \
linux-libc-dev \
pkgconf \
sudo \
unzip \
xutils-dev \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
useradd rust --user-group --create-home --shell /bin/bash --groups sudo
# - `mdbook` is the standard Rust tool for making searchable HTML manuals.
# - `mdbook-graphviz` allows using inline GraphViz drawing commands to add illustrations.
# - `cargo-about` generates a giant license file for all dependencies.
# - `cargo-audit` checks for security vulnerabilities. We include it for backwards compat.
# - `cargo-deny` does everything `cargo-audit` does, plus check licenses & many other things.
# RUN curl -fLO https://github.com/rust-lang-nursery/mdBook/releases/download/v$MDBOOK_VERSION/mdbook-v$MDBOOK_VERSION-aarch64-unknown-linux-gnu.tar.gz && \
# tar xf mdbook-v$MDBOOK_VERSION-aarch64-unknown-linux-gnu.tar.gz && \
# mv mdbook /usr/local/bin/ && \
# rm -f mdbook-v$MDBOOK_VERSION-aarch64-unknown-linux-gnu.tar.gz && \
# curl -fLO https://github.com/dylanowen/mdbook-graphviz/releases/download/v$MDBOOK_GRAPHVIZ_VERSION/mdbook-graphviz_v${MDBOOK_GRAPHVIZ_VERSION}_aarch64-unknown-linux-musl.zip && \
# unzip mdbook-graphviz_v${MDBOOK_GRAPHVIZ_VERSION}_aarch64-unknown-linux-musl.zip && \
# mv mdbook-graphviz /usr/local/bin/ && \
# rm -f mdbook-graphviz_v${MDBOOK_GRAPHVIZ_VERSION}_aarch64-unknown-linux-musl.zip && \
# curl -fLO https://github.com/EmbarkStudios/cargo-about/releases/download/$CARGO_ABOUT_VERSION/cargo-about-$CARGO_ABOUT_VERSION-aarch64-unknown-linux-musl.tar.gz && \
# tar xf cargo-about-$CARGO_ABOUT_VERSION-aarch64-unknown-linux-musl.tar.gz && \
# mv cargo-about-$CARGO_ABOUT_VERSION-aarch64-unknown-linux-musl/cargo-about /usr/local/bin/ && \
# rm -rf cargo-about-$CARGO_ABOUT_VERSION-aarch64-unknown-linux-musl.tar.gz cargo-about-$CARGO_ABOUT_VERSION-aarch64-unknown-linux-musl && \
# curl -fLO https://github.com/rustsec/rustsec/releases/download/cargo-audit%2Fv${CARGO_AUDIT_VERSION}/cargo-audit-aarch64-unknown-linux-gnu-v${CARGO_AUDIT_VERSION}.tgz && \
# tar xf cargo-audit-aarch64-unknown-linux-gnu-v${CARGO_AUDIT_VERSION}.tgz && \
# cp cargo-audit-aarch64-unknown-linux-gnu-v${CARGO_AUDIT_VERSION}/cargo-audit /usr/local/bin/ && \
# rm -rf cargo-audit-aarch64-unknown-linux-gnu-v${CARGO_AUDIT_VERSION}.tgz cargo-audit-aarch64-unknown-linux-gnu-v${CARGO_AUDIT_VERSION} && \
# curl -fLO https://github.com/EmbarkStudios/cargo-deny/releases/download/$CARGO_DENY_VERSION/cargo-deny-$CARGO_DENY_VERSION-aarch64-unknown-linux-musl.tar.gz && \
# tar xf cargo-deny-$CARGO_DENY_VERSION-aarch64-unknown-linux-musl.tar.gz && \
# mv cargo-deny-$CARGO_DENY_VERSION-aarch64-unknown-linux-musl/cargo-deny /usr/local/bin/ && \
# rm -rf cargo-deny-$CARGO_DENY_VERSION-aarch64-unknown-linux-musl cargo-deny-$CARGO_DENY_VERSION-aarch64-unknown-linux-musl.tar.gz
# Static linking for C++ code
RUN ln -s "/usr/bin/g++" "/usr/bin/musl-g++"
# Build a static library version of OpenSSL using musl-libc. This is needed by
# the popular Rust `hyper` crate.
#
# We point /usr/local/musl/include/linux at some Linux kernel headers (not
# necessarily the right ones) in an effort to compile OpenSSL 1.1's "engine"
# component. It's possible that this will cause bizarre and terrible things to
# happen. There may be "sanitized" header
RUN echo "Building OpenSSL" && \
ls /usr/include/linux && \
mkdir -p /usr/local/musl/include && \
ln -s /usr/include/linux /usr/local/musl/include/linux && \
ln -s /usr/include/aarch64-linux-gnu/asm /usr/local/musl/include/asm && \
ln -s /usr/include/asm-generic /usr/local/musl/include/asm-generic && \
cd /tmp && \
short_version="$(echo "$OPENSSL_VERSION" | sed s'/[a-z]$//' )" && \
curl -fLO "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" || \
curl -fLO "https://www.openssl.org/source/old/$short_version/openssl-$OPENSSL_VERSION.tar.gz" && \
tar xvzf "openssl-$OPENSSL_VERSION.tar.gz" && cd "openssl-$OPENSSL_VERSION" && \
env CC=musl-gcc ./Configure no-shared no-zlib -fPIC --prefix=/usr/local/musl -DOPENSSL_NO_SECURE_MEMORY linux-aarch64 && \
env C_INCLUDE_PATH=/usr/local/musl/include/ make depend && \
env C_INCLUDE_PATH=/usr/local/musl/include/ make && \
make install && \
rm /usr/local/musl/include/linux /usr/local/musl/include/asm /usr/local/musl/include/asm-generic && \
rm -r /tmp/*
RUN echo "Building zlib" && \
cd /tmp && \
curl -fLO "http://zlib.net/zlib-$ZLIB_VERSION.tar.gz" && \
tar xzf "zlib-$ZLIB_VERSION.tar.gz" && cd "zlib-$ZLIB_VERSION" && \
CC=musl-gcc ./configure --static --prefix=/usr/local/musl && \
make && make install && \
rm -r /tmp/*
RUN echo "Building libpq" && \
cd /tmp && \
curl -fLO "https://ftp.postgresql.org/pub/source/v$POSTGRESQL_VERSION/postgresql-$POSTGRESQL_VERSION.tar.gz" && \
tar xzf "postgresql-$POSTGRESQL_VERSION.tar.gz" && cd "postgresql-$POSTGRESQL_VERSION" && \
CC=musl-gcc CPPFLAGS=-I/usr/local/musl/include LDFLAGS=-L/usr/local/musl/lib ./configure --with-openssl --without-readline --prefix=/usr/local/musl && \
cd src/interfaces/libpq && make all-static-lib && make install-lib-static && \
cd ../../bin/pg_config && make && make install && \
rm -r /tmp/*
# (Please feel free to submit pull requests for musl-libc builds of other C
# libraries needed by the most popular and common Rust crates, to avoid
# everybody needing to build them manually.)
# Install a `git credentials` helper for using GH_USER and GH_TOKEN to access
# private repositories if desired. We make sure this is configured for root,
# here, and for the `rust` user below.
ADD git-credential-ghtoken /usr/local/bin/ghtoken
RUN git config --global credential.https://github.saobby.my.eu.org.helper ghtoken
# Set up our path with all our binary directories, including those for the
# musl-gcc toolchain and for our Rust toolchain.
#
# We use the instructions at https://github.com/rust-lang/rustup/issues/2383
# to install the rustup toolchain as root.
ENV RUSTUP_HOME=/opt/rust/rustup \
PATH=/home/rust/.cargo/bin:/opt/rust/cargo/bin:/usr/local/musl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Install our Rust toolchain and the `musl` target. We patch the
# command-line we pass to the installer so that it won't attempt to
# interact with the user or fool around with TTYs. We also set the default
# `--target` to musl so that our users don't need to keep overriding it
# manually.
RUN curl https://sh.rustup.rs -sSf | \
env CARGO_HOME=/opt/rust/cargo \
sh -s -- -y --default-toolchain $TOOLCHAIN --profile minimal --no-modify-path && \
env CARGO_HOME=/opt/rust/cargo \
rustup component add rustfmt && \
env CARGO_HOME=/opt/rust/cargo \
rustup component add clippy && \
env CARGO_HOME=/opt/rust/cargo \
rustup target add aarch64-unknown-linux-musl
ADD cargo-config.toml /opt/rust/cargo/config
# Set up our environment variables so that we cross-compile using musl-libc by
# default.
ENV aarch64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR=/usr/local/musl/ \
aarch64_UNKNOWN_LINUX_MUSL_OPENSSL_STATIC=1 \
PQ_LIB_STATIC_aarch64_UNKNOWN_LINUX_MUSL=1 \
PG_CONFIG_aarch64_UNKNOWN_LINUX_GNU=/usr/bin/pg_config \
PKG_CONFIG_ALLOW_CROSS=true \
PKG_CONFIG_ALL_STATIC=true \
LIBZ_SYS_STATIC=1 \
TARGET=musl
# Install some useful Rust tools from source (as few as we can, because these
# slow down image builds). This will use the static linking toolchain, but that
# should be OK.
#
# - `cargo-deb` builds Debian packages.
RUN env CARGO_HOME=/opt/rust/cargo cargo install -f cargo-deb && \
rm -rf /opt/rust/cargo/registry/
# Allow sudo without a password.
ADD sudoers /etc/sudoers.d/nopasswd
# Run all further code as user `rust`, create our working directories, install
# our config file, and set up our credential helper.
#
# You should be able to switch back to `USER root` from another `Dockerfile`
# using this image if you need to do so.
USER rust
RUN mkdir -p /home/rust/libs /home/rust/src /home/rust/.cargo && \
ln -s /opt/rust/cargo/config /home/rust/.cargo/config && \
git config --global credential.https://github.saobby.my.eu.org.helper ghtoken
# Expect our source code to live in /home/rust/src. We'll run the build as
# user `rust`, which will be uid 1000, gid 1000 outside the container.
WORKDIR /home/rust/src
|
after editing cargo-config.toml [build]
# Target musl-libc by default when running Cargo.
target = "aarch64-unknown-linux-musl"
[target.armv7-unknown-linux-musleabihf]
linker = "arm-linux-gnueabihf-gcc" ----more logs
error: failed to run custom build command for `lzma-sys v0.1.19`
Caused by:
process didn't exit successfully: `/tmp/cargo-installBYCsH6/release/build/lzma-sys-86327d577db224fc/build-script-build` (exit status: 1)
--- stdout
----more logs
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:root=/tmp/cargo-installBYCsH6/aarch64-unknown-linux-musl/release/build/lzma-sys-937da754e499bff9/out
cargo:include=/opt/rust/cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.19/xz-5.2/src/liblzma/api
TARGET = Some("aarch64-unknown-linux-musl")
OPT_LEVEL = Some("3")
HOST = Some("aarch64-unknown-linux-gnu")
CC_aarch64-unknown-linux-musl = None
CC_aarch64_unknown_linux_musl = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_aarch64-unknown-linux-musl = None
CFLAGS_aarch64_unknown_linux_musl = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("neon,pmuv3")
running: "aarch64-linux-musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "xz-5.2/src/liblzma/api" "-I" "xz-5.2/src/liblzma/lzma" "-I" "xz-5.2/src/liblzma/lz" "-I" "xz-5.2/src/liblzma/check" "-I" "xz-5.2/src/liblzma/simple" "-I" "xz-5.2/src/liblzma/delta" "-I" "xz-5.2/src/liblzma/common" "-I" "xz-5.2/src/liblzma/rangecoder" "-I" "xz-5.2/src/common" "-I" "/opt/rust/cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.19" "-Wall" "-Wextra" "-std=c99" "-pthread" "-DHAVE_CONFIG_H=1" "-o" "/tmp/cargo-installBYCsH6/aarch64-unknown-linux-musl/release/build/lzma-sys-937da754e499bff9/out/xz-5.2/src/liblzma/common/stream_decoder.o" "-c" "xz-5.2/src/liblzma/common/stream_decoder.c"
--- stderr
error occurred: Failed to find tool. Is `aarch64-linux-musl-gcc` installed?
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-deb v1.40.5`, intermediate artifacts can be found at `/tmp/cargo-installBYCsH6`
The command '/bin/sh -c env CARGO_HOME=/opt/rust/cargo cargo install -f cargo-deb && rm -rf /opt/rust/cargo/registry/' returned a non-zero code: 101
[build]
# Target musl-libc by default when running Cargo.
target = "aarch64-unknown-linux-musl"
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"
rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc" ]
[target.armv7-unknown-linux-musleabihf]
linker = "arm-linux-gnueabihf-gcc"
may be related to rust-lang/rust#46651 (comment) ? |
Able to build arm64 image after updating the [target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"
rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc" ]
[target.armv7-unknown-linux-musleabihf]
linker = "arm-linux-gnueabihf-gcc" Here is docker image - koolwithk/rust-musl:1.64.0-arm64 build instruction and arm64.Dockerfile - https://github.com/koolwithk/rust-musl-builder#rust-musl-builder-arm64-support reference - rust-lang/rust#46651 (comment) |
Still having the openssl issue even with custom docker image for rust-musl-builder with openssl koolwithk/rust-musl:1.64.0-arm64 #15 134.1 error: failed to run custom build command for `openssl-sys v0.9.77`
#15 134.1
#15 134.1 Caused by:
#15 134.1 process didn't exit successfully: `/home/rust/src/target/release/build/openssl-sys-f63ab03a87e35638/build-script-main` (exit status: 101)
#15 134.1 --- stdout
#15 134.1 cargo:rustc-cfg=const_fn
#15 134.1 cargo:rustc-cfg=openssl
#15 134.1 cargo:rerun-if-env-changed=AARCH64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR
#15 134.1 AARCH64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR unset
#15 134.1 cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
#15 134.1 OPENSSL_LIB_DIR unset
#15 134.1 cargo:rerun-if-env-changed=AARCH64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR
#15 134.1 AARCH64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR unset
#15 134.1 cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
#15 134.1 OPENSSL_INCLUDE_DIR unset
#15 134.1 cargo:rerun-if-env-changed=AARCH64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR
#15 134.1 AARCH64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR unset
#15 134.1 cargo:rerun-if-env-changed=OPENSSL_DIR
#15 134.1 OPENSSL_DIR unset
#15 134.1 cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64-unknown-linux-musl
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64_unknown_linux_musl
#15 134.1 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-musl
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_musl
#15 134.1 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG
#15 134.1 cargo:rerun-if-env-changed=OPENSSL_STATIC
#15 134.1 cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-musl
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_musl
#15 134.1 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_PATH
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_PATH
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-musl
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_musl
#15 134.1 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_LIBDIR
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-musl
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_musl
#15 134.1 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
#15 134.1 cargo:rerun-if-env-changed=SYSROOT
#15 134.1 cargo:rerun-if-env-changed=OPENSSL_STATIC
#15 134.1 cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
#15 134.1 cargo:rustc-link-lib=ssl
#15 134.1 cargo:rustc-link-lib=dl
#15 134.1 cargo:rustc-link-lib=crypto
#15 134.1 cargo:rustc-link-lib=dl
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-musl
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_musl
#15 134.1 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG
#15 134.1 cargo:rerun-if-env-changed=OPENSSL_STATIC
#15 134.1 cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-musl
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_musl
#15 134.1 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_PATH
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_PATH
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-musl
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_musl
#15 134.1 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_LIBDIR
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-musl
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_musl
#15 134.1 cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
#15 134.1 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
#15 134.1 cargo:rerun-if-changed=build/expando.c
#15 134.1 OPT_LEVEL = Some("3")
#15 134.1 TARGET = Some("aarch64-unknown-linux-musl")
#15 134.1 HOST = Some("aarch64-unknown-linux-gnu")
#15 134.1 CC_aarch64-unknown-linux-musl = None
#15 134.1 CC_aarch64_unknown_linux_musl = None
#15 134.1 TARGET_CC = None
#15 134.1 CC = None
#15 134.1 CROSS_COMPILE = None
#15 134.1 CFLAGS_aarch64-unknown-linux-musl = None
#15 134.1 CFLAGS_aarch64_unknown_linux_musl = None
#15 134.1 TARGET_CFLAGS = None
#15 134.1 CFLAGS = None
#15 134.1 CRATE_CC_NO_DEFAULTS = None
#15 134.1 DEBUG = Some("false")
#15 134.1 CARGO_CFG_TARGET_FEATURE = Some("crt-static,neon,pmuv3")
#15 134.1 running: "aarch64-linux-musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-static" "-I" "/usr/include" "-Wall" "-Wextra" "-E" "build/expando.c"
#15 134.1 exit status: 127
#15 134.1
#15 134.1 --- stderr
#15 134.1 thread 'main' panicked at '
#15 134.1 Header expansion error:
#15 134.1 Error { kind: ToolExecError, message: "Command \"aarch64-linux-musl-gcc\" \"-O3\" \"-ffunction-sections\" \"-fdata-sections\" \"-fPIC\" \"-static\" \"-I\" \"/usr/include\" \"-Wall\" \"-Wextra\" \"-E\" \"build/expando.c\" with args \"aarch64-linux-musl-gcc\" did not execute successfully (status code exit status: 127)." }
#15 134.1
#15 134.1 Failed to find OpenSSL development headers.
#15 134.1
#15 134.1 You can try fixing this setting the `OPENSSL_DIR` environment variable
#15 134.1 pointing to your OpenSSL installation or installing OpenSSL headers package
#15 134.1 specific to your distribution:
#15 134.1
#15 134.1 # On Ubuntu
#15 134.1 sudo apt-get install libssl-dev
#15 134.1 # On Arch Linux
#15 134.1 sudo pacman -S openssl
#15 134.1 # On Fedora
#15 134.1 sudo dnf install openssl-devel
#15 134.1 # On Alpine Linux
#15 134.1 apk add openssl-dev
#15 134.1
#15 134.1 See rust-openssl documentation for more information:
#15 134.1
#15 134.1 https://docs.rs/openssl
#15 134.1 ', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.77/build/main.rs:185:13
#15 134.1 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#15 134.1 warning: build failed, waiting for other jobs to finish...
------
error: failed to solve: executor failed running [/bin/sh -c cargo build --target $arch-unknown-linux-musl --release]: exit code: 101 |
after creating symlink for aarch64-linux-musl-gcc
Compiling num-integer v0.1.45
error[E0277]: the trait bound `i128: traits::Num` is not satisfied
--> /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.45/src/lib.rs:406:14
|
406 | impl Integer for $T {
| ^^^^^^^ the trait `traits::Num` is not implemented for `i128`
...
831 | impl_integer_for_isize!(i128, test_integer_i128);
| ------------------------------------------------ in this macro invocation
|
= help: the following other types implement trait `traits::Num`:
f32
f64
i16
i32
i64
i8
isize
u16
and 4 others
note: required by a bound in `Integer`
--> /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.45/src/lib.rs:37:28
|
37 | pub trait Integer: Sized + Num + PartialOrd + Ord + Eq {
| ^^^ required by this bound in `Integer`
= note: this error originates in the macro `impl_integer_for_isize` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `u128: traits::Num` is not satisfied
--> /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.45/src/lib.rs:835:14
|
835 | impl Integer for $T {
| ^^^^^^^ the trait `traits::Num` is not implemented for `u128`
...
1057 | impl_integer_for_usize!(u128, test_integer_u128);
| ------------------------------------------------ in this macro invocation
|
= help: the following other types implement trait `traits::Num`:
f32
f64
i16
i32
i64
i8
isize
u16
and 4 others
note: required by a bound in `Integer`
--> /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.45/src/lib.rs:37:28
|
37 | pub trait Integer: Sized + Num + PartialOrd + Ord + Eq {
| ^^^ required by this bound in `Integer`
= note: this error originates in the macro `impl_integer_for_usize` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `i128: traits::Num` is not satisfied
--> /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.45/src/roots.rs:136:14
|
136 | impl Roots for $T {
| ^^^^^ the trait `traits::Num` is not implemented for `i128`
...
170 | signed_roots!(i128, u128);
| ------------------------- in this macro invocation
|
= help: the following other types implement trait `traits::Num`:
f32
f64
i16
i32
i64
i8
isize
u16
and 4 others
note: required by a bound in `Roots`
--> /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.45/src/roots.rs:9:18
|
9 | pub trait Roots: Integer {
| ^^^^^^^ required by this bound in `Roots`
= note: this error originates in the macro `signed_roots` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `u128: traits::Num` is not satisfied
--> /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.45/src/roots.rs:204:14
|
204 | impl Roots for $T {
| ^^^^^ the trait `traits::Num` is not implemented for `u128`
...
390 | unsigned_roots!(u128);
| --------------------- in this macro invocation
|
= help: the following other types implement trait `traits::Num`:
f32
f64
i16
i32
i64
i8
isize
u16
and 4 others
note: required by a bound in `Roots`
--> /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.45/src/roots.rs:9:18
|
9 | pub trait Roots: Integer {
| ^^^^^^^ required by this bound in `Roots`
= note: this error originates in the macro `unsigned_roots` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0277`.
error: could not compile `num-integer` due to 4 previous errors
|
for fixing num-integer v0.1.45 remove 128 with 64 or 32 sed -i 's/128/32/g' /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.45/src/roots.rs
sed -i 's/128/64/g' /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.45/src/lib.rs |
not statically linked binary. fails to run on other arm64 machine rust@e13ee56362cb:~/src/target/aarch64-unknown-linux-musl/release$ ldd kn
linux-vdso.so.1 (0x0000ffff896b2000)
libssl.so.1.1 => /usr/lib/aarch64-linux-gnu/libssl.so.1.1 (0x0000ffff895fc000)
libcrypto.so.1.1 => /usr/lib/aarch64-linux-gnu/libcrypto.so.1.1 (0x0000ffff893bb000)
libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffff8938f000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff89236000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff89686000)
libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000ffff89221000)
rust@e13ee56362cb:~/src/target/aarch64-unknown-linux-musl/release$ ./kn
/home/rust/.kube/config : kubeconfig file does not exists root@lp-arm-1:~/kx-kn-rust/kn/target/aarch64-unknown-linux-musl/release# ./kn
thread 'main' panicked at 'unexpected getrandom error: 0', library/std/src/sys/unix/rand.rs:111:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
root@lp-arm-1:~/kx-kn-rust/kn/target/aarch64-unknown-linux-musl/release#
root@lp-arm-1:~/kx-kn-rust/kn/target/aarch64-unknown-linux-musl/release# ldd kn
linux-vdso.so.1 (0x0000ffff983ce000)
libssl.so.1.1 => /lib/aarch64-linux-gnu/libssl.so.1.1 (0x0000ffff98304000)
libcrypto.so.1.1 => /lib/aarch64-linux-gnu/libcrypto.so.1.1 (0x0000ffff98076000)
libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffff98046000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff97ed3000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff9839e000)
libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000ffff97ebf000) |
apt-get install musl-tools clang llvm -y
export CC_aarch64_unknown_linux_musl=clang
export AR_aarch64_unknown_linux_musl=llvm-ar
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" source - briansmith/ring#1414 (comment)
|
Failed error: linking with
after that
build works but not statically linked. |
build binary but working on outside of container. cargo rustc --target aarch64-linux-gnu-gcc -- -C "target-feature=+crt-static" -C link-arg="-lgcc"
cargo build --target=aarch64-unknown-linux-musl --release alpine / # ldd kn
/lib/ld-linux-aarch64.so.1 (0xffffaa5f9000)
libssl.so.1.1 => /lib/libssl.so.1.1 (0xffffaa253000)
libcrypto.so.1.1 => /lib/libcrypto.so.1.1 (0xffffaa003000)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by kn)
libpthread.so.0 => /lib/ld-linux-aarch64.so.1 (0xffffaa5f9000)
libdl.so.2 => /lib/ld-linux-aarch64.so.1 (0xffffaa5f9000)
libc.so.6 => /lib/ld-linux-aarch64.so.1 (0xffffaa5f9000)
Error relocating kn: __res_init: symbol not found
Error relocating kn: _Unwind_GetIPInfo: symbol not found
Error relocating kn: _Unwind_GetDataRelBase: symbol not found
Error relocating kn: _Unwind_GetRegionStart: symbol not found
Error relocating kn: _Unwind_SetGR: symbol not found
Error relocating kn: _Unwind_GetTextRelBase: symbol not found
Error relocating kn: _Unwind_Resume: symbol not found
Error relocating kn: _Unwind_DeleteException: symbol not found
Error relocating kn: gnu_get_libc_version: symbol not found
Error relocating kn: _Unwind_RaiseException: symbol not found
Error relocating kn: _Unwind_GetIP: symbol not found
Error relocating kn: _Unwind_Backtrace: symbol not found
Error relocating kn: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating kn: _Unwind_SetIP: symbol not found |
updated Cargo.toml kube dependencies and used rustls-tls instead of openssl kube = { version = "0.75.0", default-features = false, features = ["runtime", "derive", "client", "rustls-tls"] } It's faling with below error.
using root@lp-arm-1:~# ./kn
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: HyperError(hyper::Error(Connect, Custom { kind: Other, error: Custom { kind: InvalidData, error: UnsupportedNameType } }))', src/kn.rs:43:64
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
root@lp-arm-1:~# unset KUBECONFIG
root@lp-arm-1:~# ./kn
/root/.kube/config : kubeconfig file does not exists
also tested with |
Finally able to build statically linked binary with added below openssl in Cargo.toml openssl = { version = "0.10", features = ["vendored"] } apt install pkg-config perl make
apt install libssl-dev
cargo build --target aarch64-unknown-linux-musl --release |
After installing
libssl-dev
on ubuntu andopenssl-devel
on fedora still the same issue.error details - #2 (comment)
Able to build using custom docker image from https://github.com/koolwithk/rust-musl-builder (fork from https://github.com/emk/rust-musl-builder ) and after tha kn build was successful.
Currently working on arm64 build of https://github.com/koolwithk/rust-musl-builder with aarch64
The text was updated successfully, but these errors were encountered: