Comments (25)
Adding openssl = "0.10"
dependency and running the code below (in container of #89 (comment)) also results in coredump.
fn main() {
let _ = openssl::ssl::SslMethod::tls();
}
It seems that something happened during initialization of OpenSSL, which is invoked from startup routine, before running main() the first call to an openssl function with ffi?.
FWIW, changing the line to let _: Option<openssl::ssl::SslMethod> = None;
suppresses the segfault. I think it's because openssl is not being initialized in this case.
from cargo-udeps.
It seems that this should be solved by upstream (maybe openssl
crate).
from cargo-udeps.
It seems that this should be solved by upstream
Yeah I'd recommend filing a bug about it upstream. Either your distro that provides the openssl package, or the openssl-rs crate's github (it seems to be reproducible with only openssl, right?).
Given that a workaround seems to exist and the bug is in upstream, I'm closing the issue.
Should many more people hit it, I'll consider making a release with features = ["vendored-openssl"]
. Until then people can:
- fork cargo-udeps
- make the change manually
- run
cargo install --path .
This should fix the issue for them!
from cargo-udeps.
As far as I remember, Cargo built with x86_64-unknown-linux-musl
does not work.
from cargo-udeps.
- https://github.com/rust-lang/rust/blob/1.50.0/library/std/src/sync/once.rs#L420
- https://docs.rs/curl/0.4.34/src/curl/lib.rs.html#115-139
from cargo-udeps.
- cargo-udeps built with
cargo install --locked
also segfaults. So the latestcurl-sys
released last month is probably irrelevant. cargo udeps -h
also segfaults, but cargo-udeps with emptyfn main() {}
does not.
from cargo-udeps.
Shell::new
segfaults...?
(edit) Probably caused by No, libc::isatty
atty::is
works without segfault.
FROM rust:1.50.0-alpine3.12
ADD . /root/cargo-udeps
RUN apk update \
&& apk add --no-cache \
musl-dev \
gdb \
alpine-sdk \
openssl-dev \
vim \
&& rustup toolchain add nightly-2021-03-09 \
&& rustup show \
&& cd /root/cargo-udeps \
&& cargo clean \
&& cargo install --debug --path .
/ # export PS1='# '
# cd /root/cargo-udeps
# vim ./src/main.rs
# cat ./src/main.rs
fn main() {
let _ = cargo::core::shell::Shell::new();
}
# cargo install --debug --path .
Installing cargo-udeps v0.1.17 (/root/cargo-udeps)
Updating crates.io index
Compiling cargo-udeps v0.1.17 (/root/cargo-udeps)
Finished dev [unoptimized] target(s) in 3.26s
Replacing /usr/local/cargo/bin/cargo-udeps
Replaced package `cargo-udeps v0.1.17 (/root/cargo-udeps)` with `cargo-udeps v0.1.17 (/root/cargo-udeps)` (executable `cargo-udeps`)
# cargo-udeps
Segmentation fault (core dumped)
# echo 'fn main() {}' >./src/main.rs
# cargo install --debug --path .
Installing cargo-udeps v0.1.17 (/root/cargo-udeps)
Updating crates.io index
Compiling cargo-udeps v0.1.17 (/root/cargo-udeps)
Finished dev [unoptimized] target(s) in 0.83s
Replacing /usr/local/cargo/bin/cargo-udeps
Replaced package `cargo-udeps v0.1.17 (/root/cargo-udeps)` with `cargo-udeps v0.1.17 (/root/cargo-udeps)` (executable `cargo-udeps`)
# cargo-udeps
# echo $?
0
from cargo-udeps.
Which cargo-udeps version are you using? Also could you try to install a debug version of cargo-udeps and obtain a stacktrace (eg using gdb)?
from cargo-udeps.
Hi @est31, thanks for helping out.
Installing cargo-udeps v0.1.18
and, how do you suggest install a debug version of cargo-udeps? Is there any other way to obtain debugging info?
from cargo-udeps.
https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-2
https://github.com/rust-lang/cargo/blob/352f82890359c79a2f716a104c5a786ab8e49c7e/.github/workflows/main.yml
from cargo-udeps.
@seanpianka cargo install --debug cargo-udeps
should do the trick... regarding cargo not working with musl, that's interesting. x86_64-unknown-linux-musl
seems to be tier 2. Is cargo available for this platform via rustup? Does that cargo work?
from cargo-udeps.
AFAIK, cargo works just fine with unknown-linux-musl.
$ cargo +nightly install --debug cargo-udeps
...
Updating crates.io index
Downloading crates ...
Downloaded cargo-udeps v0.1.18
Installing cargo-udeps v0.1.18
...
Finished dev [unoptimized] target(s) in 58.22s
Installing /usr/local/cargo/bin/cargo-udeps
Installed package `cargo-udeps v0.1.18` (executable `cargo-udeps`)
...
$ cargo +nightly udeps --release --all-targets
/bin/bash: line 147: 25 Segmentation fault (core dumped) cargo +nightly udeps --release --all-targets
from cargo-udeps.
In my environment, cargo
from rustup cannot even run...
❯ uname -a
Linux extreme 5.10.20-1-lts #1 SMP Thu, 04 Mar 2021 12:02:02 +0000 x86_64 GNU/Linux
❯ rustup toolchain add stable-x86_64-unknown-linux-musl
warning: toolchain 'stable-x86_64-unknown-linux-musl' may not be able to run on this system.
warning: If you meant to build software to target that platform, perhaps try `rustup target add x86_64-unknown-linux-musl` instead?
info: syncing channel updates for 'stable-x86_64-unknown-linux-musl'
info: latest update on 2021-02-11, rust version 1.50.0 (cb75ad5db 2021-02-10)
info: downloading component 'cargo'
︙
︙
︙
info: installing component 'rustfmt'
stable-x86_64-unknown-linux-musl installed - (error reading rustc version)
info: checking for self-updates
❯ cargo +stable-x86_64-unknown-linux-musl install cargo-udeps
Error relocating /lib/libgcc_s.so.1: __cpu_indicator_init: symbol not found
Error relocating /lib/libgcc_s.so.1: __cpu_model: symbol not found
❯ rustc +stable-x86_64-unknown-linux-musl --version
Error relocating /lib/libgcc_s.so.1: __cpu_indicator_init: symbol not found
Error relocating /lib/libgcc_s.so.1: __cpu_model: symbol not found
from cargo-udeps.
No clue, it works fine for me.
+ uname -a
Linux runner-h-concurrent-0 5.8.0-7630-generic #32~1606339263~20.10~61c3910-Ubuntu SMP Thu Nov 26 00:10:35 UTC x86_64 Linux
+ rustup --version
rustup 1.23.1 (2020-11-30)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.50.0 (cb75ad5db 2021-02-10)`
+ cargo --version
cargo 1.50.0 (f04e7fab7 2021-02-04)
+ rustc --version
rustc 1.50.0 (cb75ad5db 2021-02-10)
$ rustup show
Default host: x86_64-unknown-linux-musl
rustup home: /usr/local/rustup
installed toolchains
--------------------
nightly-x86_64-unknown-linux-musl
1.50.0-x86_64-unknown-linux-musl (default)
active toolchain
----------------
1.50.0-x86_64-unknown-linux-musl (default)
rustc 1.50.0 (cb75ad5db 2021-02-10)
$ cargo install --debug cargo-udeps
...
Finished dev [unoptimized] target(s) in 59.23s
Installing /usr/local/cargo/bin/cargo-udeps
Installed package `cargo-udeps v0.1.18` (executable `cargo-udeps`)
$ cargo udeps --release --all-targets
/bin/bash: line 150: 25 Segmentation fault (core dumped) cargo udeps --release --all-targets
from cargo-udeps.
Does cargo-udeps built with x86_64-unknown-linux-gnu
work?
from cargo-udeps.
(I'm still trying to build Cargo with x86_64-unknown-linux-musl
, and am unable to run it.)
FROM ubuntu:20.04
RUN apt-get update \
&& apt-get install -y curl musl-tools
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -o /tmp/rustup-init \
&& chmod 755 /tmp/rustup-init \
&& /tmp/rustup-init -y --default-host x86_64-unknown-linux-musl --default-toolchain 1.50.0 --profile minimal
root@ac625b5c07b6:/# rustup show
Default host: x86_64-unknown-linux-musl
rustup home: /root/.rustup
1.50.0-x86_64-unknown-linux-musl (default)
(error reading rustc version)
root@ac625b5c07b6:/# rustc -V
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so)
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so: _Unwind_GetRegionStart: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so: _Unwind_GetTextRelBase: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so: _Unwind_RaiseException: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so: _Unwind_SetIP: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so: _Unwind_Resume: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so: _Unwind_DeleteException: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so: _Unwind_Resume_or_Rethrow: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so: _Unwind_GetIPInfo: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so: _Unwind_GetDataRelBase: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so: _Unwind_SetGR: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/librustc_driver-a9e9a2259481e14c.so: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_Resume: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_GetTextRelBase: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_GetDataRelBase: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_GetRegionStart: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_FindEnclosingFunction: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_DeleteException: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_SetGR: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_SetIP: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_GetCFA: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_RaiseException: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_GetIP: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_GetIPInfo: symbol not found
Error relocating /root/.rustup/toolchains/1.50.0-x86_64-unknown-linux-musl/lib/libstd-d2918ad39560ef70.so: _Unwind_Backtrace: symbol not found
root@ac625b5c07b6:/# find /usr/lib -name libgcc_s.so.1
/usr/lib/x86_64-linux-gnu/libgcc_s.so.1
from cargo-udeps.
Does cargo-udeps built with
x86_64-unknown-linux-gnu
work?
gnu is not available for my use-case/environment.
Try:
FROM rust:1.50.0-alpine3.12
RUN apk update \
&& apk add --no-cache \
musl-dev \
gdb \
openssl-dev \
alpine-sdk
RUN cargo --version \
&& rustup target add x86_64-unknown-linux-musl \
&& rustup toolchain install nightly \
&& cargo install --debug cargo-udeps
Edit: added openssl-dev
.
from cargo-udeps.
I reproduced the segfault with the image. (But openssl-dev
seems to be also necessary.)
❯ # On the host OS
❯ sudo sysctl kernel.core_pattern='./core'
[sudo] password for ryo:
kernel.core_pattern = ./core
/ # rustup show
Default host: x86_64-unknown-linux-musl
rustup home: /usr/local/rustup
installed toolchains
--------------------
nightly-x86_64-unknown-linux-musl
1.50.0-x86_64-unknown-linux-musl (default)
active toolchain
----------------
1.50.0-x86_64-unknown-linux-musl (default)
rustc 1.50.0 (cb75ad5db 2021-02-10)
/ # cargo new /root/a && cd $_
Created binary (application) `/root/a` package
~/a # cargo +nightly udeps --release --no-targets
Segmentation fault (core dumped)
~/a # gdb cargo-udeps ./core.28
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-alpine-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from cargo-udeps...
[New LWP 28]
Core was generated by `/usr/local/cargo/bin/cargo-udeps udeps --release --no-targets'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007f8043a87cf9 in ossl_init ()
#2 0x00007f8043a843e3 in Curl_ssl_init ()
#3 0x00007f8043a541fb in global_init ()
#4 0x00007f8043a54251 in curl_global_init ()
#5 0x00007f8043a47b82 in curl::init::init_inner::{{closure}} ()
#6 0x00007f8043a3e177 in std::sync::once::Once::call_once::{{closure}} ()
#7 0x00007f8043ba1042 in std::sync::once::Once::call_inner ()
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b//library/std/src/sync/once.rs:420
#8 0x00007f8043a3e0f8 in std::sync::once::Once::call_once ()
#9 0x00007f804298a271 in curl::init::init_inner ()
#10 0x00007f8043bcb6f2 in libc_start_init ()
#11 0x00007f80429b6fa0 in ?? ()
#12 0x00007f8043bcb717 in libc_start_main_stage2 ()
#13 0x00007f8043bcb6fa in libc_start_init ()
#14 0x0000000000000000 in ?? ()
from cargo-udeps.
Possibly relating to matklad/once_cell#105?
from cargo-udeps.
I've tried installing curl in that image:
INFO[0026] Running: [/bin/sh -c apk update && apk add --no-cache bash jq make shellcheck musl-dev openssl-dev python3 py3-pip nodejs yarn zip vim curl gdb alpine-sdk tree]
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
v3.12.4-8-g97a2ead7a3 [http://dl-cdn.alpinelinux.org/alpine/v3.12/main]
v3.12.4-11-g32c4f23765 [http://dl-cdn.alpinelinux.org/alpine/v3.12/community]
OK: 12762 distinct packages available
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/75) Upgrading musl (1.1.24-r8 -> 1.1.24-r10)
(2/75) Installing fakeroot (1.24-r0)
(3/75) Upgrading libcrypto1.1 (1.1.1g-r0 -> 1.1.1j-r0)
(4/75) Upgrading libssl1.1 (1.1.1g-r0 -> 1.1.1j-r0)
...
(13/75) Installing libcurl (7.69.1-r3)
(14/75) Installing curl (7.69.1-r3)
...
(75/75) Installing zip (3.0-r8)
Executing busybox-1.31.1-r16.trigger
Executing ca-certificates-20191127-r2.trigger
OK: 388 MiB in 130 packages
However, I still see the segmentation fault:
$ cargo udeps --release --all-targets
/bin/bash: line 150: 25 Segmentation fault (core dumped) cargo udeps --release --all-targets
from cargo-udeps.
Is libc_start_init
called before main
in Rust? (I'm not familiar with C)
from cargo-udeps.
Huh that's interesting... Maybe a bug with the openssl library/bindings then?
from cargo-udeps.
This problem can be worked around by using vendored openssl instead of alpine's one, by cargo = { version = "0.51", features = ["vendored-openssl"] }
in Cargo.toml.
By this change, cargo +nightly-2021-03-09 udeps
in the conitainer is able to finish successfully.
Note that apk add perl
is required to build vendored openssl.
from cargo-udeps.
Hello, I'd like to report this bug upstream, could you help summarize the issue? "Initializing rust openssl v0.10 bindings is seg-faulting on alpine linux-musl?"
from cargo-udeps.
@seanpianka the bug you filed upstream looks good! (as someone who didn't reproduce it)
from cargo-udeps.
Related Issues (20)
- possibly surprising behavior for `--expect`? HOT 2
- Strange behavior in CI and in interaction with cargo build HOT 10
- tests/normal-dev-build.rs test failures since update of cargo HOT 3
- recognize .cargo/config.toml
- How to add `-Zbuild-std` option? HOT 3
- `cargo-udeps` 1.0.36 crashes when given a `manifest-path` HOT 1
- v0.1.36 release does not contain pre-built binaries in the assets section HOT 3
- Failed to install on Mac M1 chip HOT 3
- [email protected] is broken on latest version of Rust nightly HOT 2
- error: failed to compile cargo-udeps v0.1.41 HOT 2
- Fails to build HOT 1
- Doesn't support `debug = "line-tables-only"` HOT 2
- False positive warning on duplicate dependency
- unknown unstable option: `save-analysis` HOT 1
- regression test failure on macOS sonoma HOT 9
- Adds feature enabling Rustls rather than OpenSSL HOT 2
- Getting this uncought exception when attempting to test on [arbiter](https://github.com/primitivefinance/arbiter/issues/608) HOT 1
- Latest `cargo-credential-libsecret` breaks `cargo-udeps` HOT 6
- Support `workspace.metadata.cargo-udeps.ignore` to ignore dependencies in whole workspace HOT 4
- 0.1.46 release was not completed HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo-udeps.