You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However we think we've encountered an issue with the brew packages here - in that they have a hidden dependency on libzstd, which causes compile errors if it's not present.
Steps to reproduce
rustup default stable
rustup update
rustup target add x86_64-unknown-linux-musl
brew uninstall x86_64-unknown-linux-musl zstd (if zstd can't be uninstalled due to being depended on by other packages, uninstall those other packages too)
$ cargo build --target x86_64-unknown-linux-musl
Compiling cc v1.0.72
Compiling libc v0.2.117
Compiling once_cell v1.9.0
Compiling untrusted v0.7.1
Compiling spin v0.5.2
Compiling ring v0.16.20
error: failed to run custom build command for `ring v0.16.20`
Caused by:
process didn't exit successfully: `/Users/emorley/src/testcase/target/debug/build/ring-05aa88e857cb018a/build-script-build` (exit status: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-unknown-linux-musl = None
CC_x86_64_unknown_linux_musl = Some("x86_64-unknown-linux-musl-gcc")
CFLAGS_x86_64-unknown-linux-musl = None
CFLAGS_x86_64_unknown_linux_musl = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
--- stderr
running "x86_64-unknown-linux-musl-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-g3" "-U_FORTIFY_SOURCE" "-DNDEBUG" "-c" "-o/Users/emorley/src/testcase/target/x86_64-unknown-linux-musl/debug/build/ring-c827af35860feb9e/out/aesni-x86_64-elf.o" "/Users/emorley/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesni-x86_64-elf.S"
dyld[39495]: Library not loaded: /usr/local/opt/zstd/lib/libzstd.1.dylib
Referenced from: /usr/local/Cellar/x86_64-unknown-linux-musl/10.3.0/toolchain/libexec/gcc/x86_64-unknown-linux-musl/10.3.0/cc1
Reason: tried: '/usr/local/opt/zstd/lib/libzstd.1.dylib' (no such file), '/Users/emorley/src/testcase/target/debug/deps/libzstd.1.dylib' (no such file), '/Users/emorley/src/testcase/target/debug/libzstd.1.dylib' (no such file), '/Users/emorley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libzstd.1.dylib' (no such file), '/Users/emorley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/libzstd.1.dylib' (no such file), '/Users/emorley/lib/libzstd.1.dylib' (no such file), '/usr/local/lib/libzstd.1.dylib' (no such file), '/usr/lib/libzstd.1.dylib' (no such file)
x86_64-unknown-linux-musl-gcc: internal compiler error: Abort trap: 6 signal terminated program cc1
Additional information
Manually installing the zstd package to ensure libzstd is available (eg via brew install zstd) makes the build succeed.
It appears the cc1 binary at /usr/local/Cellar/x86_64-unknown-linux-musl/10.3.0/toolchain/libexec/gcc/x86_64-unknown-linux-musl/10.3.0/cc1 is dynamically linked against libzstd, however the x86_64-unknown-linux-musl package does not ensure it exists.
It seems the solutions would be to either:
Have the x86_64-unknown-linux-musl brew package (and related packages) declare a dependency on the zstd brew package, so brew installs that at the same time.
(If the building of the cc1 binary is something within this project's control) Statically build the cc1 binary so it doesn't have dependencies on external libraries.
Package libzstd some other way inside the x86_64-unknown-linux-musl brew package and ensure the toolchain configuration is such that it can be found at runtime.
The text was updated successfully, but these errors were encountered:
edmorley
changed the title
cc1 internal compiler error due to missing libzstd dependency
gcc internal compiler error due to cc1 being dynamically linked against missing libzstdFeb 12, 2022
I notice that the change was only applied to the musl toolchains, however it seems the others are also dynamically linked against libzstd?
eg:
$ otool -L /usr/local/Cellar/x86_64-unknown-linux-gnu/10.3.0/toolchain/libexec/gcc/x86_64-unknown-linux-gnu/10.3.0/cc1 | rg zstd
/usr/local/opt/zstd/lib/libzstd.1.dylib (compatibility version 1.0.0, current version 1.4.9)
...which is the same as for musl:
$ otool -L /usr/local/Cellar/x86_64-unknown-linux-musl/10.3.0/toolchain/libexec/gcc/x86_64-unknown-linux-musl/10.3.0/cc1 | rg zstd
/usr/local/opt/zstd/lib/libzstd.1.dylib (compatibility version 1.0.0, current version 1.4.9)
...so presumably the others need the depends_on too?
Hi!
Thank you for providing these toolchains! :-)
We're currently transitioning to this project from https://github.com/FiloSottile/homebrew-musl-cross since we need Apple M1 support, and that project does not yet support it.
However we think we've encountered an issue with the brew packages here - in that they have a hidden dependency on
libzstd
, which causes compile errors if it's not present.Steps to reproduce
rustup default stable
rustup update
rustup target add x86_64-unknown-linux-musl
brew uninstall x86_64-unknown-linux-musl zstd
(if zstd can't be uninstalled due to being depended on by other packages, uninstall those other packages too)brew install messense/macos-cross-toolchains/x86_64-unknown-linux-musl
cargo new testcase && cd $_
cargo add ring
(or add toCargo.toml
manually, if cargo-edit isn't installed)export CC_x86_64_unknown_linux_musl=x86_64-unknown-linux-musl-gcc CXX_x86_64_unknown_linux_musl=x86_64-unknown-linux-musl-g++ AR_x86_64_unknown_linux_musl=x86_64-unknown-linux-musl-ar CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=x86_64-unknown-linux-musl-gcc
cargo build --target x86_64-unknown-linux-musl
Expected
Cargo build succeeds.
Actual
Cargo build fails with this error:
Additional information
Manually installing the
zstd
package to ensurelibzstd
is available (eg viabrew install zstd
) makes the build succeed.It appears the
cc1
binary at/usr/local/Cellar/x86_64-unknown-linux-musl/10.3.0/toolchain/libexec/gcc/x86_64-unknown-linux-musl/10.3.0/cc1
is dynamically linked againstlibzstd
, however thex86_64-unknown-linux-musl
package does not ensure it exists.It seems the solutions would be to either:
x86_64-unknown-linux-musl
brew package (and related packages) declare a dependency on thezstd
brew package, so brew installs that at the same time.cc1
binary is something within this project's control) Statically build thecc1
binary so it doesn't have dependencies on external libraries.libzstd
some other way inside thex86_64-unknown-linux-musl
brew package and ensure the toolchain configuration is such that it can be found at runtime.The text was updated successfully, but these errors were encountered: