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 [updated] #85489

Closed
wants to merge 3 commits into from
Closed

Conversation

JJJollyjim
Copy link
Member

@JJJollyjim JJJollyjim commented Apr 18, 2020

Motivation for this change

This is #67725 rebased against current staging, posting it as a separate pull request to trigger an ofborg eval.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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.

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.
@@ -40,6 +40,7 @@ in rustPlatform.buildRustPackage rec {
'';

nativeBuildInputs = [ pkgconfig clang ];
bulidInputs = [ libclang ];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be buildInputs?

@stale
Copy link

stale bot commented Jun 9, 2021

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

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 9, 2021
@bjornfor
Copy link
Contributor

What's the status? Was it just forgotten?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 23, 2021
@kvark
Copy link
Contributor

kvark commented Jan 13, 2022

@JJJollyjim could you resolve merge conflicts? The fix is very much needed, still.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 31, 2022
@winterqt
Copy link
Member

This was added (via an opt-in setup hook) in #159899, closing.

@winterqt winterqt closed this Jul 31, 2022
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

7 participants