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

meson support for clang broken #39936

Closed
Ralith opened this issue May 3, 2018 · 11 comments
Closed

meson support for clang broken #39936

Ralith opened this issue May 3, 2018 · 11 comments
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@Ralith
Copy link
Contributor

Ralith commented May 3, 2018

meson's setup-hook.sh sets CC=@cc@/bin/cc CXX=@cc@/bin/c++, clobbering the values provided by the stdenv. This (silently?) breaks clangStdenv and, because gcc doesn't support -stdlib=libc++, noisily breaks libcxxStdenv.

This was introduced by 284f75a (cc @shlevy). Never having touched the crosscompilation infrastructure before, I'm not sure what the intended behavior here is, let alone the correct way to do it, but it probably shouldn't be forcing everything to use some arbitrary gcc.

@Ralith
Copy link
Contributor Author

Ralith commented May 3, 2018

On closer examination I see that what's happening is that the meson package hardcodes the stdenv it's built with, therefore breaking use targeting any other stdenv. Was this intended?

@shlevy
Copy link
Member

shlevy commented May 4, 2018

Not necessarily intended, but not sure the nicest solution either. Maybe a way to bundle meson with a particular stdenv? @Ericson2314 , thoughts?

@Ericson2314
Copy link
Member

Can we just not set those vars? The environment should already have them.

@shlevy
Copy link
Member

shlevy commented May 4, 2018

There was definitely a real case where this was needed (cross systemd maybe?) but I don't remember the symptoms.

@Ericson2314
Copy link
Member

I can't even find where cc is being set. https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/build-managers/meson/default.nix#L54-L70 I'd hope would help too.

Coincidentally I also opened mesonbuild/meson#3282, a while back, which I'm guessing would be a better solution to whatever prompted @shlevy to add those vars.

@Ralith
Copy link
Contributor Author

Ralith commented May 31, 2018

I assume cc is being set at https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/build-managers/meson/default.nix#L73 and substituted in by default somewhere.

@stale
Copy link

stale bot commented Jun 4, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 4, 2020
@Ericson2314
Copy link
Member

This was fixed in 3c00ca0#diff-6b138c4aaf5164baf820a221e2d6dd93 :)

@nh2
Copy link
Contributor

nh2 commented Jun 30, 2020

@Ericson2314 Thanks, that was sorely needed.

Fixes my non-cross C++ builds with Meson.

@L-as
Copy link
Member

L-as commented Jul 10, 2020

I can't seem to use overrideCC stdenv llvmPackages_10.lldClang as my stdenv still.
meson gives me this:

Using 'CC_FOR_BUILD' from environment with value: 'gcc'
Using 'AR_FOR_BUILD' from environment with value: 'ar'
Using 'CXX_FOR_BUILD' from environment with value: 'g++'

meson.build:21:0: ERROR: Compiler g++ can not compile programs.

@L-as
Copy link
Member

L-as commented Jul 10, 2020

Made a new issue, since it only seems to be mesa?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

No branches or pull requests

5 participants