Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide symlink for musl-gcc? #16

Closed
WesleyAC opened this issue Jan 8, 2020 · 6 comments
Closed

Provide symlink for musl-gcc? #16

WesleyAC opened this issue Jan 8, 2020 · 6 comments

Comments

@WesleyAC
Copy link

WesleyAC commented Jan 8, 2020

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?

@FiloSottile
Copy link
Owner

I am not sure we should assume x86_64 like that. Is there a convention around it, @richfelker?

@richfelker
Copy link

I don't think it's a good idea for scripts to assume musl-gcc, or to symlink it to cross compilers. That's the wrapper script shipped for minimal out-of-the-box use of musl on a glibc host without actually installing a proper toolchain, and its arch corresponds to whatever arch your glibc-based host is, i.e. it's a "native" compiler not a cross one.

@FiloSottile
Copy link
Owner

In that sense though doesn't it do the same thing that x86_64-linux-musl-gcc does on an x86_64 macOS?

@richfelker
Copy link

Semantically, musl-gcc matching the wrapper shipped with musl would produce musl-linked binaries that you could run on your Mac, which isn't a thing. x86_64-linux-musl-gcc on the other hand is a cross compiler that produces musl-linked binaries to run on x86_64 Linux.

@FiloSottile
Copy link
Owner

Fair enough, it sounds like these scripts might get confused if they can't then run the binaries they compiled, and users might want to target different architectures at that point. We'll let them explicitly symlink /usr/local/bin/musl-gcc to /usr/local/opt/musl-cross/bin/x86_64-linux-musl-gcc if they wish.

@Oliboy50
Copy link

Oliboy50 commented Mar 28, 2021

@FiloSottile I almost gave up on trying to compile to x86_64-unknown-linux-musl from "macOS Mojave", until I randomly try this small note from an article on AWS blog

On my system, some of the dependencies did not pick up the configured linker automatically and tried to use musl-gcc anyway. To get around this quickly, I simply created a symlink to the new linker:

$ ln -s /usr/local/bin/x86_64-linux-musl-gcc /usr/local/bin/musl-gcc

Now I can finally use FiloSottile/homebrew-musl-cross as expected, but without this symlink stuff, the ring dependency of rustls-tls failed to compile in my project.

I'd suggest to copy your previous comment in the README of this repository, because it seems like really important to know for ppl which just want to make things work quickly.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants