llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.34k stars 11.7k forks source link

Support for pkg-config #9777

Open c1f2da5c-3510-4ef9-b7bb-24e698b33024 opened 13 years ago

c1f2da5c-3510-4ef9-b7bb-24e698b33024 commented 13 years ago
Bugzilla Link 9405
Version 2.8
OS All
CC @sylvestre

Extended Description

I would very like to have support for the pkg-config tool, since that is directly supported by Haskell's build system Cabal.

c1f2da5c-3510-4ef9-b7bb-24e698b33024 commented 10 years ago

I have written a Haskell program that performs almost the same as the given shell script: http://hackage.haskell.org/package/llvm-pkg-config

You may install it with $ cabal install llvm-pkg-config

c1f2da5c-3510-4ef9-b7bb-24e698b33024 commented 10 years ago

I came up with the following bash script that writes a pc file to stdout. The pc file addresses the LLVM shared object.

$ cat make-pkg-config.sh version=$(llvm-config --version)

echo Name: LLVM echo Description: Low-level Virtual Machine compiler framework

We keep the initial numeric part of a version number.

I.e. a suffix like 'svn' or 'rc' will be removed.

This way Cabal can match on version ranges.

echo Version: $(echo ${version} | sed 's/([0-9.]+).*/\1/') echo URL: http://www.llvm.org/ echo Requires: echo Conflicts: echo Libs: -L$(llvm-config --libdir) -lLLVM-${version} echo Cflags: -I$(llvm-config --includedir)

llvmbot commented 10 years ago

Is there no .pc file because there is no interest from the developpers or is it because no one volonteered to do it? In the latter case, I'll do it there is an interest to merge it in the source tree.

illiliti commented 2 years ago

Hello? Are devs still interested in supporting pkg-config or it's dead end?

tristan957 commented 1 year ago

I think this is the right place to discuss this.

I am currently using libclang + Meson. I use libclang with the compile_commands.json that Meson generates (Awesome stuff by the way!), but I continually get errors parsing code about standard library headers not being found (fatal error: 'stdbool.h' file not found). After discovery, I have found that these headers are located in /usr/lib64/clang/14.0.5/include on my system, but for some reason libclang doesn't have this path in its automatic includes.

Yesterday I discovered that if one is using CMake to get access to libclang, libclang provides a CLANG_INCLUDE_DIRS macro which includes the aforementioned path.

It would be great if libclang could provide a pkg-config file that exposes this parameter in a build-system agnostic way.

Otherwise, I am stuck trying to parse the path from clang -Wp,-v -x c /dev/null -fsyntax-only, unless someone knows of a different way to access this path.

tristan957 commented 1 year ago

Apparently CLANG_INCLUDE_DIRS is not what I want, what the hell...

tstellar commented 1 year ago

This also came up here: #58984.