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

Provide an entirely static build against musl #1001

Closed
svenstaro opened this issue Apr 23, 2020 · 11 comments
Closed

Provide an entirely static build against musl #1001

svenstaro opened this issue Apr 23, 2020 · 11 comments

Comments

@svenstaro
Copy link
Contributor

I think it would be very nice for build environments if you could provide an entirely static build that was built against musl. I run into GLIBC ABI trouble on Centos 7 as it stands with your current builds.

@Keats
Copy link
Collaborator

Keats commented Apr 23, 2020

There was some issues with musl due to sass-sys (compass-rs/sass-rs#30) but it might be fixed now?

@svenstaro
Copy link
Contributor Author

The problem is that something in the line somewhere uses openssl-sys which kills the whole excercise:

error: failed to run custom build command for `openssl-sys v0.9.54`

Caused by:
  process didn't exit successfully: `/home/svenstaro/src/zola/target/debug/build/openssl-sys-bf192baa390cef7d/build-script-main` (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR
X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR
X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR
X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
run pkg_config fail: "Cross compilation detected. Use PKG_CONFIG_ALLOW_CROSS=1 to override"

--- stderr
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

$HOST = x86_64-unknown-linux-gnu
$TARGET = x86_64-unknown-linux-musl
openssl-sys = 0.9.54

', /home/svenstaro/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/openssl-sys-0.9.54/build/find_normal.rs:150:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: build failed

@svenstaro
Copy link
Contributor Author

Ok so it looks like the link_checker depends on reqwest which uses openssl-sys somewhere under the hood. It would be great if you used reqwest with the rustls option in which case this would just work, I think.

@svenstaro
Copy link
Contributor Author

Actually, it looks like you're already requesting the rustls-tls feature in components/link_checker/Cargo.toml so this is really weird. Why would it still pull it in?

@Keats
Copy link
Collaborator

Keats commented Apr 23, 2020

Actually, it looks like you're already requesting the rustls-tls feature in components/link_checker/Cargo.toml so this is really weird. Why would it still pull it in?

Ah that's something I remember looking into for a few minutes but completely forgot about since then :(
I was hoping that using rustls would mean that no openssl but didn't find the time to investigate.

@svenstaro
Copy link
Contributor Author

I think you'll have to define your deps something like this:

[dependencies.reqwest]
version = "0.10"
default-features = false
features = ["blocking", "rustls-tls"]

@svenstaro
Copy link
Contributor Author

With that change, I was able to rid ourselves of openssl but now it does indeed fail in libass_sys in a rather verbose fashion:

[lots of objects]
  = note: /usr/bin/ld: /home/svenstaro/src/zola/target/x86_64-unknown-linux-musl/debug/deps/libsass_sys-f27cbc9a4abe9df9.rlib(sass_context.o): in function `_GLOBAL__sub_I_sass_context.cpp':
          sass_context.cpp:(.text.startup+0x33): undefined reference to `__dso_handle'
          /usr/bin/ld: sass_context.cpp:(.text.startup+0xb7): undefined reference to `__dso_handle'
          /usr/bin/ld: sass_context.cpp:(.text.startup+0xe4): undefined reference to `__dso_handle'
          /usr/bin/ld: sass_context.cpp:(.text.startup+0x10d): undefined reference to `__dso_handle'
          /usr/bin/ld: sass_context.cpp:(.text.startup+0x136): undefined reference to `__dso_handle'
          /usr/bin/ld: /home/svenstaro/src/zola/target/x86_64-unknown-linux-musl/debug/deps/libsass_sys-f27cbc9a4abe9df9.rlib(sass_context.o):sass_context.cpp:(.text.startup+0x15f): more undefined references to `__dso_handle' follow
          /usr/bin/ld: /home/svenstaro/src/zola/target/x86_64-unknown-linux-musl/debug/deps/zola-d6283f8aa3fbdc30: hidden symbol `__dso_handle' isn't defined
          /usr/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status

@svenstaro
Copy link
Contributor Author

I made a PR which fixes the openssl part. I'll take a look at the libass_sys thing.

@southerntofu
Copy link
Contributor

Slightly related #934

Maybe link_checker (and other HTTP deps) and SASS support could be optional (enabled by default) features?

@Keats
Copy link
Collaborator

Keats commented May 22, 2020

It could be but at least not offered via this repo, someone would need to build it by themselves. I'm hoping that a Rust implementation of Sass will be good enough soon...

@Keats
Copy link
Collaborator

Keats commented Jul 19, 2021

That can't be done with libsass afaik but it should work automatically when using rsass or grass so closing that to slim down the issue tracker

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

Successfully merging a pull request may close this issue.

3 participants