How to overshadow a package from repository with another version? - pkg-config

I have a glib-2.0 2.36.0 package, installed from ubuntu repo. So now
pkg-config --modversion glib-2.0
Prints 2.36.0 Recently, I downloaded and built a fresh new version 2.40.0. I need it to build a Clutter, also downloaded manually. It requires glib version 2.37.3 at least.
How can I point out a custom pkgconfig directory, that is located in the glib binaries such, that --modversion will return 2.40.0?

The solution is PKG_CONFIG_PATH :
PKG_CONFIG_PATH="$PKG_CONFIG_PATH $HOME/frameworks/glib/lib/pkgconfig/" pkg-config --modversion glib-2.0
Gives the right result.

Related

macos llvm-symbolizer not found

I am trying to use address sanitization when calling my program with clang, however it doesn't seem to be installed. If I type which llvm-symbolizer I get llvm-symbolizer not found. I also checked under /usr/bin and /usr/local/bin and under the location where clang is installed /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin but still I can't find llvm-symbolizer (though there are other llvm-* executables in the last path).
Is there a way I can install this on macos? Also, I couldn't find it in brew. I am using clang built in macos: Apple clang version 12.0.0 (clang-1200.0.32.21).
My version of llvm-symbolizer was installed with Homebrew. You have to install llvm with brew install llvm to get it. It then shows up as:
% which llvm-symbolizer
/usr/local/Cellar/llvm/11.0.0/bin/llvm-symbolizer
By the way, some people may have installed llvm but not linked some binaries to path. The sure-fire way to add all llvm binaries to path is:
PATH="$PATH:$(brew --prefix)/opt/llvm/bin"
$(brew --prefix)/opt/llvm is a symbolic link to the most recent installed version of llvm, and bin is obviously the binaries therein.

Tell pkg-config where to find packages on windows

I want to use the Haskell ffmpeg library under windows so I tried to install it via cabal.
After downloading and extracting ffmpeg shared (64bit) version to C:\FFmpeg cabal complained that pkg-config was not installed.
I downloaded it and moved it to the bin folder of MinGw. Now cabal complains that it can not find the pkg-config package libavutil.
First part of the question:
What is a pkg-config package? Is it just the dll that comes with the shared version of ffmpeg?
Second part:
I know pkg-config uses .pc files to describe where to look for packages and it uses the PKG_CONFIG_PATH variable to find .pc files. So how would a .pc file look when the libavutil dll is located in C:\FFmpeg\bin?
PS: The dll in FFmpeg\bin is named avutil-55.dll
Thanks

Package libusb was not found in the pkg-config search path

I have installed pkg-config and libusb through brew
Now if I do
pkg-config --cflags --libs libusb
I get below message
Package libusb was not found in the pkg-config search path. Perhaps
you should add the directory containing `libusb.pc' to the
PKG_CONFIG_PATH environment variable No package 'libusb' found
So I followed this post and did
export
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/Cellar/libusb/1.0.20/lib/pkgconfig"
But I still have the problem. What am I missing?
I am using MAC OSX El Capitan
Just run:
pkg-config --cflags --libs /usr/local/Cellar/libusb/1.0.20/lib/pkgconfig/libusb-1.0.pc
I have the the same problem. This work for me (Ubuntu):
sudo apt-get install libmagickwand-dev
The problem appears to be that homebrew installs libusb with the -1.0 appended to the package and file names. So:
pkg-config --cflags --libs libusb-1.0
will find it, while:
pkg-config --cflags --libs libusb
won't. Since many ./configure and other scripts are looking for it without the -1.0 appended, they fail. To me, this looks like a bug in the homebrew package. Manually creating a non-1.0 named version worked for me, but it's not a very elegant solution.

Octave configure cannot find Qt library on OS X

I have installed QT 4.8 library on my OS X through direct install with .dmg file downloaded from qt-project.org. It seems a framework version. And so far, a lot of tools recognises it well. But when I am building octave on this computer, it gives a warning of "Qt libraries not found". I wonder why. And what can I do to make it recognise the qt lib on my machine.
The command I used for configure is
./configure --prefix=/usr/local --enable-shared F77=gfortran-4.2 LDFLAGS='-L/usr/local/lib'
(further information)
I did tried to find the installation of QT with
find find /Library/ -name QtGui
Returning result being
/Library//Frameworks/QtGui.framework/QtGui
/Library//Frameworks/QtGui.framework/Versions/4/Headers/QtGui
/Library//Frameworks/QtGui.framework/Versions/4/QtGui
Along with the fact that ipython notebook --matplotlib=qt is working well on my system, I assume my Qt Library is successfully installed.
But when performing the check with pkg-config, both pkg-config --cflag QtGui and pkg-config --libs QtGui return no positive result.
Make sure your Qt installation is working. I'll assume it was correctly installed and is visible to the operating system you're using.
The configure command you have pasted accepts two environment variables, QT_CFLAGS and QT_LIBS. Use the pkg-config tool to determine their appropriate values:
pkg-config --cflags QtGui
pkg-config --libs QtGui
and add this information to the command line:
./configure QT_CFLAGS='foo' QT_LIBS='bar' # other stuff...
I think I know the answer now. qt-4.8 installed through .dmg file is a framework version. There is no Qt*.pc file, thus is not able to be found by pkg-config. So, in order to use pkg-config to find qt installed in the system, you need to build qt from source(source downloadable from qt-project.org), specifying that a -no-framework version is to be built:
./configure -no-framework --foo --bar
make
sudo make install
After building and installing, qt would be located in(by default)
/usr/local/Trolltech/Qt-4.8.6/lib/pkgconfig/
Thus adding a line to ~/.bashrc
export PKG_CONFIG_PATH="/usr/local/Trolltech/Qt-4.8.6/lib/pkgconfig/:${PKG_CONFIG_PATH}"
would help pkg-config locating the qt in your system.
If you have installed QT by .run file, you might find pkgconfig folder. For me, I have installed QT to "/opt/qt5.15.x/" and I find this path "/opt/qt5.15.x/5.15.2/gcc_64/lib/pkgconfig". Referencing pkg-config-path-environment-variable, I add it to PKG_CONFIG_PATH by
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/qt5.15.x/5.15.2/gcc_64/lib/pkgconfig/
And then, Octave configure find QT. And it's better to check the .pc file in your pkgconfig folder. "prefix" in the .pc files might be wrong.

pkg-config and OSX 10.8, proper PKG_CONFIG_PATH? Missing .pc files?

I installed pkg-config with homebrew in OSX. I'm not sure what I should set my PKG_CONFIG_PATH to? Should it be a combination of /usr/include and /usr/local/include? Even if I use one or the other, I get an error about there not being any .pc files, which I take it would contain info used by pkg-config? Not sure what I'm doing wrong. Help appreciated.
$ pkg-config --libs libxml2
Package libxml2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml2' found
Update:
So maybe I'm asking two different questions. I just curled gsl and ran through the ./configure && make && sudo make install. And with an empty $PKG_CONFIG_PATH I actually got a hit with:
pkg-config --libs gsl
-L/usr/local/lib -lgsl -lgslcblas -lm
But listing /usr/local/lib shows the gsl libs but no .pc files. How come pkg-config works for custom installed packages in OSX but not default installed ones???
echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib" >> ~/.bashrc && source ~/.bashrc
to test with say glib:
brew install glib && pkg-config --libs --cflags glib-2.0
should get you the goods:
-I/usr/local/Cellar/glib/2.34.3/include/glib-2.0 -I/usr/local/Cellar/glib/2.34.3/lib/glib-2.0/include -I/usr/local/Cellar/gettext/0.18.2/include -L/usr/local/Cellar/glib/2.34.3/lib -L/usr/local/Cellar/gettext/0.18.2/lib -lglib-2.0 -lintl
I can't add a clarification comment to Nick's answer above, but that is the correct set of paths you need, I have tried with success using homebrew on osx 10.9.1.
If you want this to work with a GUI application such as an IDE, you need to add that path to /etc/launchd.conf.
See the following stack overflow comment:
Setting environment variables in OS X?

Resources