-
Notifications
You must be signed in to change notification settings - Fork 448
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
Default musl compiler binary names are dodgy #105
Comments
Actually, could the name of the compiler used default to that in Cargo's |
Thanks for the report! In general all the compiler names used in this crate are dodgy as none of them are verified to exist, they're just hopefully a reasonable set of defaults. I've seen Also, it should be noted that these are just attempts at being reasonable defaults. That is, it's expected they're ~60% accurate which is better than the 0% accurate |
I'm hitting a similar issue. My project depends on flate2. Compiling with yields: Should a musl installation always be required if any dependent projects does a gcc compile? Or should the gcc crate & musl toolchain should handle this automatically? |
@pmarks ah yeah to compile code for musl you'll need |
@alexcrichton i tried initially without musl-gcc installed. After I installed musl-gcc it worked. It might be worth a disclaimer on the musl toolchain that musl-gcc is required if you have any dependencies w/ C code / build.rs steps. |
Certainly yeah! Makes sense to me |
Hi guys, what about musl-g++ ? I use clux/muslrust to cross-compile everything so far. But for muja/unrar.rs which depends on a c++ library I got the error, that must-g++ is not available. As far as I know, there is not special musl-g++ compiler... Just the gcc one. Has someone done something like this already? Thanks, |
I'm going to close this since the default binary names are basically always just best-effort. PRs to improve the logic are always welcome but otherwise it's typically common to have to configure the name anyway since there's so many names for C compilers. |
I ran into the exact same issue as @archseer when trying to cross-compile Tree-Sitter. See this for the solution. In my experience |
This should fix cross-compilation to musl when you haven't manually set the compiler name. See rust-lang#105 and https://github.com/FiloSottile/homebrew-musl-cross#:~:text=If%20you%20encounter%20issues
This should fix cross-compilation to musl when you haven't manually set the compiler name. It's also more consistent with the existing musl targets (e.g. mips). See rust-lang#105 and https://github.com/FiloSottile/homebrew-musl-cross#:~:text=If%20you%20encounter%20issues
An installation of musl does not supply a
musl-g++
, but this crate assumes that it exists for C++ code. This is a bit a of a quandry to solve. It also assumes things likemusl-gcc
exist, which isn't really true unless musl has been installed alongside glibc on an existing system as a system compiler - not a cross compiler. Since mostbuild.rs
scripts are often targeting a cross-compilation, rather than deployment on the host (especially so if--target
has been passed to cargo), using a reference to the system compiler seems wrong.A slightly better approach might be to support the names used by musl-cross-make, eg
x86_64-linux-musl-cc
. This allows installation of multiple copies of musl targeting gcc (or clang) at different architectures to co-exist. These names are also the ones available by default if installing musl-cross-make on Mac OS X using Homebrew (https://github.com/FiloSottile/homebrew-musl-cross/)Sadly, it's very difficult trying to overcome the mess of C compilation, and particularly C cross compilation using gcc, which doesn't understand how to compile for more than target. We're also trying to accommodate scenarios ranging from install and run locally to deployment. Personally, I'd make cross compilation my primary focus, and make local install and run secondary; that way, when cross compilation's sorted, local install should just work. This is the approach taken by most from-scratch toolchains and the like (eg Linux from Scratch).
The text was updated successfully, but these errors were encountered: