Closed alensiljak closed 1 year ago
Based on a related answer, this definitely seems to be caused by OpenSSL dependency. More precisely, using native-tls
.
Switching to rusttls
fixes the issue.
Not sure if installing some openssl 1.1 compat package would do on Alpine.
I'm trying to package cargo-update
for AlpineLinux. You can try installing cargo-update
from the repo directly (if my MR gets merged, hopefully). The attempt is https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/46262 btw. I don't use WSL myself so can't help much though.
I'd like system lib linking to be the default (and rustls
dependency is behind an opt-in feature flag), since it will make the package more nicely fit into the distro.
Facing this issue on native Alpine (v3.18.2, installed directly on the host). Even when installing openssl1.1-compat-dev
, the command segfaults. Attempting to use the vendored-openssl
feature when installing (install -F vendored-openssl cargo-update
) fails to compile.
Unless you want to post the errors, all I can tell you is that the rust distribution that came with alpine survived one (1) cargo install
invocation and has now broken itself permanently. Unclear to me how I'd get the distribution binary from an APKBUILD in testing/
.
Unless you want to post the errors, all I can tell you is that the rust distribution that came with alpine survived one (1)
cargo install
invocation and has now broken itself permanently. Unclear to me how I'd get the distribution binary from an APKBUILD intesting/
.
Sorry -- here's the vendored-openssl error output. https://gist.github.com/tydavis/56ac06dfecf5043670fafb155abc92a5
When I try to run my (already built) version of cargo-update, I get:
% cargo install-update -a
zsh: segmentation fault cargo install-update -a
Unclear to me how I'd get the distribution binary from an APKBUILD in
testing/
.
Packages in testing/
folder are only available for edge repos. Your repo file should be somewhat like this:
/etc/apk/repositories:
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
https://dl-cdn.alpinelinux.org/alpine/edge/testing
then an apk upgrade -Ua && apk add cargo-update
would be sufficient.
You can notice that my mentioned MR was merged, and I've been using the packaged cargo-update
binary without any issues since then.
You can also add the package directly from testing:
apk add cargo-update --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
thought it appears the cargo-update package requires libgit2 v1.7 and other "edge" updates.
[EDIT] Switching to edge and adding the package immediately allows for cargo-update to run successfully.
Yep, using the edge snippet worked, the apk installed. And, once again cargo install cargo-update
ending in
Compiling terminal_size v0.2.6
Compiling textwrap v0.16.0
error: failed to run custom build command for `openssl-sys v0.9.90`
Caused by:
process didn't exit successfully: `/tmp/cargo-installz1kuvS/release/build/openssl-sys-65211d56ed47fb22/build-script-main` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=X86_64_ALPINE_LINUX_MUSL_OPENSSL_LIB_DIR
X86_64_ALPINE_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_ALPINE_LINUX_MUSL_OPENSSL_INCLUDE_DIR
X86_64_ALPINE_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_ALPINE_LINUX_MUSL_OPENSSL_DIR
X86_64_ALPINE_LINUX_MUSL_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-alpine-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_alpine_linux_musl
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=OPENSSL_STATIC
cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-alpine-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_alpine_linux_musl
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-alpine-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_alpine_linux_musl
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-alpine-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_alpine_linux_musl
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=OPENSSL_STATIC
cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-alpine-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_alpine_linux_musl
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-alpine-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_alpine_linux_musl
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-alpine-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_alpine_linux_musl
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_alpine_linux_musl
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
run pkg_config fail: Could not run `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "openssl"`
The pkg-config command could not be found.
Most likely, you need to install a pkg-config package for your OS.
Try `apt install pkg-config`, or `yum install pkg-config`,
or `pkg install pkg-config`, or `apk add pkgconfig` depending on your distribution.
If you've already installed it, ensure the pkg-config command is one of the
directories in the PATH environment variable.
If you did not expect this build to link to a pre-installed system library,
then check documentation of the openssl-sys crate for an option to
build the library from source, or disable features or dependencies
that require pkg-config.
--- 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-alpine-linux-musl
$TARGET = x86_64-alpine-linux-musl
openssl-sys = 0.9.90
', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.90/build/find_normal.rs:190:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-update v13.0.4`, intermediate artifacts can be found at `/tmp/cargo-installz1kuvS`
then running cargo install cargo-update
broke cargo completely (defined as "all it ever does is
/ # cargo install cargo-update
Updating crates.io index
Installing cargo-update v13.0.4
error: failed to compile `cargo-update v13.0.4`, intermediate artifacts can be found at `/tmp/cargo-installVGpJzV`
Caused by:
failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
--- stdout
___
lib___.rlib
lib___.so
lib___.so
lib___.a
lib___.so
/usr
off
packed
unpacked
___
debug_assertions
panic="unwind"
proc_macro
target_arch="x86_64"
target_endian="little"
target_env="musl"
target_family="unix"
target_feature="fxsr"
target_feature="sse"
target_feature="sse2"
target_has_atomic="16"
target_has_atomic="32"
target_has_atomic="64"
target_has_atomic="8"
target_has_atomic="ptr"
target_os="linux"
target_pointer_width="64"
target_vendor="alpine"
unix
--- stderr
error: unknown start of token: `
--> <anon>:1:25
|
1 | warning: unused import: `std::arch::asm`
| ^
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
1 | warning: unused import: 'std::arch::asm`
| ~
error: unknown start of token: `
--> <anon>:1:40
|
1 | warning: unused import: `std::arch::asm`
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
1 | warning: unused import: `std::arch::asm'
| ~
error: unknown start of token: `
--> <anon>:7:11
|
7 | = note: `#[warn(unused_imports)]` on by default
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
7 | = note: '#[warn(unused_imports)]` on by default
| ~
error: unknown start of token: `
--> <anon>:7:35
|
7 | = note: `#[warn(unused_imports)]` on by default
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
7 | = note: `#[warn(unused_imports)]' on by default
| ~
error: unknown start of token: `
--> <anon>:13:44
|
13 | For more information about this error, try `rustc --explain E0554`.
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
13 | For more information about this error, try 'rustc --explain E0554`.
| ~
error: unknown start of token: `
--> <anon>:13:66
|
13 | For more information about this error, try `rustc --explain E0554`.
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
13 | For more information about this error, try `rustc --explain E0554'.
| ~
error: unknown start of token: `
--> <anon>:17:19
|
17 | warning: function `foo` is never used
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
17 | warning: function 'foo` is never used
| ~
error: unknown start of token: `
--> <anon>:17:23
|
17 | warning: function `foo` is never used
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
17 | warning: function `foo' is never used
| ~
error: unknown start of token: `
--> <anon>:23:11
|
23 | = note: `#[warn(dead_code)]` on by default
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
23 | = note: '#[warn(dead_code)]` on by default
| ~
error: unknown start of token: `
--> <anon>:23:30
|
23 | = note: `#[warn(dead_code)]` on by default
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
|
23 | = note: `#[warn(dead_code)]' on by default
| ~
error: aborting due to 10 previous errors
/ #
") so closing as "fixed in sid" and "cannot reproduce (alpine doesn't have functioning cargo/rustc so EDOM)", I think?
Hi! I'm getting a segmentation fault when running
cargo install-update --list
or anything that is using the network.I'll try not to repeat the info and keep the details actual on SO: https://stackoverflow.com/questions/75033989/how-to-resolve-a-segmentation-fault-in-a-multithreaded-rust-application-in-alpin
This is most-likely not specific to cargo-update but I'm hoping to get some information here and potentially also assist others who run into this. Thanks!