Git Product home page Git Product logo

homebrew-musl-cross's Introduction

homebrew-musl-cross

One-click static-friendly musl-based GCC macOS-to-Linux cross-compilers based on richfelker/musl-cross-make.

brew install filosottile/musl-cross/musl-cross

By default it will install full cross compiler toolchains targeting musl Linux amd64 and arm64.

You can then use x86_64-linux-musl- or aarch64-linux-musl- versions of the tools to build for the target. For example x86_64-linux-musl-cc will compile C code to run on musl Linux amd64.

The "musl" part of the target is important: the binaries will ONLY run on a musl-based system, like Alpine. However, if you build them as static binaries by passing -static as an LDFLAG they will run anywhere. Musl is specifically engineered to support static binaries.

To use this as a Go cross-compiler for cgo, use CC, GOOS/GOARCH, CGO_ENABLED, and -extldflags.

CC=x86_64-linux-musl-gcc CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
    go build -trimpath -ldflags "-extldflags -static"

To use this with Rust, add an entry to .cargo/config and use the corresponding target.

[target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-musl-gcc"

Other architectures are supported. For example you can build a Raspberry Pi cross-compiler:

brew install filosottile/musl-cross/musl-cross --build-from-source \
    --without-x86_64 --without-aarch64 --with-arm-hf

(Note: a custom build takes around ten minutes per architecture on an M2. The installed size is between 150MB and 300MB per architecture.)

If you encounter issues with a missing musl-gcc binary, the build system might be assuming the presence of the musl host compiler wrapper. That should be reported as an issue, but you might be able to workaround it by creating a symlink:

ln -s "$(brew --prefix musl-cross)/bin/x86_64-linux-musl-gcc" /usr/local/bin/musl-gcc

homebrew-musl-cross's People

Contributors

ameobea avatar asmarques avatar ensch avatar filosottile avatar jedisct1 avatar lu-zero avatar mojotalantikite avatar rcoh avatar richard-vd avatar vijayaggarwal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homebrew-musl-cross's Issues

Update GCC version

I tried to use this to build my project, but I use some C++20 features including the new comparison (<=>) operator, which GCC 9 doesn’t support. So I got a “no such file” error on #include <compare>.

GCC 10 does build my project successfully on Linux. I’m just trying to find a way to do this build on macOS. So it would be nice if you updated to a newer version of GCC.

[Error] brew install filosottile/musl-cross/musl-cross --without-x86_64 --with-mips

Environment: Apple Silicon

Logs:

==> /opt/homebrew/opt/make/bin/gmake install TARGET=mips-linux-musl
Last 15 lines from /Users/system/Library/Logs/Homebrew/musl-cross/01.gmake:
      ___cxx_global_var_init in gencondmd.o
  "_mips_isa_rev", referenced from:
      ___cxx_global_var_init in gencondmd.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [Makefile:2865: build/gencondmd] Error 1
gmake[3]: *** Waiting for unfinished jobs....
19 warnings generated.
rm gcc.pod
gmake[3]: Leaving directory '/private/tmp/musl-cross-20230615-80648-ak9kbk/musl-cross-make-0.9.9/build/local/mips-linux-musl/obj_gcc/gcc'
gmake[2]: *** [Makefile:4360: all-gcc] Error 2
gmake[2]: Leaving directory '/private/tmp/musl-cross-20230615-80648-ak9kbk/musl-cross-make-0.9.9/build/local/mips-linux-musl/obj_gcc'
gmake[1]: *** [Makefile:222: obj_gcc/gcc/.lc_built] Error 2
gmake[1]: Leaving directory '/private/tmp/musl-cross-20230615-80648-ak9kbk/musl-cross-make-0.9.9/build/local/mips-linux-musl'
gmake: *** [Makefile:183: install] Error 2

Provide symlink for `musl-gcc`?

Many scripts expect the command musl-gcc to exist. Making a symlink in my $PATH from musl-gcc to $(which x86_64-linux-musl-gcc) caused scripts that have this expectation to work. Seems like it'd be useful to provide this by default?

x86_64-unknown-linux-musl: not found

I've installed brew install filosottile/musl-cross/musl-cross on M1
But still have same issues

I have the following dockerfile

FROM rust:latest as builder

RUN rustup target add x86_64-unknown-linux-musl

RUN apt -y update
RUN apt install -y musl-tools musl-dev
RUN apt install -y pkg-config libssl-dev
RUN apt install -y build-essential

RUN update-ca-certificates

WORKDIR /app
COPY ./ .

# For a musl build on M1 Mac these ENV variables have to be set
ENV RUSTFLAGS='-C linker=x86_64-unknown-linux-musl'
ENV CC='gcc'
ENV CC_x86_64_unknown_linux_musl=x86_64-unknown-linux-musl
ENV CC_x86_64-unknown-linux-musl=x86_64-unknown-linux-musl

RUN cargo build --target x86_64-unknown-linux-musl --release

#FROM gcr.io/distroless/cc
FROM scratch

WORKDIR /app

COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/rebot ./

CMD ["/app/rebot"]

and the Cargo.toml

[package]
name = "rebot"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "rebot"
path = "src/main.rs"

[profile.release]
lto = true
codegen-units = 1
strip = true

[target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-musl-gcc"

[target.x86_64-unknown-linux-gnu]
linker = "x86_64-unknown-linux-gnu-gcc"

[dependencies]
teloxide = { version = "0.12.2", features = ["macros"] }
tokio = { version = "1.26.0", features = ["macros", "rt-multi-thread"]}
log = "0.4"
pretty_env_logger = "0.4"
rand = "0.8.5"
dptree = "0.3.0"
openssl-sys = "0.9.82"
openssl = { version = "0.10.47", features = ["vendored"] }
#openssl = "0.10.47"

[dev-dependencies]
tracing-subscriber = "0.3.16"

output:

#15 147.0 error: failed to run custom build command for `openssl-sys v0.9.82`
#15 147.0
#15 147.0 Caused by:
#15 147.0   process didn't exit successfully: `/app/target/release/build/openssl-sys-8c478482b3038f24/build-script-main` (exit status: 101)
#15 147.0   --- stdout
#15 147.0   cargo:rustc-cfg=const_fn
#15 147.0   cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_NO_VENDOR
#15 147.0   X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_NO_VENDOR unset
#15 147.0   cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
#15 147.0   OPENSSL_NO_VENDOR unset
#15 147.0   cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-musl
#15 147.0   CC_x86_64-unknown-linux-musl = None
#15 147.0   cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_musl
#15 147.0   CC_x86_64_unknown_linux_musl = Some("x86_64-unknown-linux-musl")
#15 147.0   cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-musl
#15 147.0   CFLAGS_x86_64-unknown-linux-musl = None
#15 147.0   cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_musl
#15 147.0   CFLAGS_x86_64_unknown_linux_musl = None
#15 147.0   cargo:rerun-if-env-changed=TARGET_CFLAGS
#15 147.0   TARGET_CFLAGS = None
#15 147.0   cargo:rerun-if-env-changed=CFLAGS
#15 147.0   CFLAGS = None
#15 147.0   cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
#15 147.0   CRATE_CC_NO_DEFAULTS = None
#15 147.0   DEBUG = Some("false")
#15 147.0   CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
#15 147.0   cargo:rerun-if-env-changed=AR_x86_64-unknown-linux-musl
#15 147.0   AR_x86_64-unknown-linux-musl = None
#15 147.0   cargo:rerun-if-env-changed=AR_x86_64_unknown_linux_musl
#15 147.0   AR_x86_64_unknown_linux_musl = None
#15 147.0   cargo:rerun-if-env-changed=TARGET_AR
#15 147.0   TARGET_AR = None
#15 147.0   cargo:rerun-if-env-changed=AR
#15 147.0   AR = None
#15 147.0   RUSTC_LINKER = None
#15 147.0   cargo:rerun-if-env-changed=CROSS_COMPILE
#15 147.0   CROSS_COMPILE = None
#15 147.0   cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-linux-musl
#15 147.0   ARFLAGS_x86_64-unknown-linux-musl = None
#15 147.0   cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_linux_musl
#15 147.0   ARFLAGS_x86_64_unknown_linux_musl = None
#15 147.0   cargo:rerun-if-env-changed=TARGET_ARFLAGS
#15 147.0   TARGET_ARFLAGS = None
#15 147.0   cargo:rerun-if-env-changed=ARFLAGS
#15 147.0   ARFLAGS = None
#15 147.0   cargo:rerun-if-env-changed=RANLIB_x86_64-unknown-linux-musl
#15 147.0   RANLIB_x86_64-unknown-linux-musl = None
#15 147.0   cargo:rerun-if-env-changed=RANLIB_x86_64_unknown_linux_musl
#15 147.0   RANLIB_x86_64_unknown_linux_musl = None
#15 147.0   cargo:rerun-if-env-changed=TARGET_RANLIB
#15 147.0   TARGET_RANLIB = None
#15 147.0   cargo:rerun-if-env-changed=RANLIB
#15 147.0   RANLIB = None
#15 147.0   cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64-unknown-linux-musl
#15 147.0   RANLIBFLAGS_x86_64-unknown-linux-musl = None
#15 147.0   cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64_unknown_linux_musl
#15 147.0   RANLIBFLAGS_x86_64_unknown_linux_musl = None
#15 147.0   cargo:rerun-if-env-changed=TARGET_RANLIBFLAGS
#15 147.0   TARGET_RANLIBFLAGS = None
#15 147.0   cargo:rerun-if-env-changed=RANLIBFLAGS
#15 147.0   RANLIBFLAGS = None
#15 147.0   running cd "/app/target/x86_64-unknown-linux-musl/release/build/openssl-sys-6ec6467337584455/out/openssl-build/build/src" && AR="ar" CC="x86_64-unknown-linux-musl" RANLIB="ranlib" "perl" "./Configure" "--prefix=/app/target/x86_64-unknown-linux-musl/release/build/openssl-sys-6ec6467337584455/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "no-async" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-DOPENSSL_NO_SECURE_MEMORY"
#15 147.0   Configuring OpenSSL version 1.1.1t (0x1010114fL) for linux-x86_64
#15 147.0   Using os-specific seed configuration
#15 147.0   Creating configdata.pm
#15 147.0   Creating Makefile
#15 147.0
#15 147.0   **********************************************************************
#15 147.0   ***                                                                ***
#15 147.0   ***   OpenSSL has been successfully configured                     ***
#15 147.0   ***                                                                ***
#15 147.0   ***   If you encounter a problem while building, please open an    ***
#15 147.0   ***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
#15 147.0   ***   and include the output from the following command:           ***
#15 147.0   ***                                                                ***
#15 147.0   ***       perl configdata.pm --dump                                ***
#15 147.0   ***                                                                ***
#15 147.0   ***   (If you are new to OpenSSL, you might want to consult the    ***
#15 147.0   ***   'Troubleshooting' section in the INSTALL file first)         ***
#15 147.0   ***                                                                ***
#15 147.0   **********************************************************************
#15 147.0   running cd "/app/target/x86_64-unknown-linux-musl/release/build/openssl-sys-6ec6467337584455/out/openssl-build/build/src" && "make" "depend"
#15 147.0   running cd "/app/target/x86_64-unknown-linux-musl/release/build/openssl-sys-6ec6467337584455/out/openssl-build/build/src" && MAKEFLAGS="-j --jobserver-fds=9,14 --jobserver-auth=9,14" "make" "build_libs"
#15 147.0   /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
#15 147.0       "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
#15 147.0   /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
#15 147.0       "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
#15 147.0   /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
#15 147.0       "-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
#15 147.0   make depend && make _build_libs
#15 147.0   make[1]: Entering directory '/app/target/x86_64-unknown-linux-musl/release/build/openssl-sys-6ec6467337584455/out/openssl-build/build/src'
#15 147.0   make[1]: Leaving directory '/app/target/x86_64-unknown-linux-musl/release/build/openssl-sys-6ec6467337584455/out/openssl-build/build/src'
#15 147.0   make[1]: Entering directory '/app/target/x86_64-unknown-linux-musl/release/build/openssl-sys-6ec6467337584455/out/openssl-build/build/src'
#15 147.0   x86_64-unknown-linux-musl  -I. -Iinclude -fPIC -pthread -m64 -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -m64 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/app/target/x86_64-unknown-linux-musl/release/build/openssl-sys-6ec6467337584455/out/openssl-build/install/lib/engines-1.1\"" -DNDEBUG -DOPENSSL_NO_SECURE_MEMORY  -c -o apps/app_rand.o apps/app_rand.c
#15 147.0   make[1]: Leaving directory '/app/target/x86_64-unknown-linux-musl/release/build/openssl-sys-6ec6467337584455/out/openssl-build/build/src'
#15 147.0
#15 147.0   --- stderr
#15 147.0   /bin/sh: 1: x86_64-unknown-linux-musl: not found
#15 147.0   make[1]: *** [Makefile:671: apps/app_rand.o] Error 127
#15 147.0   make: *** [Makefile:175: build_libs] Error 2
#15 147.0   thread 'main' panicked at '
#15 147.0
#15 147.0
#15 147.0   Error building OpenSSL:
#15 147.0       Command: cd "/app/target/x86_64-unknown-linux-musl/release/build/openssl-sys-6ec6467337584455/out/openssl-build/build/src" && MAKEFLAGS="-j --jobserver-fds=9,14 --jobserver-auth=9,14" "make" "build_libs"
#15 147.0       Exit status: exit status: 2
#15 147.0
#15 147.0
#15 147.0       ', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.25.2+1.1.1t/src/lib.rs:505:13
#15 147.0   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#15 147.0 warning: build failed, waiting for other jobs to finish...
------
executor failed running [/bin/sh -c cargo build --target x86_64-unknown-linux-musl --release]: exit code: 101

Downloading url 404,can you help me

brew install FiloSottile/musl-cross/musl-cross

Updating Homebrew...
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
systemd
==> Updated Formulae
Updated 1 formula.

==> Installing musl-cross from filosottile/musl-cross
==> Downloading https://f001.backblazeb2.com/file/filippo-public//musl-cross-0.9.9_1.catalina.bottle.tar.gz
#=#=-# #
curl: (22) The requested URL returned error: 404
Error: Failed to download resource "musl-cross"
Download failed: https://f001.backblazeb2.com/file/filippo-public//musl-cross-0.9.9_1.catalina.bottle.tar.gz

aarch64-linux-musl-gcc: error: unrecognized command line option '-marm'

# GOOS=linux GOARM=5 CGO_ENABLED=1 GOARCH=arm CC=aarch64-linux-musl-gcc CXX=aarch64-linux-musl-g++ go build -v -ldflags "-linkmode external -extldflags -static" .
runtime/cgo
# runtime/cgo
aarch64-linux-musl-gcc: error: unrecognized command line option '-marm'

 # aarch64-linux-musl-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-musl-gcc
COLLECT_LTO_WRAPPER=/usr/local/Cellar/musl-cross/0.9.9/libexec/bin/../libexec/gcc/aarch64-linux-musl/9.2.0/lto-wrapper
Target: aarch64-linux-musl
Configured with: ../src_gcc/configure --enable-languages=c,c++ --disable-nls --with-debug-prefix-map=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9= --disable-libquadmath --disable-decimal-float --disable-libitm --disable-fixed-point CXX='clang++ -fbracket-depth=512' --disable-bootstrap --disable-assembly --disable-werror --target=aarch64-linux-musl --prefix= --libdir=/lib --disable-multilib --with-sysroot=/aarch64-linux-musl --enable-tls --disable-libmudflap --disable-libsanitizer --disable-gnu-indirect-function --disable-libmpx --enable-libstdcxx-time=rt --with-build-sysroot=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_sysroot AR_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/ar AS_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/gas/as-new LD_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/ld/ld-new NM_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/nm-new OBJCOPY_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/objcopy OBJDUMP_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/objdump RANLIB_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/ranlib READELF_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/readelf STRIP_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/strip-new --build=x86_64-apple-darwin20.3.0 --host=x86_64-apple-darwin20.3.0
Thread model: posix
gcc version 9.2.0 (GCC)

I want to cross compile a go project to armv5. but get this error.😭

backblaze B2 404 on bottle tarball

I'm getting a 404 when brew tries to download the bottle tarball:

==> Installing musl-cross from filosottile/musl-cross
==> Downloading f001.backblazeb2.com/file/filippo-public/musl-cross-0.9.9_1.catalina.bottle.tar.gz
curl: (22) The requested URL returned error: 404 
Error: Failed to download resource "musl-cross"
Download failed: f001.backblazeb2.com/file/filippo-public/musl-cross-0.9.9_1.catalina.bottle.tar.gz

I first noticed this from github-actions: https://github.com/joemiller/vault-token-helper/runs/2313692421?check_suite_focus=true

And was able to reproduce locally (macOS 10.15.7 catalina, intel):

$ brew install FiloSottile/musl-cross/musl-cross

==> Installing musl-cross from filosottile/musl-cross
==> Downloading https://f001.backblazeb2.com/file/filippo-public/musl-cross-0.9.9_1.catalina.bottle.tar.gz
#=#=#                                                                         
curl: (22) The requested URL returned error: 404 
Error: Failed to download resource "musl-cross"
Download failed: https://f001.backblazeb2.com/file/filippo-public/musl-cross-0.9.9_1.catalina.bottle.tar.gz

Maybe there is no bottle for macOS Catalina? Or maybe an issue from the move to B2 ?

BTW, thank you so much for building and maintaining this tap!!!!

Apple silicon support?

It seems that there are some build errors on Apple M1 hardware:

==> /opt/homebrew/opt/make/bin/gmake install TARGET=x86_64-linux-musl
Last 15 lines from /Users/novuscy/Library/Logs/Homebrew/musl-cross/01.gmake:
  "_host_hooks", referenced from:
      gt_pch_save(__sFILE*) in libbackend.a(ggc-common.o)
      gt_pch_restore(__sFILE*) in libbackend.a(ggc-common.o)
      toplev::main(int, char**) in libbackend.a(toplev.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [../../src_gcc/gcc/lto/Make-lang.in:81: lto1] Error 1
gmake[3]: *** Waiting for unfinished jobs....
rm gcc.pod
gmake[3]: Leaving directory '/private/tmp/musl-cross-20201216-52153-xax24d/musl-cross-make-0.9.9/build/local/x86_64-linux-musl/obj_gcc/gcc'
gmake[2]: *** [Makefile:4361: all-gcc] Error 2
gmake[2]: Leaving directory '/private/tmp/musl-cross-20201216-52153-xax24d/musl-cross-make-0.9.9/build/local/x86_64-linux-musl/obj_gcc'
gmake[1]: *** [Makefile:222: obj_gcc/gcc/.lc_built] Error 2
gmake[1]: Leaving directory '/private/tmp/musl-cross-20201216-52153-xax24d/musl-cross-make-0.9.9/build/local/x86_64-linux-musl'
gmake: *** [Makefile:183: install] Error 2

isl.gforge.inria.fr down for days

Hi,
Since some days I am trying to install musl-cross, but brew returns the following error:
==> Downloading http://isl.gforge.inria.fr/isl-0.21.tar.bz2 -=O=- # # # # curl: (7) Failed to connect to isl.gforge.inria.fr port 80: Operation timed out Error: Failed to download resource "musl-cross--isl-0.21.tar.bz2" Download failed: http://isl.gforge.inria.fr/isl-0.21.tar.bz2
Googling around it seems that isl.gforge.infria.fr is down for days. Here a discussion in a Google group https://groups.google.com/g/isl-development/c/JGaMo2VUu_8.
I was wondering if you could update the formula to retrieve the resource from a mirror site.
Thank you!

Allow x86_64 with others

If I run brew install FiloSottile/musl-cross/musl-cross --with-aarch64 --with-x86_64, it will not build the x86_64 chain, so I had to change /opt/homebrew/Library/Taps/filosottile/homebrew-musl-cross/musl-cross.rb:

-  option "without-x86_64", "Do not build cross-compilers targeting x86_64-linux-musl"
+  option "with-x86_64", "Build cross-compilers targeting x86_64-linux-musl"

PS. Thanks for this repo, it saved me a lot of time!

Add note on expected install time

Hi @FiloSottile!

Thanks for maintaining this project 🙇‍♀. I got here by trying to install a rust runtime for AWS Lambda from this blog post.

I ran:

brew install filosottile/musl-cross/musl-cross

And it took maybe 30 minutes? I was confused and canceled and retried multiple time, thinking the process got stuck.

When I saw this in the readme:

(It takes a while, getting a cup of coffee won't do.)

I figure now this kind of install time is expected.

My request:

  • Make the note in the Readme a bit clearer - can you suggest a ballpark of expected normal time?
  • Is it possible to add a warning about the install time to the brew output?

Happy to submit a PR if you have pointers on this two questions! thanks!

ssl cert is broken

brew install FiloSottile/musl-cross/musl-cross
==> Installing musl-cross from filosottile/musl-cross
==> Downloading https://github.com/richfelker/musl-cross-make/archive/v0.9.7.tar.gz
Already downloaded: /Users/aleksejkarasev/Library/Caches/Homebrew/musl-cross-0.9.7.tar.gz
==> Downloading https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.10.tar.xz
Already downloaded: /Users/aleksejkarasev/Library/Caches/Homebrew/musl-cross--linux-4.4.10.tar.xz-4.4.10.tar.xz
==> Downloading https://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.bz2
Already downloaded: /Users/aleksejkarasev/Library/Caches/Homebrew/musl-cross--mpfr-3.1.4.tar.bz2-3.1.4.tar.bz2
==> Downloading https://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
Already downloaded: /Users/aleksejkarasev/Library/Caches/Homebrew/musl-cross--mpc-1.0.3.tar.gz-1.0.3.tar.gz
==> Downloading https://ftp.gnu.org/gnu/gmp/gmp-6.1.1.tar.bz2
Already downloaded: /Users/aleksejkarasev/Library/Caches/Homebrew/musl-cross--gmp-6.1.1.tar.bz2-6.1.1.tar.bz2
==> Downloading https://www.musl-libc.org/releases/musl-1.1.18.tar.gz

curl: (60) SSL certificate problem: Invalid certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
Error: Failed to download resource "musl-cross--musl-1.1.18.tar.gz"
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
Error: Failed to download resource "musl-cross--musl-1.1.18.tar.gz"
Download failed: https://www.musl-libc.org/releases/musl-1.1.18.tar.gz

aarch64-linux-musl-gcc: error: unrecognized command line option '-marm'

# GOOS=linux GOARM=5 CGO_ENABLED=1 GOARCH=arm CC=aarch64-linux-musl-gcc CXX=aarch64-linux-musl-g++ go build -v -ldflags "-linkmode external -extldflags -static" .
runtime/cgo
# runtime/cgo
aarch64-linux-musl-gcc: error: unrecognized command line option '-marm'

 # aarch64-linux-musl-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-musl-gcc
COLLECT_LTO_WRAPPER=/usr/local/Cellar/musl-cross/0.9.9/libexec/bin/../libexec/gcc/aarch64-linux-musl/9.2.0/lto-wrapper
Target: aarch64-linux-musl
Configured with: ../src_gcc/configure --enable-languages=c,c++ --disable-nls --with-debug-prefix-map=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9= --disable-libquadmath --disable-decimal-float --disable-libitm --disable-fixed-point CXX='clang++ -fbracket-depth=512' --disable-bootstrap --disable-assembly --disable-werror --target=aarch64-linux-musl --prefix= --libdir=/lib --disable-multilib --with-sysroot=/aarch64-linux-musl --enable-tls --disable-libmudflap --disable-libsanitizer --disable-gnu-indirect-function --disable-libmpx --enable-libstdcxx-time=rt --with-build-sysroot=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_sysroot AR_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/ar AS_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/gas/as-new LD_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/ld/ld-new NM_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/nm-new OBJCOPY_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/objcopy OBJDUMP_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/objdump RANLIB_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/ranlib READELF_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/readelf STRIP_FOR_TARGET=/private/tmp/musl-cross-20210302-62088-nfi6zq/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_binutils/binutils/strip-new --build=x86_64-apple-darwin20.3.0 --host=x86_64-apple-darwin20.3.0
Thread model: posix
gcc version 9.2.0 (GCC)

I want to cross compile a go project to armv5. but get this error.😭

error building on m1 mac

⎆ brew reinstall FiloSottile/musl-cross/musl-cross --with-x86_64

==> Fetching dependencies for filosottile/musl-cross/musl-cross: make
==> Fetching make
==> Downloading https://ghcr.io/v2/homebrew/core/make/manifests/4.4.1
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/make/blobs/sha256:2cf9b5846e07363681d41819a13d2d9a993a69dd5090bbfae3da182915e777b9
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #                                                                                                                                                                                                                                           -#O=- #      #          #                                             ######################################################################################################################################################################################################################################################### 100.0%
==> Fetching filosottile/musl-cross/musl-cross
==> Downloading https://github.com/richfelker/musl-cross-make/commit/d6ded50d.patch?full_index=1
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://github.com/richfelker/musl-cross-make/commit/a54eb56f.patch?full_index=1
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://github.com/richfelker/musl-cross-make/commit/8d34906.patch?full_index=1
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.88.tar.xz
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.bz2
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://www.musl-libc.org/releases/musl-1.2.0.tar.gz
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #               ######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.bz2
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=3d5db9ebe860
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #                                                                                                                                                                                                                                           -#O=- #      #          #
==> Downloading https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://downloads.sourceforge.net/project/libisl/isl-0.21.tar.bz2
==> Downloading from https://phoenixnap.dl.sourceforge.net/project/libisl/isl-0.21.tar.bz2
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #               ######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://github.com/richfelker/musl-cross-make/archive/refs/tags/v0.9.9.tar.gz
==> Downloading from https://codeload.github.com/richfelker/musl-cross-make/tar.gz/refs/tags/v0.9.9
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #
==> Reinstalling filosottile/musl-cross/musl-cross --without-x86_64
==> Installing dependencies for filosottile/musl-cross/musl-cross: make
==> Installing filosottile/musl-cross/musl-cross dependency: make
==> Downloading https://ghcr.io/v2/homebrew/core/make/manifests/4.4.1
Already downloaded: /Users/sfusco/Library/Caches/Homebrew/downloads/c257c9c7d43cce925f3c1cfbc6e65af3fcfa9f7c60035ca02055f54bde5caec9--make-4.4.1.bottle_manifest.json
==> Pouring make--4.4.1.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/make/4.4.1: 16 files, 1.3MB
==> Installing filosottile/musl-cross/musl-cross --without-x86_64
==> Patching
==> Applying d6ded50d.patch
patching file 'patches/musl-1.2.0/0001-broken_arm_vdso.diff'
==> Applying a54eb56f.patch
patching file Makefile
==> Applying 8d34906.patch
patching file 'patches/gcc-10.3.0/0007-darwin-aarch64-config.diff'
patching file 'patches/gcc-10.3.0/0008-darwin-aarch64-self-host-driver.patch'
patching file 'patches/gcc-6.5.0/0026-darwin-aarch64-config.diff'
patching file 'patches/gcc-6.5.0/0027-darwin-aarch64-self-host-driver.diff'
patching file 'patches/gcc-6.5.0/0028-darwin-align-pch_address_space-to-16k.patch'
patching file 'patches/gcc-7.5.0/0023-darwin-aarch64-config.diff'
patching file 'patches/gcc-7.5.0/0024-darwin-aarch64-self-host-driver.patch'
patching file 'patches/gcc-7.5.0/0025-darwin-align-pch_address_space-to-16k.patch'
patching file 'patches/gcc-8.5.0/0022-darwin-aarch64-config.diff'
patching file 'patches/gcc-8.5.0/0023-darwin-aarch64-self-host-driver.patch'
patching file 'patches/gcc-8.5.0/0024-darwin-align-pch_address_space-to-16k.patch'
patching file 'patches/gcc-9.2.0/0020-darwin-aarch64-config.diff'
patching file 'patches/gcc-9.2.0/0021-darwin-aarch64-self-host-driver.patch'
patching file 'patches/gcc-9.2.0/0022-darwin-align-pch_address_space-to-16k.patch'
patching file 'patches/gcc-9.4.0/0020-darwin-aarch64-config.diff'
patching file 'patches/gcc-9.4.0/0021-darwin-aarch64-self-host-driver.patch'
==> Downloading https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.88.tar.xz
Already downloaded: /Users/sfusco/Library/Caches/Homebrew/downloads/f5440cf7cd8df600bbbc7888d7bfc745681f3e3a3bfa5e1fe0e48c03b54781d0--linux-4.19.88.tar.xz
==> Downloading https://ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.bz2
Already downloaded: /Users/sfusco/Library/Caches/Homebrew/downloads/7ca7bfe4233494307c2c9b60b79304b8c35b79989d947bcb99eab79a01705eee--mpfr-4.0.2.tar.bz2
==> Downloading https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
Already downloaded: /Users/sfusco/Library/Caches/Homebrew/downloads/f46049bc3c7cd6b6d6fd2051c98794ba4977ef0eaa361b6fd3c10b95f9d907f0--mpc-1.1.0.tar.gz
==> Downloading https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2
Already downloaded: /Users/sfusco/Library/Caches/Homebrew/downloads/ef6f10b9f951265fe9fca7e4a3f31538df4093f745837530e75c9a88954fe135--gmp-6.1.2.tar.bz2
==> Downloading https://www.musl-libc.org/releases/musl-1.2.0.tar.gz
Already downloaded: /Users/sfusco/Library/Caches/Homebrew/downloads/f24a4c691121f7b49cb43e4106192242544447ea7990bb8172ad0509d02c4469--musl-1.2.0.tar.gz
==> Downloading https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.bz2
Already downloaded: /Users/sfusco/Library/Caches/Homebrew/downloads/742cf2bb3679b7916196d01dd3ea8e87dbafbd6b128d657eccffa1921cbff79b--binutils-2.33.1.tar.bz2
==> Downloading https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=3d5db9ebe860
Already downloaded: /Users/sfusco/Library/Caches/Homebrew/downloads/53c623e9fd9ebac8516b8d880b2a1f0e9c9ef2aa08be18ec30d173ba4ca7d1f2--config.sub
==> Downloading https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz
Already downloaded: /Users/sfusco/Library/Caches/Homebrew/downloads/d826388c1d62d3837abf5966bfcb52111c0fea536be81417ab4718ba089422f1--gcc-9.2.0.tar.xz
==> Downloading https://downloads.sourceforge.net/project/libisl/isl-0.21.tar.bz2
Already downloaded: /Users/sfusco/Library/Caches/Homebrew/downloads/a9dd57e80e483bb29f553e2c596e73ffb5bf92049f5c09d2d2801bc92287ea84--isl-0.21.tar.bz2
==> /opt/homebrew/opt/make/bin/gmake install TARGET=aarch64-linux-musl
Last 15 lines from /Users/sfusco/Library/Logs/Homebrew/musl-cross/01.gmake:
6 warnings generated.
7 warnings generated.
9 warnings generated.
25 warnings generated.
23 warnings generated.
29 warnings generated.
18 warnings generated.
17 warnings generated.
rm gcc.pod
gmake[3]: Leaving directory '/private/tmp/musl-cross-20240315-69038-ubrbo4/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_gcc/gcc'
gmake[2]: *** [Makefile:4361: all-gcc] Error 2
gmake[2]: Leaving directory '/private/tmp/musl-cross-20240315-69038-ubrbo4/musl-cross-make-0.9.9/build/local/aarch64-linux-musl/obj_gcc'
gmake[1]: *** [Makefile:222: obj_gcc/gcc/.lc_built] Error 2
gmake[1]: Leaving directory '/private/tmp/musl-cross-20240315-69038-ubrbo4/musl-cross-make-0.9.9/build/local/aarch64-linux-musl'
gmake: *** [Makefile:183: install] Error 2

If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):
  https://github.com/FiloSottile/homebrew-musl-cross/issues

☠  1  231s

Uses system sed (`/usr/bin/sed`) rather than GNU sed (`/usr/local/bin/sed`)

/usr/bin/sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
gmake[5]: *** [/private/tmp/musl-cross-20190620-7779-5tsznk/musl-cross-make-0.9.8/linux-4.4.10/scripts/Makefile.headersinst:112: /private/tmp/musl-cross-20190620-7779-5tsznk/musl-cross-make-0.9.8/build/local/x86_64-linux-musl/obj_kernel_headers/staged/include/asm-generic/.install] Error 1
gmake[4]: *** [/private/tmp/musl-cross-20190620-7779-5tsznk/musl-cross-make-0.9.8/linux-4.4.10/scripts/Makefile.headersinst:127: asm-generic] Error 2
gmake[3]: *** [/private/tmp/musl-cross-20190620-7779-5tsznk/musl-cross-make-0.9.8/linux-4.4.10/Makefile:1060: headers_install] Error 2
gmake[3]: Leaving directory '/private/tmp/musl-cross-20190620-7779-5tsznk/musl-cross-make-0.9.8/build/local/x86_64-linux-musl/obj_kernel_headers'
gmake[2]: *** [Makefile:146: sub-make] Error 2
gmake[2]: Leaving directory '/private/tmp/musl-cross-20190620-7779-5tsznk/musl-cross-make-0.9.8/linux-4.4.10'
gmake[1]: *** [Makefile:260: obj_kernel_headers/.lc_built] Error 2
gmake[1]: Leaving directory '/private/tmp/musl-cross-20190620-7779-5tsznk/musl-cross-make-0.9.8/build/local/x86_64-linux-musl'
gmake: *** [Makefile:168: install] Error 2

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
  https://github.com/filosottile/homebrew-musl-cross/issues

Which is odd, so I double checked:

$ which sed
/usr/local/bin/sed
$ sed --version
sed (GNU sed) 4.7
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://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.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.
GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
E-mail bug reports to: <[email protected]>.
$ /usr/bin/sed --version
/usr/bin/sed: illegal option -- -
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
$ strings /usr/bin/sed | grep -F FreeBSD
$FreeBSD: src/usr.bin/sed/compile.c,v 1.28 2005/08/04 10:05:11 dds Exp $
$FreeBSD: src/usr.bin/sed/main.c,v 1.36 2005/05/10 13:40:50 glebius Exp $
$FreeBSD: src/usr.bin/sed/misc.c,v 1.10 2004/08/09 15:29:41 dds Exp $
$FreeBSD: src/usr.bin/sed/process.c,v 1.39 2005/04/09 14:31:41 stefanf Exp $

Stuck on step ==> /usr/local/opt/make/bin/gmake install TARGET=x86_64-linux-musl

My OS: macOS 10.14.6

After run brew install FiloSottile/musl-cross/musl-cross:

Updating Homebrew...

==> Installing musl-cross from filosottile/musl-cross
==> Downloading https://github.com/richfelker/musl-cross-make/archive/v0.9.8.tar.gz
Already downloaded: /Users/koddr/Library/Caches/Homebrew/downloads/b1fb6145694b3f03e6d4bab7953ade2a909be7407f0819f78d892d3dcd3f81e8--musl-cross-make-0.9.8.tar.gz
==> Downloading https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.10.tar.xz
Already downloaded: /Users/koddr/Library/Caches/Homebrew/downloads/398d7b1a67ebf5f658f5f31f2d57a936f9161716fed598d400290556e8049d42--linux-4.4.10.tar.xz
==> Downloading https://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.bz2
Already downloaded: /Users/koddr/Library/Caches/Homebrew/downloads/874c62a002181fc3df2f9f0a8a9499f33bb21ccb6370ab9b1065a0e634264b70--mpfr-3.1.4.tar.bz2
==> Downloading https://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
Already downloaded: /Users/koddr/Library/Caches/Homebrew/downloads/bd14c3cef87f64bec2487a0b0135ce51aea28ef5153b0c74bfd9888c82ebf3b8--mpc-1.0.3.tar.gz
==> Downloading https://ftp.gnu.org/gnu/gmp/gmp-6.1.1.tar.bz2
Already downloaded: /Users/koddr/Library/Caches/Homebrew/downloads/5e579956c8e1aafdb613f9a1735c3b94b0c947db2b3399353408dcb30820abc4--gmp-6.1.1.tar.bz2
==> Downloading https://www.musl-libc.org/releases/musl-1.1.22.tar.gz
Already downloaded: /Users/koddr/Library/Caches/Homebrew/downloads/9389d81146f56f0022c4a8176540aafb5c445271f3d832b9ee26240b009bf46c--musl-1.1.22.tar.gz
==> Downloading https://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.bz2
Already downloaded: /Users/koddr/Library/Caches/Homebrew/downloads/16b0cf84c596dc930fb778e07dc61cf98a1927d8a6287beed37571757804a448--binutils-2.27.tar.bz2
==> Downloading https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=3d5db9ebe860
Already downloaded: /Users/koddr/Library/Caches/Homebrew/downloads/53c623e9fd9ebac8516b8d880b2a1f0e9c9ef2aa08be18ec30d173ba4ca7d1f2--config.sub
==> Downloading https://ftp.gnu.org/gnu/gcc/gcc-6.4.0/gcc-6.4.0.tar.xz
Already downloaded: /Users/koddr/Library/Caches/Homebrew/downloads/e91b66be39793d16f9455fa42756bf471f6fa77c02bd51ca6f3b2f01f823af73--gcc-6.4.0.tar.xz
==> Downloading http://isl.gforge.inria.fr/isl-0.15.tar.bz2
Already downloaded: /Users/koddr/Library/Caches/Homebrew/downloads/2d80a8397ef48e37eff156838a9b7e6963c8f2560eaa9dd578f0894fa731a229--isl-0.15.tar.bz2

But process is stuck on this line:

==> /usr/local/opt/make/bin/gmake install TARGET=x86_64-linux-musl

I wait about 2 hours and nothing happen.

What I miss? How to install homebrew-musl-cross?

Bottled version doesn't work because of libisl

Running the bottled version, I get:

dyld: Library not loaded: @@HOMEBREW_PREFIX@@/opt/isl/lib/libisl.15.dylib
  Referenced from: /usr/local/Cellar/musl-cross/0.9.7/libexec/bin/../libexec/gcc/x86_64-linux-musl/6.3.0/cc1
  Reason: image not found
x86_64-linux-musl-gcc: internal compiler error: Abort trap: 6 (program cc1)

It looks like cc1 has a dependency on libisl:

otool -L ../libexec/libexec/gcc/x86_64-linux-musl/6.3.0/cc1
../libexec/libexec/gcc/x86_64-linux-musl/6.3.0/cc1:
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	@@HOMEBREW_PREFIX@@/opt/isl/lib/libisl.15.dylib (compatibility version 19.0.0, current version 19.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)

libisl wasn't installed automatically because its not declared as a dependency. Also, Hombrew now has libisl.19, not .15, so it doesn't work even if I try to install it.

Can not run on debian/Ubuntu

executable that build with the follow command can run on alpine(which is inside my docker container)

env CC=x86_64-linux-musl-gcc CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags "-w -s" -o "Hello2-Linux"

but can not run on Debian/Ubuntu, it returns error:

bash: ./Hello2-Linux: No such file or directory

So how can I build executables that can run on debian/Ubuntu etc.

Error: invalid option: --without-x86_64 Error: invalid option: --with-aarch64

Seeing #17 again on my machine, MacBook Pro M2 Max macOS 14.0 (23A344), so opening a new issue as requested.

Homebrew 4.2.7.

% brew install filosottile/musl-cross/musl-cross --without-x86_64 --without-aarch64 --with-arm-hf

Usage: brew install [options] formula|cask [...]

Install a formula or cask. Additional options specific to a formula may be
appended to the command.

Error: invalid option: --without-x86_64

Workaround: Install and reinstall with options.

[undefined reference] while compiling on Apple Silicon

Hi @FiloSottile, many thanks for maintaining this repo offering macOS-to-Linux cross-compiling solutions for Go, you just can't imagine how you make my life easier when one of my projects needs to embed Rocksdb, such an awesome key-value storage that I've recently developed a love-hate relationship with.

Utilizing the c and c++ cross compiler, my first try on the go build command is as follows:

CGO_LDFLAGS="-L/opt/homebrew/Cellar/[email protected]/7.7.3/lib -L/opt/homebrew/Cellar/zstd/1.5.5/lib -L/opt/homebrew/Cellar/lz4/1.9.4/lib -L/opt/homebrew/Cellar/snappy/1.1.10/lib -L/opt/homebrew/Cellar/zlib/1.2.13/lib -L/opt/homebrew/cellar/musl-cross/0.9.9_1/libexec/lib" CGO_CFLAGS="-I/opt/homebrew/cellar/[email protected]/7.7.3/include" CGO_ENABLED=1 GOOS=linux  GOARCH=amd64 CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ go build -o yeeeeeeeeet

Ideally, this should work, but my terminal once again yells at me

-link-2821846975/000054.o: in function `gorocksdb_comparator_with_ts_create':
grocksdb.c:(.text+0x88): undefined reference to `rocksdb_comparator_with_ts_create'
/opt/homebrew/Cellar/musl-cross/0.9.9_1/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld: /var/folders/85/7xzvr1n56wnbx8tj6h38drq80000gn/T/go-link-2821846975/000054.o: in function `gorocksdb_compactionfilter_create':
grocksdb.c:(.text+0xbe): undefined reference to `rocksdb_compactionfilter_create'
/opt/homebrew/Cellar/musl-cross/0.9.9_1/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld: /var/folders/85/7xzvr1n56wnbx8tj6h38drq80000gn/T/go-link-2821846975/000054.o: in function `gorocksdb_mergeoperator_create':
grocksdb.c:(.text+0x104): undefined reference to `rocksdb_mergeoperator_create'
/opt/homebrew/Cellar/musl-cross/0.9.9_1/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld: /var/folders/85/7xzvr1n56wnbx8tj6h38drq80000gn/T/go-link-2821846975/000054.o: in function `gorocksdb_slicetransform_create':
grocksdb.c:(.text+0x16d): undefined reference to `rocksdb_slicetransform_create'
collect2: error: ld returned 1 exit status

Being spammed of those countless undefined reference errors, I think there must have been something wrong with my go build configurations, by looking and half-guessing at https://stackoverflow.com/questions/62158905/undefined-references-to-symbols-in-standard-libraries-with-musl-cross-make , I changed my go build command as follows:

CGO_LDFLAGS="-L/opt/homebrew/Cellar/[email protected]/7.7.3/lib -L/opt/homebrew/Cellar/zstd/1.5.5/lib -L/opt/homebrew/Cellar/lz4/1.9.4/lib -L/opt/homebrew/Cellar/snappy/1.1.10/lib -L/opt/homebrew/Cellar/zlib/1.2.13/lib -L/opt/homebrew/cellar/musl-cross/0.9.9_1/libexec/lib" CGO_CFLAGS="-I/opt/homebrew/cellar/[email protected]/7.7.3/include" CGO_ENABLED=1 GOOS=linux  GOARCH=amd64 CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ go build -o yeeeeeeeeet

Yet the same error occurs.

I think there must have been something extremely simple and outright on the surface, right below my nose, that somehow I've just managed to unsee, yet I can't figure out what and how. Partly because my familiarity with C is not competent enough. And that's why I'm now humbly asking for any assistance that can help me get this over with.

GCC can’t find <linux/futex.h>

I’m getting a build error “no such file” on #include <linux/futex.h>, down inside a library I use. And when I found the system headers down inside /opt/homebrew/Cellar/musl-cross/0.9.9_1, they don’t include such a header or even a linux subdirectory.

I know very little about Linux development, but I’m guessing this may have to do with musl vs. the default Linux library? In any case I have no idea how to work around this; it’s not even my code including this header, rather a 3rd party library.

Compiling Staticaly linked OpenSSL for linux-x86_64

Any one succeeded to make this usable at all?
I tried every option I can think of but it's not linking statically like with GregorR/musl-cross in ubuntu

CC="/usr/local/bin/x86_64-linux-musl-gcc -static" LD="/usr/local/bin/x86_64-linux-musl-ld -static" \
AR="/usr/local/bin/x86_64-linux-musl-ar" PERL="/usr/bin/perl" ./Configure no-shared \ 
no-async no-zlib no-zlib-dynamic linux-x86_64

/usr/local/bin/gmake

I get loads of :(.text+0x21c): undefined reference to at linking stage

Document disk space requirements

I'm currently installing this and it's so far taken up about 4 gigabytes of disk space, and climbing. I think it would be nice to document along with the installation time how much disk space it's expected to take up while building.

Linkage issues with cross-compiling OpenSSL

I'm trying to cross-compile OpenSSL and it wanted linux/mmap.h. So I symlinked /usr/local/Cellar/musl-cross/0.9.9/libexec/x86_64-linux-musl/include/sys to /usr/local/Cellar/musl-cross/0.9.9/libexec/x86_64-linux-musl/include/linux and it worked - up until OpenSSL wanted linux/version.h.

So I went over to Ubuntu's linux-libc-dev-amd64-cross package and extracted that into /usr/local/Cellar/musl-cross/0.9.9/libexec/x86_64-linux-musl/. Then everything broke but that's because I forgot to remove the symlink.

So after removing the symlink, everything built successfully, but at the linking step, this happened:

image

image

image

Do you know what this means? Or how to fix it?

homebrew docot Warning

Warning: Calling cellar in a bottle block is deprecated! Use brew style --fix on the formula to update the style or use sha256 with a cellar: argument instead.
Please report this issue to the filosottile/musl-cross tap (not Homebrew/brew or Homebrew/core), or even better, submit a PR to fix it:
/usr/local/Homebrew/Library/Taps/filosottile/homebrew-musl-cross/musl-cross.rb:10

Warning: Calling sha256 "digest" => :tag in a bottle block is deprecated! Use brew style --fix on the formula to update the style or use sha256 tag: "digest" instead.
Please report this issue to the filosottile/musl-cross tap (not Homebrew/brew or Homebrew/core), or even better, submit a PR to fix it:
/usr/local/Homebrew/Library/Taps/filosottile/homebrew-musl-cross/musl-cross.rb:11

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.