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

Restore the ability to build with clang on linux #4129

Closed
thufschmitt opened this issue Oct 9, 2020 · 3 comments · Fixed by #4996
Closed

Restore the ability to build with clang on linux #4129

thufschmitt opened this issue Oct 9, 2020 · 3 comments · Fixed by #4996
Assignees

Comments

@thufschmitt
Copy link
Member

Is your feature request related to a problem? Please describe.

Before the migration to a flake, the shell.nix file took a useClang argument that allowed to easily use clangStdenv rather than the default one. This argument doesn't exist anymore, and to the best of my knowledge, the only way to use clang is to patch the flake.nix file

Describe the solution you'd like

Restore a simple way to use clang rather than gcc for the build

Additional context

I guess adding back use useClang argument isn't possible (#3843 (comment)). Maybe it's possible to just add a new set of platforms (something like x86_64-linux-clang and friends) to the flake, but I'm not aware of anything on the nixpkgs side to handle that

@stale
Copy link

stale bot commented Apr 10, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Apr 10, 2021
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-fellowship-fuzzing-nix-1/13904/1

@stale stale bot removed the stale label Jul 2, 2021
@thufschmitt thufschmitt self-assigned this Jul 7, 2021
thufschmitt added a commit that referenced this issue Jul 8, 2021
For a (currently hardcoded and limited) list of stdenvs,
make `.#$nix-${stdenvName}` correspond to a Nix built with the
corresponding stdenv.

For example, `.#nix-${clang11Stdenv}` is Nix built with clang11.

Fix #4129

/cc @Pamplemousse
thufschmitt added a commit that referenced this issue Jul 8, 2021
For a (currently hardcoded and limited) list of stdenvs,
make `.#$nix-${stdenvName}` correspond to a Nix built with the
corresponding stdenv.

For example, `.#nix-${clang11Stdenv}` is Nix built with clang11.

Likewise, `devShell.x86_64-linux.clang11StdenvPackages` is a development
shell for Nix with clang11

Fix #4129

/cc @Pamplemousse
thufschmitt added a commit that referenced this issue Jul 8, 2021
For a (currently hardcoded and limited) list of stdenvs,
make `.#$nix-${stdenvName}` correspond to a Nix built with the
corresponding stdenv.

For example, `.#nix-${clang11Stdenv}` is Nix built with clang11.

Likewise, `devShell.x86_64-linux.clang11StdenvPackages` is a development
shell for Nix with clang11

Fix #4129

/cc @Pamplemousse
thufschmitt added a commit that referenced this issue Jul 13, 2021
For a (currently hardcoded and limited) list of stdenvs,
make `.#$nix-${stdenvName}` correspond to a Nix built with the
corresponding stdenv.

For example, `.#nix-${clang11Stdenv}` is Nix built with clang11.

Likewise, `devShell.x86_64-linux.clang11StdenvPackages` is a development
shell for Nix with clang11

Fix #4129

/cc @Pamplemousse
thufschmitt added a commit that referenced this issue Jul 29, 2021
For a (currently hardcoded and limited) list of stdenvs,
make `.#$nix-${stdenvName}` correspond to a Nix built with the
corresponding stdenv.

For example, `.#nix-${clang11Stdenv}` is Nix built with clang11.

Likewise, `devShell.x86_64-linux.clang11StdenvPackages` is a development
shell for Nix with clang11

Fix #4129

/cc @Pamplemousse
@fzakaria
Copy link
Contributor

fzakaria commented Nov 25, 2021

@regnat would love to see this as a switch back + documentation in the Hacking Docs.

I recently made local modifications to support Clang, that were fairly straightforward. I am not familiar enough with Flakes though to make it generic.
https://gist.github.com/fzakaria/00dafaec3b3f0864d136470bf6579099

Can flakes also add additional "build modes" ?
For instance, I did some work to add sanitiziers with Clang and they needed some modifications to the LDFLAGS (i.e. removing -z,-def and adding -fno-omit-frame-pointer.
https://gist.github.com/fzakaria/eab8d14695549ddefdf9ba09038016ad

thufschmitt added a commit that referenced this issue Nov 26, 2021
For a (currently hardcoded and limited) list of stdenvs,
make `.#$nix-${stdenvName}` correspond to a Nix built with the
corresponding stdenv.

For example, `.#nix-${clang11Stdenv}` is Nix built with clang11.

Likewise, `devShell.x86_64-linux.clang11StdenvPackages` is a development
shell for Nix with clang11

Fix #4129

/cc @Pamplemousse
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

Successfully merging a pull request may close this issue.

3 participants