Skip to content

Can't compile with target=x86_64-unknown-linux-musl #434

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

Closed
jarod opened this issue Aug 2, 2016 · 5 comments
Closed

Can't compile with target=x86_64-unknown-linux-musl #434

jarod opened this issue Aug 2, 2016 · 5 comments

Comments

@jarod
Copy link

jarod commented Aug 2, 2016

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial

$ sudo apt install libssl-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libssl-dev is already the newest version (1.0.2g-1ubuntu4.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `openssl-sys-extras v0.7.14`
Process didn't exit successfully: `/home/jarod/workspace/rust/aws-api-tools/target/release/build/openssl-sys-extras-5c7e4d8925825f00/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-unknown-linux-musl")
OPT_LEVEL = Some("3")
PROFILE = Some("release")
TARGET = Some("x86_64-unknown-linux-musl")
debug=false opt-level=3
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-musl")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-musl = None
CC_x86_64_unknown_linux_musl = None
TARGET_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-musl = None
CFLAGS_x86_64_unknown_linux_musl = None
TARGET_CFLAGS = None
CFLAGS = None
running: "musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-fPIC" "-static" "-o" "/home/jarod/workspace/rust/aws-api-tools/target/x86_64-unknown-linux-musl/release/build/openssl-sys-extras-5c7e4d8925825f00/out/src/openssl_shim.o" "-c" "src/openssl_shim.c"
ExitStatus(ExitStatus(256))


command did not execute successfully, got: exit code: 1



--- stderr
src/openssl_shim.c:1:26: fatal error: openssl/hmac.h: No such file or directory
compilation terminated.
thread '<main>' panicked at 'explicit panic', /home/jarod/.cargo/registry/src/github.1485827954.workers.dev-1ecc6299db9ec823/gcc-0.3.32/src/lib.rs:848
note: Run with `RUST_BACKTRACE=1` for a backtrace.
@sfackler
Copy link
Owner

sfackler commented Aug 2, 2016

What is the output when you run this command?

"musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-fPIC" "-static" "-o" "/home/jarod/workspace/rust/aws-api-tools/target/x86_64-unknown-linux-musl/release/build/openssl-sys-extras-5c7e4d8925825f00/out/src/openssl_shim.o" "-c" "src/openssl_shim.c"

@jarod
Copy link
Author

jarod commented Aug 2, 2016

rust-openssl/openssl-sys-extras$ "musl-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-fPIC" "-static" "-o" "/home/jarod/workspace/rust/aws-api-tools/target/x86_64-unknown-linux-musl/release/build/openssl-sys-extras-5c7e4d8925825f00/out/src/openssl_shim.o" "-c" "src/openssl_shim.c"
src/openssl_shim.c:1:26: fatal error: openssl/hmac.h: No such file or directory
compilation terminated.

@jarod
Copy link
Author

jarod commented Aug 2, 2016

After some digging. I think openssl-sys-extra won't compile with the libssl-dev from apt repository anyway. There is some compiler(?) specified stuff locate in /usr/include/x86_64-linux-gnu/openssl/. I think I need to compile openssl with musl first.

@aidanhs
Copy link
Contributor

aidanhs commented Aug 4, 2016

Some other crates I'm familiar with:

  • libz-sys compiles zlib itself if it detects the musl target (or some other conditions). Requires make and a C compiler. Takes about 3s to compile (if enabled).
  • ssh2-sys compiles libssh2 unconditionally. Requires cmake, make, a C compiler and system openssl libraries/headers. Takes about 5s to compile.

If openssl-sys supported compiling openssl itself (via detecting musl or an environment variable like VENDORED_OPENSSL) it would require the end user to have perl, make and a C compiler and would take about 45s to compile a default configuration of openssl. There is precedent for this (per the other crates) - what do you think?

@sfackler
Copy link
Owner

sfackler commented Aug 4, 2016

I would be uncomfortable being on the hook for rushing out new releases of openssl-sys whenever OpenSSL fixes some critical security vulnerability.

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

No branches or pull requests

3 participants