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

LIBCLANG_PATH hook #67725

Closed
wants to merge 3 commits into from
Closed

Conversation

matthewbauer
Copy link
Member

Rust’s clang-sys has a few ways to handle finding libclang:

libclang shared libraries will be searched for in the following directories:

the directory provided by the LIBCLANG_PATH environment variable
the bin and lib directories in the directory provided by llvm-config --libdir
the directories provided by LD_LIBRARY_PATH environment variable
a list of likely directories for the target platform (e.g., /usr/local/lib on Linux)
macOS only: the toolchain directory in the directory provided by xcode-select --print-path

The other methods don’t work. LLVM still does not support pkg-config,
llvm-config won’t have the libclang because we build clang and llvm
separately, and LD_LIBRARY_PATH shouldn’t be messed with.

More discussion here:

https://discourse.nixos.org/t/how-to-correctly-populate-a-clang-and-llvm-development-environment-using-nix-shell/3864/2

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

Rust’s clang-sys has a few ways to handle this:

> libclang shared libraries will be searched for in the following directories:

> the directory provided by the LIBCLANG_PATH environment variable
> the bin and lib directories in the directory provided by llvm-config --libdir
> the directories provided by LD_LIBRARY_PATH environment variable
> a list of likely directories for the target platform (e.g., /usr/local/lib on Linux)
> macOS only: the toolchain directory in the directory provided by xcode-select --print-path

The other methods don’t work. LLVM still does not support pkg-config,
llvm-config won’t have the libclang because we build clang and llvm
separately, and LD_LIBRARY_PATH shouldn’t be messed with.

More discussion here:

https://discourse.nixos.org/t/how-to-correctly-populate-a-clang-and-llvm-development-environment-using-nix-shell/3864/2
This is set by clang’s setup-hook.
@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/how-to-correctly-populate-a-clang-and-llvm-development-environment-using-nix-shell/3864/3

@mmahut
Copy link
Member

mmahut commented Aug 30, 2019

Can we please open this against staging given this is a mass rebuild?

@FRidh FRidh changed the base branch from master to staging April 8, 2020 12:28
@JJJollyjim
Copy link
Member

@matthewbauer I fixed the conflicts against staging: https://github.com/JJJollyjim/nixpkgs/tree/libclang-hook

@JJJollyjim JJJollyjim mentioned this pull request Apr 18, 2020
10 tasks
@matthewbauer
Copy link
Member Author

Closing in favor of #85489

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

Successfully merging this pull request may close these issues.

None yet

4 participants