Cannot find pkgconfig

3,382 views
Skip to first unread message

John

unread,
Mar 14, 2021, 8:23:26 PM3/14/21
to meson...@googlegroups.com
I built a library which a meson build depends upon, but apparently I am not linking to that dependency correctly.
The library is libclc, and has a file structure, as shown in the attached file.

I placed the pkgconfig path in PKG_CONFIG_PATH, but the meson build does not find it.
I tried setting --pkg-config-path and --build.pkg-config-path to hat path, but it still doesn't find the file.

I must not be doing something right.
How can I get the build to locate the dependency?
Run-time dependency libclc found: NO (tried pkgconfig and cmake)
meson.build:836:2: ERROR: Dependency "libclc" not found, tried pkgconfig and cmake
libclc-file-structure.md

Jeff

unread,
Mar 14, 2021, 9:50:02 PM3/14/21
to John, The Meson Build System
Check the output of meson-logs.txt

--
You received this message because you are subscribed to the Google Groups "The Meson Build System" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mesonbuild+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mesonbuild/CAPUEvW17YQPQbgm6Xp6aaYc7qhxTsE36rowAXSW%3Dvv%2Bd8WoVkA%40mail.gmail.com.

John Giles

unread,
Mar 14, 2021, 10:01:25 PM3/14/21
to The Meson Build System
What am I looking for?
Determining dependency 'libclc' with pkg-config executable '/usr/bin/pkg-config'
PKG_CONFIG_PATH: C:\libclc\usr\local\share\pkgconfig;E:\PATH_DIR\pkgconfig
Called `/usr/bin/pkg-config --modversion libclc` -> 1

CMake binary for MachineChoice.HOST is cached.
None of 'CMAKE_PREFIX_PATH' are defined in the environment, not changing global flags.
Preliminary CMake check failed. Aborting.
Run-time dependency libclc found: NO (tried pkgconfig and cmake)

meson.build:836:2: ERROR: Dependency "libclc" not found, tried pkgconfig and cmake

Jeff

unread,
Mar 14, 2021, 10:23:10 PM3/14/21
to John Giles, The Meson Build System
I think its some issue related to cmake:
Preliminary CMake check failed. Aborting.

John Giles

unread,
Mar 15, 2021, 12:10:07 AM3/15/21
to The Meson Build System
I'm certainly no expert at this, but I didn't think cmake would be the problem, since it's not a cmake build, and meson is trying to locate a library by searching the pkgconfig path, and if not found, then looking to see if it can find the library in the cmake prefix path..
meson.build:836:2: ERROR: Dependency "libclc" not found, tried pkgconfig and cmake  
I was thinking the problem is with failing to locate the library.
However,  I also am wondering, why does it not 'see' the library in the path specified.
So I was thinking there is something I am missing there. Perhaps something I failed to do.

I tried to organize the log file to make it readable, and I notice a complaint is there about not finding a fortran compiler for CMake, and I know I did not include that package in Cygwin.
There are a few other things I noticed associated with cmake, so it's possible you may be right.

However, I am wondering if it's not using the pkgconfig path in the environment, because it maybe defaults to usr/bin... and requires the files to be in this path, but I really want to avoid manually copying to that path, so as to keep it tidy.
Pkg-config binary for MachineChoice.HOST is not cached.
None of 'PKG_CONFIG' are defined in the environment, not changing global flags.
Pkg-config binary missing from cross or native file, or env var undefined.

Would you mind looking through the log, and see if there is anything there that might reveal the real cause of the problem?
I'll include it as an attachment. Meanwhile, I will install the  package for the  fortran compiler. 

meson-log.txt
Message has been deleted

John Giles

unread,
Mar 15, 2021, 12:58:26 AM3/15/21
to The Meson Build System
Here is a better log file.
meson-log.md

Jeff

unread,
Mar 15, 2021, 1:40:08 AM3/15/21
to John Giles, The Meson Build System
I suggest to try calling this command from commandline manually:
/usr/bin/pkg-config --modversion libclc
Maybe its returning an error code?


Dan Kegel

unread,
Mar 15, 2021, 1:59:03 AM3/15/21
to Jeff, John Giles, The Meson Build System
Also, what environment is this, and which meson, what OS are you targeting, and why are you building an opencl support library yourself?



John Giles

unread,
Mar 15, 2021, 2:02:20 AM3/15/21
to The Meson Build System
Yes, as I would expect if it's not using the pkgconfig path.
$ pkg-config --modversion libclc
Package libclc was not found in the pkg-config search path.
Perhaps you should add the directory containing `libclc.pc' to the PKG_CONFIG_PATH environment variable
Package 'libclc', required by 'virtual:world', not found

However, it found by the system.
C:\WINDOWS\system32>pkg-config --modversion libclc
0.2.0

John Giles

unread,
Mar 15, 2021, 10:59:25 AM3/15/21
to The Meson Build System
Okay. I found the answer here.

The message above references the PKG_CONFIG_PATH environment variable. This variable is used to augment pkg-config's search path. On a typical Unix system, it will search in the directories /usr/lib/pkgconfig and /usr/share/pkgconfig. This will usually cover system installed modules. However, some local modules may be installed in a different prefix such as /usr/local. In that case, it's necessary to prepend the search path so that pkg-config can locate the .pc files.

$ pkg-config --modversion hello 
Package hello was not found in the pkg-config search path. 
Perhaps you should add the directory containing `hello.pc' to the PKG_CONFIG_PATH environment variable 
No package 'hello' found 
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 
$ pkg-config --modversion hello 
1.0.0  

It should work now. I'll check and see.
Yes. It works fine now.
Run-time dependency libclc found: YES 0.2.0
Program python3 found: YES (/usr/bin/python3)
Fetching value of define "ETIME" : 62

Jeff

unread,
Mar 17, 2021, 6:50:11 PM3/17/21
to The Meson Build System
Hi,
I'm trying to compile on mac OS, using xcode backend.
For some reason it's choosing target arm64-apple-macos11.1 even though my PC has an intel CPU.
Please advise.
Thanks,
Jeff

Jeff

unread,
Mar 17, 2021, 7:00:11 PM3/17/21
to The Meson Build System
Meson recognizes the right CPU type, so I think it's an incompatibility with latest xcode.

Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: x86_64
Host machine cpu: x86_64
Target machine cpu family: x86_64
Target machine cpu: x86_64

XCode wants to build for all architectures
Reply all
Reply to author
Forward
0 new messages