Skip to content

Unable to find libclang when is installed and exists #2090

@latot

Description

@latot

Hi all, I'm new in pgrx thing, I was following the instructions for the hello world main project, but when was time to compile I failed, can't found libclang, but is installed and available:

   Compiling pgrx-pg-sys v0.14.3
error: failed to run custom build command for `pgrx-pg-sys v0.14.3`

Caused by:
  process didn't exit successfully: `/home/pipe/Documentos/test_pgrx/my_extension/target/debug/build/pgrx-pg-sys-d4edf94760dacee3/build-script-bindgen` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=PGRX_BUILD_VERBOSE
  cargo:rerun-if-env-changed=PGRX_PG_SYS_GENERATE_BINDINGS_FOR_RELEASE
  cargo:rerun-if-env-changed=PGRX_PG_CONFIG_PATH
  cargo:rerun-if-env-changed=PGRX_PG_CONFIG_AS_ENV
  cargo:rerun-if-env-changed=LLVM_CONFIG_PATH
  cargo:rerun-if-env-changed=LIBCLANG_PATH
  cargo:rerun-if-env-changed=LIBCLANG_STATIC_PATH
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=PGRX_PG_SYS_GENERATE_BINDINGS_FOR_RELEASE
  cargo:rerun-if-changed=include
  cargo:rerun-if-changed=pgrx-cshim.c
  cargo:rerun-if-changed=/home/pipe/.pgrx/config.toml
  cargo:rerun-if-env-changed=PGRX_TARGET_INFO_PATH_PG13_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PGRX_TARGET_INFO_PATH_PG13
  cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER_PG13_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER_PG13
  cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER
  cargo:rerun-if-env-changed=PGRX_BINDGEN_NO_DETECT_INCLUDES_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PGRX_BINDGEN_NO_DETECT_INCLUDES

  --- stderr
  build_paths=BuildPaths { manifest_dir: "/home/pipe/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-pg-sys-0.14.3", out_dir: "/home/pipe/Documentos/test_pgrx/my_extension/target/debug/build/pgrx-pg-sys-174df2eea8a085d1/out", src_dir: "/home/pipe/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-pg-sys-0.14.3/src/include", shim_src: "/home/pipe/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-pg-sys-0.14.3/pgrx-cshim.c", shim_dst: "/home/pipe/Documentos/test_pgrx/my_extension/target/debug/build/pgrx-pg-sys-174df2eea8a085d1/out/pgrx-cshim.c" }
  Generating bindings for pg13
  pg_config --configure CLANG = None
  pg_target_includes = ["/home/pipe/.pgrx/13.21/pgrx-install/include/postgresql/server/"]

  thread '<unnamed>' panicked at /home/pipe/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bindgen-0.71.1/lib.rs:604:27:
  Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  thread 'main' panicked at /home/pipe/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-bindgen-0.14.3/src/build.rs:271:41:
  thread panicked while generating bindings: Any { .. }

I have installed PG 16.9 and 17.5.

I use Gentoo x64, a very unusual system, here is where are the libs:

ldconfig -p | grep libclang
	libclang.so.19.1 (libc6,x86-64) => /usr/lib/llvm/19/lib64/libclang.so.19.1
	libclang.so.19.1 (libc6) => /usr/lib/llvm/19/lib/libclang.so.19.1
	libclang.so.18.1 (libc6,x86-64) => /usr/lib/llvm/18/lib64/libclang.so.18.1
	libclang.so.18.1 (libc6) => /usr/lib/llvm/18/lib/libclang.so.18.1
	libclang.so (libc6,x86-64) => /usr/lib/llvm/19/lib64/libclang.so
	libclang.so (libc6,x86-64) => /usr/lib/llvm/18/lib64/libclang.so
	libclang.so (libc6) => /usr/lib/llvm/19/lib/libclang.so
	libclang.so (libc6) => /usr/lib/llvm/18/lib/libclang.so
	libclang-cpp.so.19.1 (libc6,x86-64) => /usr/lib/llvm/19/lib64/libclang-cpp.so.19.1
	libclang-cpp.so.19.1 (libc6) => /usr/lib/llvm/19/lib/libclang-cpp.so.19.1
	libclang-cpp.so.18.1 (libc6,x86-64) => /usr/lib/llvm/18/lib64/libclang-cpp.so.18.1
	libclang-cpp.so.18.1 (libc6) => /usr/lib/llvm/18/lib/libclang-cpp.so.18.1
	libclang-cpp.so (libc6,x86-64) => /usr/lib/llvm/19/lib64/libclang-cpp.so
	libclang-cpp.so (libc6,x86-64) => /usr/lib/llvm/18/lib64/libclang-cpp.so
	libclang-cpp.so (libc6) => /usr/lib/llvm/19/lib/libclang-cpp.so
	libclang-cpp.so (libc6) => /usr/lib/llvm/18/lib/libclang-cpp.so

Thx!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions