Skip to content
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

Failing to build C dependency for arm musl target #161

Closed
vmanucharyan opened this issue Nov 20, 2017 · 6 comments
Closed

Failing to build C dependency for arm musl target #161

vmanucharyan opened this issue Nov 20, 2017 · 6 comments

Comments

@vmanucharyan
Copy link

I'm trying to compile project with miniz-sys dependency for armv7-unknown-linux-musleabihf and getting the following error:

running: "arm-linux-gnueabihf-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-static" "-march=armv7-a" "-Wall" "-Wextra" "-o" "/target/armv7-unknown-linux-musleabihf/release/build/miniz-sys-20caae3d7d97477f/out/miniz.o" "-c" "miniz.c"
cargo:warning=In file included from /usr/include/stdlib.h:24:0,
cargo:warning=                 from miniz.c:177:
cargo:warning=/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory
cargo:warning=compilation terminated.
exit code: 1

Is it trying to use wrong toolchain (gnueabihf instead of musleabihf) or am i missing something?

Here is full compilation log:

[agent@lx201s chagg]$ cross build --target=armv7-unknown-linux-musleabihf --release
info: downloading component 'rust-std' for 'armv7-unknown-linux-musleabihf'
 17.3 MiB /  17.3 MiB (100 %) 844.8 KiB/s ETA:   0 s                
info: installing component 'rust-std' for 'armv7-unknown-linux-musleabihf'
Unable to find image 'japaric/armv7-unknown-linux-musleabihf:v0.1.12' locally
Trying to pull repository docker.io/japaric/armv7-unknown-linux-musleabihf ... 
sha256:9e56eca02190b30779b93aedecd14bd5f16f7f4349b3223fb02319efa61a030d: Pulling from docker.io/japaric/armv7-unknown-linux-musleabihf
f5c64a3438f6: Already exists 
51899d335aae: Already exists 
6ff2b7de3c13: Already exists 
50366c31f7fd: Already exists 
f441b9a68d13: Already exists 
b2ff706e5a3f: Pull complete 
7e8143d191cb: Pull complete 
e226bf5b0d0f: Pull complete 
2dfca67acff0: Pull complete 
3467f2098824: Pull complete 
1a9fdd20f448: Pull complete 
Digest: sha256:9e56eca02190b30779b93aedecd14bd5f16f7f4349b3223fb02319efa61a030d
Status: Downloaded newer image for docker.io/japaric/armv7-unknown-linux-musleabihf:v0.1.12
   Compiling libc v0.2.33
   Compiling ansi_term v0.9.0
   Compiling quick-error v0.2.2
   Compiling fnv v1.0.6
   Compiling quick-error v1.2.1
   Compiling language-tags v0.2.2
   Compiling matches v0.1.6
   Compiling percent-encoding v1.0.0
   Compiling httparse v1.2.3
   Compiling byteorder v1.1.0
   Compiling ansi_term v0.10.2
   Compiling dtoa v0.4.2
   Compiling cfg-if v0.1.2
   Compiling strsim v0.6.0
   Compiling protobuf v1.4.2
   Compiling log v0.3.8
   Compiling antidote v1.0.0
   Compiling vec_map v0.8.0
   Compiling void v1.0.2
   Compiling lazy_static v0.2.9
   Compiling crossbeam v0.2.10
   Compiling log-mdc v0.1.0
   Compiling linked-hash-map v0.3.0
   Compiling itoa v0.3.4
   Compiling serde v1.0.19
   Compiling typeable v0.1.2
   Compiling safemem v0.2.0
   Compiling num-traits v0.1.40
   Compiling traitobject v0.1.0
   Compiling unicode-normalization v0.1.5
   Compiling unicode-width v0.1.4
   Compiling linked-hash-map v0.4.2
   Compiling bitflags v0.9.1
   Compiling humantime v1.0.0
   Compiling unicode-bidi v0.3.4
   Compiling atty v0.2.3
   Compiling time v0.1.38
   Compiling num_cpus v1.7.0
   Compiling mime v0.2.6
   Compiling unreachable v0.1.1
   Compiling yaml-rust v0.3.5
   Compiling base64 v0.6.0
   Compiling unsafe-any v0.4.2
   Compiling num-integer v0.1.35
   Compiling textwrap v0.9.0
   Compiling nix v0.9.0
   Compiling idna v0.1.4
   Compiling ordered-float v0.5.0
   Compiling serde_json v1.0.6
   Compiling miniz-sys v0.1.10
error: failed to run custom build command for `miniz-sys v0.1.10`
process didn't exit successfully: `/target/release/build/miniz-sys-20c0685950038b44/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("armv7-unknown-linux-musleabihf")
OPT_LEVEL = Some("3")
TARGET = Some("armv7-unknown-linux-musleabihf")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("armv7-unknown-linux-musleabihf")
TARGET = Some("armv7-unknown-linux-musleabihf")
HOST = Some("x86_64-unknown-linux-gnu")
CC_armv7-unknown-linux-musleabihf = None
CC_armv7_unknown_linux_musleabihf = Some("arm-linux-gnueabihf-gcc")
TARGET = Some("armv7-unknown-linux-musleabihf")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_armv7-unknown-linux-musleabihf = None
CFLAGS_armv7_unknown_linux_musleabihf = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "arm-linux-gnueabihf-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-static" "-march=armv7-a" "-Wall" "-Wextra" "-o" "/target/armv7-unknown-linux-musleabihf/release/build/miniz-sys-20caae3d7d97477f/out/miniz.o" "-c" "miniz.c"
cargo:warning=In file included from /usr/include/stdlib.h:24:0,
cargo:warning=                 from miniz.c:177:
cargo:warning=/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory
cargo:warning=compilation terminated.
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "arm-linux-gnueabihf-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-static" "-march=armv7-a" "-Wall" "-Wextra" "-o" "/target/armv7-unknown-linux-musleabihf/release/build/miniz-sys-20caae3d7d97477f/out/miniz.o" "-c" "miniz.c" with args "arm-linux-gnueabihf-gcc" did not execute successfully (status code exit code: 1).

', /cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.3/src/lib.rs:1874:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
@spacekookie
Copy link

Did you ever find a solution for this? I basically am encountering a similar issue where it can't find ncurses.h for some builds on travis

@briansmith
Copy link
Contributor

briansmith commented Jan 25, 2019

I am getting the same error about missing sys/cdefs.h when doing cross build --target=armv7-unknown-linux-musleabihf for ring.

@briansmith
Copy link
Contributor

Here's the path of includes:

In file included from /usr/include/stdint.h:25:0,
                 from /usr/lib/gcc-cross/arm-linux-gnueabihf/5/include/stdint.h:9,
                 from include/GFp/base.h:64,
                 from crypto/internal.h:112,
                 from crypto/block.c:15:
/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory

That is, #include <stdint.h> is broken.

@briansmith
Copy link
Contributor

I think maybe the Docker image on Docker Hub is out of date.

When working on #255 I had to re-build the Docker image for this target from source using ./build-docker-image.sh armv7-unknown-linux-musleabihf. Once I did that, and after adding the following Cross.toml to my project, I was able to get cross test --target=armv7-unknown-linux-musleabihf to work.

[target.armv7-unknown-linux-musleabihf]
image = "japaric/armv7-unknown-linux-musleabihf:latest"

@epitstickpan
Copy link

Thanks @briansmith. I was having the same problem and that fixed it.

@reitermarkus
Copy link
Member

I guess this should be working now that the new images are available on Docker Hub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants