Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
3
votes
1
answers
2902
views
How do you specify the pkg-config path when compiling something with cmake?
I want to build ffmpeg with support for the av1 codec on CentOS 7. I start by following the instructions [here][1]: git clone https://aomedia.googlesource.com/aom mkdir aom_build cd aom_build cmake ../aom make sudo make install This writes a file to `/usr/local/lib64/pkgconfig/aom.pc`. When I later...
I want to build ffmpeg with support for the av1 codec on CentOS 7.
I start by following the instructions here :
git clone https://aomedia.googlesource.com/aom
mkdir aom_build
cd aom_build
cmake ../aom
make
sudo make install
This writes a file to
/usr/local/lib64/pkgconfig/aom.pc
.
When I later clone ffmpeg's git repo and try to run ./configure --enable-libaom ...
, it complains that pkg-config can't find the aom.pc file.
This is because if I run pkg-config --variable pc_path pkg-config
, I can see that pkg-config only checks here:
/usr/lib64/pkgconfig:/usr/share/pkgconfig
It doesn't look in /usr/local/lib64/pkgconfig
, where aom.pc is.
So far, the only fix I've come up with is to run this instead in ffmpeg's git directory:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH/usr/local/lib64/pkgconfig: ./configure --enable-libaom ...
This works, but I'd rather just tell libaom to write aom.pc to /usr/lib64/pkgconfig in the first place.
Is there any way, when building aom, to tell cmake or make to write the aom.pc file to /usr/lib64/pkgconfig instead of /usr/local/lib64/pkgconfig?
In other projects that have a ./configure
step, I've seen it possible to specify this with ./configure --pkgconfigdir=/usr/lib64/pkgconfig
, but the aom project doesn't have a ./configure
script, so I'm not sure what to do here.
Tal
(2252 rep)
Apr 24, 2019, 02:52 PM
• Last activity: Jul 28, 2025, 12:07 AM
6
votes
3
answers
3233
views
Rustup-installed Rust on Fedora: Unable to find Libudev.pc
I'm trying to build a rust app on fedora within a rustup environment that depends on libudev. At the moment I get the error when trying to compile the app with `cargo build --release`: ``` error: failed to run custom build command for `libudev-sys v0.1.4` Caused by: process didn't exit successfully:...
I'm trying to build a rust app on fedora within a rustup environment that depends on libudev. At the moment I get the error when trying to compile the app with
cargo build --release
:
error: failed to run custom build command for libudev-sys v0.1.4
Caused by:
process didn't exit successfully: /home/me/myApp/target/release/build/libudev-sys-7d615f10fc24f9b2/build-script-build
(exit status: 101)
--- stdout
cargo:rerun-if-env-changed=LIBUDEV_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=LIBUDEV_STATIC
cargo:rerun-if-env-changed=LIBUDEV_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
thread 'main' panicked at 'called Result::unwrap()
on an Err
value: "\"pkg-config\" \"--libs\" \"--cflags\" \"libudev\"
did not exit successfully: exit status: 1\n--- stderr\nPackage libudev was not found in the pkg-config search path.\nPerhaps you should add the directory containing `libudev.pc'\nto the PKG_CONFIG_PATH environment variable\nPackage 'libudev', required by 'virtual:world', not found\n"', /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/libudev-sys-0.1.4/build.rs:38:41
In the past things worked fine on ubuntu (or any debian-based, using the system rust install not rustup) after doing sudo apt install libudev1 && sudo apt install libudev-dev
.
So far, I've tried or considered:
- looking at the advice in https://unix.stackexchange.com/questions/715215/unable-to-find-libudev-pc , most of that advice was particular to someone's homebrew / linuxbrew setup while this question is specific to Fedora with a Rustup installed rust environment.
- Tried updating my PKG_CONFIG_PATH
and checking things with PKG_CONFIG
, specifically:
1. See where the libraries are via yum provides */libudev.pc
, which reveals Filename : /usr/lib/pkgconfig/libudev.pc
& Filename : /usr/lib64/pkgconfig/libudev.pc
2. Add the lib folders to PKG_CONFIG_PATH
in my .bashrc
: PKG_CONFIG_PATH=$PATH:/usr/lib/pkgconfig/:/usr/lib64/pkgconfig
3. Start a new shell, run pkg-config --libs --cflags libudev
, which still gives an error
Package libudev was not found in the pkg-config search path.
Perhaps you should add the directory containing `libudev.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libudev', required by 'virtual:world', not found
4. Running pkg-config --variable pc_path pkg-config
shows /usr/lib64/pkgconfig:/usr/share/pkgconfig
- considered doing sudo dnf install libudev
, but hesitate since I'm using a rustup environment instead and installing that triggers installing the fedora system version of rust too.
Vivek Gani
(233 rep)
Nov 7, 2022, 05:48 PM
• Last activity: Apr 15, 2025, 06:42 PM
1
votes
2
answers
1488
views
How does pkg-config work in RPM specfiles?
In some RPM specfiles, I see lines like: BuildRequires: pkgconfig(ice) BuildRequires: pkgconfig(libnotify) BuildRequires: pkgconfig(libssl) ... I am not very familiar with pkgconfig but I understand that some installed libraries have a corresponding `.pc` file which describes them. I have 2 question...
In some RPM specfiles, I see lines like:
BuildRequires: pkgconfig(ice)
BuildRequires: pkgconfig(libnotify)
BuildRequires: pkgconfig(libssl)
...
I am not very familiar with pkgconfig but I understand that some installed libraries have a corresponding
.pc
file which describes them. I have 2 questions:
1. Is this only used for dynamic libraries?
2. How does RPM handle the above in a situation where ice, libnotify, and libssl are NOT found on the system currently or where they are found but there is no corresponding .pc
file?
the_endian
(414 rep)
Jun 12, 2020, 07:21 AM
• Last activity: Oct 28, 2024, 03:42 PM
2
votes
1
answers
1136
views
How to write a file PkgConfig.pc file that supports both static and shared linking
I am writing a little library as a self challenge. I plan to target Linux based systems. I want to add a `libname.pc` file so as to add support for `PkgConfig`. Here, is my current file: ``` prefix=/usr/local exec_prefix=${prefix} cphoton_directory=cphoton-0.0 include_directory=${prefix}/include/${c...
I am writing a little library as a self challenge. I plan to target Linux based systems.
I want to add a
libname.pc
file so as to add support for PkgConfig
.
Here, is my current file:
prefix=/usr/local
exec_prefix=${prefix}
cphoton_directory=cphoton-0.0
include_directory=${prefix}/include/${cphoton_directory}
library_directory=${exec_prefix}/lib
Name: cphoton-0.0
Description: CPhoton is a basic utility library.
Version: 0.0.0
URL: https://gitlab.com/invitron/cphoton
Cflags: -I${include_directory}
Libs: -L${library_directory} -lcphoton-0.0
Libs.private:
I wanted to know if this is compatible for both static and dynamic libs. I tried to use pkg-config with --static
flag but, it seems to give precedence to .so
lib. I also tested it with cmake. It links statically only if the dynamic lib is not available.
Is it possible or will I have to provide a separate .pc
file for static version?
Already visited:
- https://stackoverflow.com/questions/27586503/how-to-use-pkg-config-to-link-a-library-statically
- https://people.freedesktop.org/~dbn/pkg-config-guide.html
Mansoor Ahmed Memon
(138 rep)
Dec 5, 2020, 04:46 PM
• Last activity: Jun 9, 2024, 08:09 PM
0
votes
1
answers
284
views
When/why doesn't pkg-config return library link-path?
I want to make use of `pkg-config` in my _Makefile_ to find the link-path for _libspa-0.2_. I observe that `pkg-config --libs libspa-0.2` returns nothing. For simplicity, I'll demonstrate the problem by running `pkg-config` straight from the shell, i.e. not from within my _Makefile_. ``` $ uname -a...
I want to make use of
pkg-config
in my _Makefile_ to find the link-path for _libspa-0.2_.
I observe that pkg-config --libs libspa-0.2
returns nothing.
For simplicity, I'll demonstrate the problem by running pkg-config
straight from the shell, i.e. not from within my _Makefile_.
$ uname -a
Linux MY_LINUX_PC 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$
$ sudo apt-get install -y libspa-0.2-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
libwebrtc-audio-processing1
Use 'sudo apt autoremove' to remove it.
Suggested packages:
pipewire-doc
The following NEW packages will be installed:
libspa-0.2-dev
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B/81.7 kB of archives.
After this operation, 625 kB of additional disk space will be used.
Selecting previously unselected package libspa-0.2-dev:amd64.
(Reading database ... 34966 files and directories currently installed.)
Preparing to unpack .../libspa-0.2-dev_0.3.48-1ubuntu3_amd64.deb ...
Unpacking libspa-0.2-dev:amd64 (0.3.48-1ubuntu3) ...
Setting up libspa-0.2-dev:amd64 (0.3.48-1ubuntu3) ...
$
$ pkg-config --libs libspa-0.2
$
Oddly, pkg-config
behaves as expected when asked to report _libspa-0.2_'s cflags:
$ pkg-config --cflags libspa-0.2
-D_REENTRANT -I/usr/include/spa-0.2
$
This is the content of _libspa-0.2.pc_:
$ cat /usr/lib/x86_64-linux-gnu/pkgconfig/libspa-0.2.pc
prefix=/usr
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include
plugindir=${libdir}/spa-0.2
Name: libspa
Description: Simple Plugin API
Version: 0.2
Cflags: -I${includedir}/spa-0.2 -D_REENTRANT
$
...so I was expecting pkg-config --libs libspa-0.2
to return something along the lines of /usr/lib/x86_64-linux-gnu
.
**Why does pkg-config --libs libspa-0.2
return an empty string?**
I'd be grateful if a knowledgeable answerer can describe a little about the relationship between pkg-config
, apt-get
, and the content of the respective .pc
files.
I would like to understand the problem/observed behavior specifically with respect to _libspa-0.2-dev_, but if there is a generalization, I'd like to learn that as well.
---
**Update**: this is weird -- it looks like pkg-config
is doing some (intelligent) formatting/stripping of content for the library link-paths. This is the content of _zlib.pc_ -- something preinstalled (which should rule out my messing up):
$ cat /usr/lib/x86_64-linux-gnu/pkgconfig/zlib.pc
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib/x86_64-linux-gnu
sharedlibdir=${libdir}
includedir=${prefix}/include
Name: zlib
Description: zlib compression library
Version: 1.2.11
Requires:
Libs: -L${libdir} -L${sharedlibdir} -lz
Cflags: -I${includedir}
$
...and this this what pkg-config
reports for its library link paths:
$ pkg-config --libs zlib
-lz
$
...i.e. it seems to be stripping out the -L${libdir} -L${sharedlibdir}
part.
At least the behavior is consistent...which maybe implies this isn't a "problem" but defined behavior of pkg-config
. But I can't figure out the rationale of why it's behaving this way: when and why does it strip out the library link-paths, i.e. -L
content?
StoneThrow
(1937 rep)
Dec 8, 2023, 08:24 PM
• Last activity: Dec 12, 2023, 02:45 PM
1
votes
1
answers
1486
views
libudev not found in pkg-config search path in GitHub actions ubuntu-latest environment
I'm setting up CI for a Rust application I'm developing that (indirectly) depends on the `libudev-sys` crate. Part of this CI means building my crate, which means also building `libudev-sys`. When the workflow runs and it gets to the build stage, cargo fails with this error message while attempting...
I'm setting up CI for a Rust application I'm developing that (indirectly) depends on the
libudev-sys
crate. Part of this CI means building my crate, which means also building libudev-sys
.
When the workflow runs and it gets to the build stage, cargo fails with this error message while attempting to build libudev-sys
:
thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libudev-sys-0.1.4/build.rs:38:41:
called Result::unwrap()
on an Err
value:
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" PKG_CONFIG_ALLOW_SYSTEM_LIBS="1" "pkg-config" "--libs" "--cflags" "libudev"
did not exit successfully: exit status: 1
error: could not find system library 'libudev' required by the 'libudev-sys' crate
Package libudev was not found in the pkg-config search path.
Perhaps you should add the directory containing `libudev.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libudev' found
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
I'm struggling to debug this because every change requires committing and pushing to the repo and then waiting for the workflow to run. This is not an error encountered on my own system.
According to this page about the ubuntu-latest environment , systemd
is installed (which provides libudev
), as well as pkg-config
from apt
(so [this answer] in a related question doesn't apply).
I have tried installing systemd
with sudo apt-get update
and sudo apt-get install systemd
, but that shows that systemd
is already installed. I also tried updating the PKG_CONFIG_PATH
as per this answer , but this did not work either.
Zoe
(41 rep)
Nov 18, 2023, 02:04 AM
• Last activity: Nov 18, 2023, 02:24 AM
0
votes
1
answers
1383
views
pkg-config cannot find any libraries without manual intervention
I am not a C++ developer or typically work with Conan, CMake, or Makefiles. The first time I had heard of `pkg-config` was yesterday when conan started erroring on it, unable to resolve a `gl` package. I managed to get it working with `export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig"`. T...
I am not a C++ developer or typically work with Conan, CMake, or Makefiles. The first time I had heard of
pkg-config
was yesterday when conan started erroring on it, unable to resolve a gl
package.
I managed to get it working with export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig"
.
Today, I tried to build spotify_player
with cargo
and it failed, unable to find the alsa
library:
--- stderr
thread 'main' panicked at 'PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" PKG_CONFIG_ALLOW_SYSTEM_LIBS="1" "pkg-config" "--libs" "--cflags" "alsa"
did not exit successfully: exit status: 1
error: could not find system library 'alsa' required by the 'alsa-sys' crate
--- stderr
Package alsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `alsa.pc'
to the PKG_CONFIG_PATH environment variable
No package 'alsa' found
', /home/xevion/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alsa-sys-0.3.1/build.rs:13:18
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
I looked around and found alsa.pc
at /usr/lib/x86_64-linux-gnu/pkgconfig/alsa.pc
. Exporting the variable in the exact same fashion as above fixes it.
That said, while it works - something is wrong. I was able to build and install spotify_sound
in the exact same way as before a couple months ago. Nothing should have changed.
- I've reinstalled all associated libraries with alsa
, as well as pkg-config
.
- I'm working in a new terminal session.
- I've confirmed that pkg-config
isn't finding it with pkg-config --debug alsa
.
- Running Pop!_OS 22.04 LTS (Ubuntu 22.04) on a Lenovo ThinkPad X1 Carbon Gen 6.
.pc
files can be found all over my computer - exporting in my .bashrc
seems like a blockhead solution - something is happening on a greater level.
How do I fix pkg-config
on my machine?
Xevion
(103 rep)
Sep 26, 2023, 07:48 PM
• Last activity: Oct 27, 2023, 03:59 PM
0
votes
0
answers
63
views
So i havent upgraded my PopOS 21.04 in a while and i keep getting this error message when trying to upgrade
``dpkg: error processing archive /var/cache/apt/archives/libxpm4_1%3a3.5.12-1_amd64.deb (--unpack): trying to overwrite shared '/usr/share/doc/libxpm4/changelog.Debian.gz', which is different from other instances of package libxpm4:amd64 Errors were encountered while processing: /var/cache/apt/archi...
`
dpkg: error processing archive /var/cache/apt/archives/libxpm4_1%3a3.5.12-1_amd64.deb (--unpack): trying to overwrite shared '/usr/share/doc/libxpm4/changelog.Debian.gz', which is different from other instances of package libxpm4:amd64 Errors were encountered while processing: /var/cache/apt/archives/libxpm4_1%3a3.5.12-1_amd64.deb
`
I have tried:
`sudo mv /usr/share/doc/libxpm4/changelog.Debian.gz $HOME
` Although this seems to be kinda working as it momentarily fixes my upgrade although I need to keep typing this with the new package it tells me to move to $HOME
I also tried sudo apt-get --fix-broken install and reconfiguring dpkg but I still have the same issue.
SudoCrypted
(13 rep)
Jun 15, 2022, 06:35 AM
• Last activity: Jun 15, 2022, 08:56 AM
7
votes
4
answers
9469
views
"configure: error: Package requirements (blkid) were not met"
I'm trying to build btrfs-progs from sources, but when I run ./configure I get the error: checking for BLKID... no configure: error: Package requirements (blkid) were not met: No package 'blkid' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-stan...
I'm trying to build btrfs-progs from sources, but when I run ./configure I get the error:
checking for BLKID... no
configure: error: Package requirements (blkid) were not met:
No package 'blkid' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables BLKID_CFLAGS
and BLKID_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
blkid
is installed in /sbin
so, presumably, all its libraries are in the default locations.
What do I need to do tell pkg-config where blkid
is or am I actually missing a package?
FYI: I'm running Debian 8 (sid/unstable) with a 4.1.0 kernel built from github.com/torvalds/linux.git sources about a week ago (commit:g6aaf0da).
StarNamer
(3232 rep)
Jul 12, 2015, 12:04 PM
• Last activity: Dec 25, 2021, 02:04 AM
5
votes
1
answers
427
views
How to get the build procedure for a Debian package?
I want to build a version of some software that is more recent than the one that is currently available as a stable release Debian package. To do this, however, other than using a more recent version of the source code, I would like to follow, as closely as possible, the build procedure that was use...
I want to build a version of some software that is more recent than the one that is currently available as a stable release Debian package.
To do this, however, other than using a more recent version of the source code, I would like to follow, as closely as possible, the build procedure that was used to build the Debian package for this software in the stable release.
At the very least, I would like to specify the same configuration flags and the same values for relevant environment variables during the build as was done for the stable release Debian package for this software.
**Q:** How can I find the build procedure for a specific (stable release) Debian package?
kjo
(16299 rep)
Dec 11, 2021, 11:47 AM
• Last activity: Dec 11, 2021, 03:48 PM
9
votes
1
answers
8385
views
Installing openssl on R
I'm trying to install openssl inside R, using `install.packages('openssl')`, but I'm getting an error message: * installing *source* package ‘openssl’ ... ** package ‘openssl’ successfully unpacked and MD5 sums checked Found pkg-config cflags and libs! Using PKG_CFLAGS= Using PKG_LIBS=-lssl -lcrypto...
I'm trying to install openssl inside R, using
install.packages('openssl')
, but I'm getting an error message:
* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-lssl -lcrypto -ldl -lz
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing:
* deb: libssl-dev (Debian, Ubuntu, etc)
* rpm: openssl-devel (Fedora, CentOS, RHEL)
* csw: libssl_dev (Solaris)
* brew: openssl (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘openssl’
* removing ‘/usr/local/lib64/R/library/openssl’
Openssl seems to be installed on the system:
$ openssl version -a
OpenSSL 1.0.2f 28 Jan 2016
built on: reproducible build, date unspecified
platform: linux-x86_64
options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx)
compiler: gcc44 -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/usr/local/bin/miniconda2/ssl"
I have tried to set PKG_CONFIG_PATH
to where **openssl.pc** is located but with no luck.
Some help would be much appreciated!
I'm running SUSE11 SP2
rlbc
(91 rep)
Mar 18, 2016, 07:55 PM
• Last activity: Sep 27, 2021, 01:02 PM
6
votes
3
answers
2968
views
How do I build PKGCONF and LIBFFI and subsequently Python3.9 with ctypes support without sudo and write access to /usr/local?
How do I properly configure `pkgconf` and `libffi` to allow the `python3` build process to correctly use my `libffi` version at every step of the build process, in order to import the `_ctypes` module correctly? Which piece am I missing here? #### Some background I am trying to build Python3 from so...
How do I properly configure
pkgconf
and libffi
to allow the python3
build process to correctly use my libffi
version at every step of the build process, in order to import the _ctypes
module correctly? Which piece am I missing here?
#### Some background
I am trying to build Python3 from source to build a GUI with PyQt5, and one of the requirements is a functional libffi-dev library. I don't have sudo permission on this SLES11 machine or write access to the typical library directory, nor are those likely to be granted. I reached out to the team who manages the machines, but they were unwilling to update the whole system set of libraries for my project. I have to resort to building ~30 dependencies from source, and I have little experience in this, but I'm familiar with the configure-->make-->install process. I'm stuck on one final piece of the process (failure to import the _ctypes module), which can be traced back to a missing symbol from the FFI library.
*** WARNING: renaming "_ctypes" since importing it failed:
build/lib.linux-x86_64-3.9/_ctypes.cpython-39-x86_64-linux-gnu.so:
undefined symbol: ffi_prep_cif
The libffi library built and installed without any issues, and I can see the files in the local library path, so I have reached the conclusion that there is either a mismatch between the libffi version and another dependency, or pkgconf is unable to locate the library. Based on my observations of the behavior of pkgconf when isolated and instructed to validate the libffi.so
file, it is most likely the latter. But, I am virtually a complete novice with this, I've been at this whole build for about a week now, and I'm here typing this question, so I'm clearly open to hearing some other ideas!
**Some useful debug**
pkgconf --version 1.7.3 https://distfiles.dereferenced.org/pkgconf/pkgconf-1.7.3.tar.gz
libffi 3.3 ftp://sourceware.org/pub/libffi/libffi-3.3.tar.gz
Python 3.9.1 https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
I provided the options to specify a local library directory while making the pkgconf source
./configure --prefix=$HOME/LIBRARIES/--with-system-libdir=$HOME/LIBRARIES/lib:$HOME/LIBRARIES/lib64:/usr/lib:/lib --with-system-includedir=$HOME/LIBRARIES/include:/usr/include
My PKG_CONFIG
, PKG_CONFIG_PATH
, LD_LIBRARY_PATH
, LDFLAGS
, and PATH
are updated to reflect where the libffi pc
files and pkgconf files are located
$ echo $PKG_CONFIG
$HOME/LIBRARIES/bin/pkgconf
$ echo $PKG_CONFIG_PATH
$HOME/LIBRARIES/lib/pkgconfig:$HOME/LIBRARIES/lib64/pkgconfig
$ echo $LD_LIBRARY_PATH
$HOME/LIBRARIES/lib:$HOME/LIBRARIES/lib64
$ echo $LDFLAGS
-L$HOME/LIBRARIES/lib64/ -L$HOME/LIBRARIES/lib
$ echo $PATH
$HOME//LIBRARIES/bin:/usr/local/bin:/usr/bin
$ ls $HOME/LIBRARIES/lib64/libff*
libffi.a libffi.la libffi.so libffi.so.7 libffi.so.7.1.0
**AND YET**
pkgconf --validate
validation of the library appears to fail, and the Python3 make script notes the undefined symbol. I'm more concerned about the make script; I'm not sure whether pkgconf is actually supposed to error out here.
*Update here:* the library is valid according to pkgconf, so this rules out that suspicion. Thank you, telcoM
pkgconf --validate libffi
$HOME/LIBRARIES/lib/pkgconfig/libffi.pc:9
Adding the configure command for Python3 for clarity
./configure --prefix=$HOME/LIBRARIES --enable-shared --with-system-ffi=$HOME/LIBRARIES/lib
szofar
(63 rep)
Jan 30, 2021, 01:08 AM
• Last activity: Sep 5, 2021, 08:13 PM
2
votes
1
answers
2250
views
Why are the pkg-config commands in the makefile not being recognized when I run the script?
I am trying to run make for an open-source project on my Debian virtual machine but I do not understand why the commands based on `pkg-config` are not being recognized. One of the commands is as follows: tempgui-qrps.so: tempgui-qrps.cc refpersys.hh tempgui-qrps.hh tempgui-qrps.moc.hh | $(RPS_CORE_O...
I am trying to run make for an open-source project on my Debian virtual machine but I do not understand why the commands based on
pkg-config
are not being recognized.
One of the commands is as follows:
tempgui-qrps.so: tempgui-qrps.cc refpersys.hh tempgui-qrps.hh tempgui-qrps.moc.hh | $(RPS_CORE_OBJECTS)
$(RPS_BUILD_CXX) $(RPS_BUILD_COMPILER_FLAGS) \
-shared -o $@ -fPIC -Wall -Wextra -O -g \
$(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets $(RPS_PKG_NAMES)) \
$(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets $(RPS_PKG_NAMES)) \
-std=gnu++17 \
$<
When I run make on the command line, the output corresponding to the above command looks like this:
g++ -std=gnu++17 \
-shared -o tempgui-qrps.so -fPIC -Wall -Wextra -O -g \
\
\
-std=gnu++17 \
tempgui-qrps.cc
When I run the make command, I also see these warnings:
Package readline was not found in the pkg-config search path.
Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable
No package 'readline' found
Package zlib was not found in the pkg-config search path.
Perhaps you should add the directory containing `zlib.pc'
to the PKG_CONFIG_PATH environment variable
No package 'zlib' found
Are both these problems (absence of packages and the pkg-config
commands not being processed) related?
Some of the details of pkg-config
installed on my system are as follows:
xxxxx@xxxx:~$ pkg-config --version
0.29
xxxx@xxxx:~$ whereis pkg-config
pkg-config: /usr/bin/pkg-config /usr/lib/pkg-config.multiarch /usr/share/man/man1/pkg-config.1.gz
a_sid
(247 rep)
Aug 1, 2021, 04:24 AM
• Last activity: Aug 1, 2021, 12:15 PM
0
votes
1
answers
1248
views
pkg-config cannot find any package
I need to use latest version of pkg-config. So I build it from source with `--with-internal-glib --disable-host-tool`. However, it cannot find any package without setting PKG_CONFIG_PATH. How can I make it behave like system installed one which contains all default paths?
I need to use latest version of pkg-config. So I build it from source with
--with-internal-glib --disable-host-tool
.
However, it cannot find any package without setting PKG_CONFIG_PATH. How can I make it behave like system installed one which contains all default paths?
Wang
(1395 rep)
May 29, 2020, 01:13 AM
• Last activity: May 29, 2020, 01:47 AM
2
votes
1
answers
6784
views
pkg-config output not working with makefile?
I'm trying to run the _makefile_, shown in [this repo][1], which is a simple Wayland client. But when I run _make_, it seems that the output of `$(WAYLAND)` is blank, and it fails to compile due to not being able to find the necessary _wayland-client.h_ header file. cc (GCC) version 5.3.1 on Fedora...
I'm trying to run the _makefile_, shown in this repo , which is a simple Wayland client. But when I run _make_, it seems that the output of
$(WAYLAND)
is blank, and it fails to compile due to not being able to find the necessary _wayland-client.h_ header file. cc (GCC) version 5.3.1 on Fedora 23 in bash.
Below are some details. My question is, what mistake am I making with my environment that is preventing this _makefile_ from working for me as intended?
Contents of _makefile_:
WAYLAND=pkg-config wayland-client --cflags --libs
CFLAGS?=-std=c11 -Wall -Werror -O3 -fvisibility=hidden
hello_wayland: hello_wayland.o helpers.o helpers.h images.bin
$(CC) -o hello_wayland *.o $(WAYLAND) -lrt
images.bin: images/convert.py images/window.png images/fish.png
images/convert.py
cat window.bin fish.bin > images.bin
clean:
$(RM) *.o fish.bin window.bin hello_wayland
Output of _make_:
> cc -std=c11 -Wall -Werror -O3 -fvisibility=hidden -c -o hello_wayland.o hello_wayland.c
hello_wayland.c:6:28: fatal error: wayland-client.h: No such file or directory
Notice how the options to _cc_ above seem to be missing the output of $(WAYLAND)
specified in _makefile_. If I manually execute _cc_ like this:
cc -std=c11 -Wall -Werror -O3 -fvisibility=hidden -c -o hello_wayland.o hello_wayland.c \
-I/home/me/install/include -L/home/me/install/lib -lwayland-client
The compilation succeeds.
Output of _pkg-config wayland-client --cflags --libs_:
> -I/home/me/install/include -L/home/me/install/lib -lwayland-client
Contents of *~/.bash_profile*:
source ~/.profile
source ~/.bashrc
Relevant contents of _~/.bashrc_:
export WLD=$HOME/install
export LD_LIBRARY_PATH=$WLD/lib
export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
export PATH=$WLD/bin:$PATH
export ACLOCAL_PATH=$WLD/share/aclocal
export ACLOCAL="aclocal -I $ACLOCAL_PATH"
Thanks for pointing out something that should probably be totally obvious to me.
ybakos
(234 rep)
Mar 20, 2016, 05:36 PM
• Last activity: Feb 10, 2020, 07:49 AM
0
votes
1
answers
447
views
some troubles on installing deja-dup from source code
*(Learning how to install programs on linux...)* [deja-dup source code][1] can be downloaded on its GitHub repo. There is a makefile con the package. Once into the folder I run: santi@eoan:~/deja-dup$ make And get the error: The Meson build system Project name: deja-dup Project version: 40.6 ... Run...
*(Learning how to install programs on linux...)*
deja-dup source code can be downloaded on its GitHub repo. There is a makefile con the package. Once into the folder I run:
santi@eoan:~/deja-dup$ make
And get the error:
The Meson build system
Project name: deja-dup
Project version: 40.6
...
Run-time dependency goa-1.0 found: NO (tried pkgconfig and cmake)
Run-time dependency json-glib-1.0 found: NO (tried pkgconfig and cmake)
meson.build:36:0: ERROR: Dependency "json-glib-1.0" not found, tried pkgconfig and cmake
A full log can be found at /home/santi/deja-dup/builddir/meson-logs/meson-log.txt
make: *** [Makefile:15: configure] Error 1
I'm running lubuntu eoan, where deja-dup is updated, or almost. I wanted to know what's going wrong for future reference though.
user390930
Jan 20, 2020, 11:56 AM
• Last activity: Jan 20, 2020, 12:42 PM
15
votes
1
answers
36626
views
Gentoo: No package `glib-2.0` found
I have a strange problem when trying to install `dev-lib/gobject-introspection`: >>> Emerging (1 of 9) dev-libs/gobject-introspection-1.42.0 ...... configure: error: Package requirements (glib-2.0 > 2.36.0) were not met: No package `glib-2.0` found I have `dev-libs/glib-2.42.1` installed, but there...
I have a strange problem when trying to install
dev-lib/gobject-introspection
:
>>> Emerging (1 of 9) dev-libs/gobject-introspection-1.42.0
......
configure: error: Package requirements (glib-2.0 > 2.36.0) were not met:
No package glib-2.0
found
I have dev-libs/glib-2.42.1
installed, but there is some strange issue with pkg-config
:
$ pkg-config --modversion glib-2.0
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing glib-2.0.pc
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
$ echo $PKG_CONFIG_PATH
$
And looks like there is no glib-2.0.pc
file in /usr/lib/pkgconfig
. There is the file /usr/lib32/pkgconfig/glib-2.0.pc
, but for previous version of glib-2.38.2
Can anybody explain to me, what can be wrong and how can fix this? I've already asked this question on the gentoo forum , but maybe I'll have better luck here.
erthalion
(323 rep)
Jan 31, 2015, 08:32 AM
• Last activity: Jun 19, 2019, 09:55 PM
6
votes
2
answers
3585
views
Not clear where pkg-config is finding information or how .pc files are named
I followed a tutorial on GTK which used this command to generate the build flags: $ pkg-config --cflags --libs gtk+-3.0 This outputs coherent flags. From research, I have found that `pkg-config` searches for `.pc` files in `/usr/lib/pkginfo`, `usr/share/pkgconfig`, in the `/local` equivalents, and i...
I followed a tutorial on GTK which used this command to generate the build flags:
$ pkg-config --cflags --libs gtk+-3.0
This outputs coherent flags. From research, I have found that
pkg-config
searches for .pc
files in /usr/lib/pkginfo
, usr/share/pkgconfig
, in the /local
equivalents, and in the folder indicated by the PKG_CONFIG_PATH
variable.
None of the folders contains the GTK file and the environment variable is not set. Where is pkg-config
getting the flags?
rur2641
(409 rep)
Jul 7, 2018, 12:48 PM
• Last activity: Jul 7, 2018, 03:20 PM
0
votes
1
answers
1238
views
Two OpenCV versions: update to one broke the other, though they should be separate
My Linux distribution (Antergos) installed the latest version of OpenCV from the repositories (version 3.14.1) about a week ago. For compatibility, I have OpenCV 2 (version 2.4.13.5) installed in a separate folder in my home directory. In order to make compilation easier with g++, I've created alias...
My Linux distribution (Antergos) installed the latest version of OpenCV from the repositories (version 3.14.1) about a week ago. For compatibility, I have OpenCV 2 (version 2.4.13.5) installed in a separate folder in my home directory.
In order to make compilation easier with g++, I've created aliases in my .bashrc file for each version. This configuration essentially allows me to compile, say a program with only a main.cpp file, by using
g++ main.cpp $(opencv2)
Below is the relevant code from my .bashrc file:
# Programming Related Aliases
# OpenCV
alias opencv3='pkg-config --cflags --libs opencv' # OpenCV 3
opencv2prefix="$HOME/separate-libs/opencv2/release/installed" # Prefix that serves as the basis for the pathname of the OpenCV 2 directory.
export PKG_CONFIG_PATH="$opencv2prefix/lib/pkgconfig"
export LD_LIBRARY_PATH="$opencv2prefix/lib"
alias opencv2="pkg-config --cflags --libs opencv2" # OpenCV 2 lib, include and runtime specifications for OpenCV 2. Defined in PKG_CONFIG_PATH.
This setup worked perfectly until earlier today when I went to compile a larger program (that performs image segmentation) with the OpenCV 2 configuration. At first I thought I had forgotten a necessary build option when compiling OpenCV 2 from source. However, just to check my sanity, I tried compiling a program that I had successfully compiled with OpenCV 2 prior to the aforementioned update. The following was the result:
/usr/bin/ld: warning: libImath-2_2.so.12, needed by /home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libIlmImf-2_2.so.22, needed by /home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libIex-2_2.so.12, needed by /home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libHalf.so.12, needed by /home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libIlmThread-2_2.so.12, needed by /home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::globalThreadCount()'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::ChannelList::insert(char const*, Imf_2_2::Channel const&)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::InputFile::header() const'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::hasChromaticities(Imf_2_2::Header const&)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::OutputFile::writePixels(int)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::InputFile::setFrameBuffer(Imf_2_2::FrameBuffer const&)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::InputFile::readPixels(int, int)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::Channel::Channel(Imf_2_2::PixelType, int, int, bool)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::Slice::Slice(Imf_2_2::PixelType, char*, unsigned long, unsigned long, int, int, double, bool, bool)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::OutputFile::setFrameBuffer(Imf_2_2::FrameBuffer const&)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::Header::dataWindow() const'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::Header::channels()'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `half::_eLut'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::Header::channels() const'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::Header::~Header()'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::Header::Header(int, int, float, Imath_2_2::Vec2 const&, float, Imf_2_2::LineOrder, Imf_2_2::Compression)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::InputFile::InputFile(char const*, int)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::OutputFile::OutputFile(char const*, Imf_2_2::Header const&, int)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::FrameBuffer::insert(char const*, Imf_2_2::Slice const&)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::ChannelList::findChannel(char const*) const'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::chromaticities(Imf_2_2::Header const&)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `half::convert(int)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::Chromaticities::Chromaticities(Imath_2_2::Vec2 const&, Imath_2_2::Vec2 const&, Imath_2_2::Vec2 const&, Imath_2_2::Vec2 const&)'
/home/kvasir/separate-libs/opencv2/release/installed/lib/libopencv_highgui.so: undefined reference to `Imf_2_2::OutputFile::~OutputFile()'
collect2: error: ld returned 1 exit status
I've tried running sudo ldconfig
, as well as checking that my path names are correct. Also, I checked for compatibility issues in the include statements of all files and found no issues. I'm presuming that the package manager's update to the OpenCV 3 installation is what messed everything up. But if that's the case, why? Obviously if the OpenCV installations were in the same folder, I could understand. But both of them appear to be entirely separate and unaware of one another. My only other guess would be something with pkg-config.
When I try to compile the image segmentation program that contains object files and more complex code I get:
/tmp/ccpvnIWK.o: In function `main':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/main.cpp:37: undefined reference to `cv::waitKey(int)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/main.cpp:51: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/main.cpp:74: undefined reference to `cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector > const&)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/main.cpp:75: undefined reference to `cv::namedWindow(cv::String const&, int)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/main.cpp:76: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/main.cpp:77: undefined reference to `cv::waitKey(int)'
/tmp/ccpvnIWK.o: In function `cv::String::String(char const*)':
/usr/include/opencv2/core/cvstd.hpp:602: undefined reference to `cv::String::allocate(unsigned long)'
/tmp/ccpvnIWK.o: In function `cv::String::~String()':
/usr/include/opencv2/core/cvstd.hpp:648: undefined reference to `cv::String::deallocate()'
/tmp/ccpvnIWK.o: In function `cv::String::operator=(cv::String const&)':
/usr/include/opencv2/core/cvstd.hpp:656: undefined reference to `cv::String::deallocate()'
/tmp/ccpvnIWK.o: In function `cv::Mat::Mat(cv::Mat const&)':
/usr/include/opencv2/core/mat.inl.hpp:490: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/tmp/ccpvnIWK.o: In function `cv::Mat::~Mat()':
/usr/include/opencv2/core/mat.inl.hpp:704: undefined reference to `cv::fastFree(void*)'
/tmp/ccpvnIWK.o: In function `cv::Mat::release()':
/usr/include/opencv2/core/mat.inl.hpp:816: undefined reference to `cv::Mat::deallocate()'
/tmp/ccpvnIWK.o: In function `cv::Mat::operator=(cv::Mat&&)':
/usr/include/opencv2/core/mat.inl.hpp:1383: undefined reference to `cv::fastFree(void*)'
/tmp/ccpvnIWK.o: In function `cv::String::String(std::__cxx11::basic_string, std::allocator > const&)':
/usr/include/opencv2/core/cvstd.inl.hpp:83: undefined reference to `cv::String::allocate(unsigned long)'
Loader.o: In function `void cv::operator>>, std::allocator > >(cv::FileNode const&, std::__cxx11::basic_string, std::allocator >&)':
/usr/include/opencv2/core/cvstd.inl.hpp:156: undefined reference to `cv::read(cv::FileNode const&, std::__cxx11::basic_string, std::allocator >&, std::__cxx11::basic_string, std::allocator > const&)'
Loader.o: In function `Loader::loadControlParameters(ControlParameters&)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/Loader.cpp:16: undefined reference to `cv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/Loader.cpp:17: undefined reference to `cv::FileStorage::isOpened() const'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/Loader.cpp:20: undefined reference to `cv::waitKey(int)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/Loader.cpp:24: undefined reference to `cv::FileStorage::operator[](char const*) const'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/Loader.cpp:25: undefined reference to `cv::FileStorage::operator[](char const*) const'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/Loader.cpp:26: undefined reference to `cv::FileStorage::operator[](char const*) const'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/Loader.cpp:27: undefined reference to `cv::FileStorage::operator[](char const*) const'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/Loader.cpp:16: undefined reference to `cv::FileStorage::~FileStorage()'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/Loader.cpp:16: undefined reference to `cv::FileStorage::~FileStorage()'
Loader.o: In function `Loader::loadOriginalImage(ControlParameters const&)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/Loader.cpp:35: undefined reference to `cv::imread(cv::String const&, int)'
Loader.o: In function `void cv::operator>>(cv::FileNode const&, int&)':
/usr/include/opencv2/core/persistence.hpp:1238: undefined reference to `cv::read(cv::FileNode const&, int&, int)'
MeanShift.o: In function `cv::operator*=(cv::Mat&, double const&)':
/usr/include/opencv2/core/operations.hpp:254: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
MeanShift.o: In function `MeanShift::segmentUsingLAB(cv::Mat, unsigned int)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:22: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:24: undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:26: undefined reference to `cv::split(cv::Mat const&, cv::Mat*)'
MeanShift.o: In function `MeanShift::segmentUsingLAB(cv::Mat, unsigned int)':
/usr/include/opencv2/core.hpp:788: undefined reference to `cv::noArray()'
MeanShift.o: In function `MeanShift::segmentUsingLAB(cv::Mat, unsigned int)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:28: undefined reference to `cv::normalize(cv::_InputArray const&, cv::_InputOutputArray const&, double, double, int, int, cv::_InputArray const&)'
MeanShift.o: In function `MeanShift::segmentUsingLAB(cv::Mat, unsigned int)':
/usr/include/opencv2/core.hpp:788: undefined reference to `cv::noArray()'
MeanShift.o: In function `MeanShift::segmentUsingLAB(cv::Mat, unsigned int)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:29: undefined reference to `cv::normalize(cv::_InputArray const&, cv::_InputOutputArray const&, double, double, int, int, cv::_InputArray const&)'
MeanShift.o: In function `MeanShift::segmentUsingLAB(cv::Mat, unsigned int)':
/usr/include/opencv2/core.hpp:788: undefined reference to `cv::noArray()'
MeanShift.o: In function `MeanShift::segmentUsingLAB(cv::Mat, unsigned int)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:30: undefined reference to `cv::normalize(cv::_InputArray const&, cv::_InputOutputArray const&, double, double, int, int, cv::_InputArray const&)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:32: undefined reference to `cv::merge(cv::Mat const*, unsigned long, cv::_OutputArray const&)'
MeanShift.o: In function `MeanShift::segmentUsingHLS(cv::Mat, unsigned int)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:44: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:46: undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:48: undefined reference to `cv::split(cv::Mat const&, cv::Mat*)'
MeanShift.o: In function `MeanShift::segmentUsingHLS(cv::Mat, unsigned int)':
/usr/include/opencv2/core.hpp:788: undefined reference to `cv::noArray()'
MeanShift.o: In function `MeanShift::segmentUsingHLS(cv::Mat, unsigned int)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:50: undefined reference to `cv::normalize(cv::_InputArray const&, cv::_InputOutputArray const&, double, double, int, int, cv::_InputArray const&)'
MeanShift.o: In function `MeanShift::segmentUsingHLS(cv::Mat, unsigned int)':
/usr/include/opencv2/core.hpp:788: undefined reference to `cv::noArray()'
MeanShift.o: In function `MeanShift::segmentUsingHLS(cv::Mat, unsigned int)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:51: undefined reference to `cv::normalize(cv::_InputArray const&, cv::_InputOutputArray const&, double, double, int, int, cv::_InputArray const&)'
MeanShift.o: In function `MeanShift::segmentUsingHLS(cv::Mat, unsigned int)':
/usr/include/opencv2/core.hpp:788: undefined reference to `cv::noArray()'
MeanShift.o: In function `MeanShift::segmentUsingHLS(cv::Mat, unsigned int)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:52: undefined reference to `cv::normalize(cv::_InputArray const&, cv::_InputOutputArray const&, double, double, int, int, cv::_InputArray const&)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:54: undefined reference to `cv::merge(cv::Mat const*, unsigned long, cv::_OutputArray const&)'
MeanShift.o: In function `MeanShift::segmentUsingRGB(cv::Mat, unsigned int)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:74: undefined reference to `cv::countNonZero(cv::_InputArray const&)'
MeanShift.o: In function `MeanShift::segmentUsingRGB(cv::Mat, unsigned int)':
/usr/include/opencv2/core.hpp:788: undefined reference to `cv::noArray()'
MeanShift.o: In function `MeanShift::segmentUsingRGB(cv::Mat, unsigned int)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:121: undefined reference to `cv::normalize(cv::_InputArray const&, cv::_InputOutputArray const&, double, double, int, int, cv::_InputArray const&)'
MeanShift.o: In function `MeanShift::segmentFromFeatureSpace(cv::Mat const&, unsigned int, std::vector > const&, std::vector, std::allocator > >, std::allocator, std::allocator > > > > const&)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:145: undefined reference to `cv::split(cv::Mat const&, cv::Mat*)'
MeanShift.o: In function `MeanShift::getChannelsRanges(cv::Mat, int*, SImgDims&)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:204: undefined reference to `cv::split(cv::Mat const&, cv::Mat*)'
MeanShift.o: In function `MeanShift::getChannelsRanges(cv::Mat, int*, SImgDims&)':
/usr/include/opencv2/core.hpp:819: undefined reference to `cv::noArray()'
MeanShift.o: In function `MeanShift::getChannelsRanges(cv::Mat, int*, SImgDims&)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:214: undefined reference to `cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_*, cv::Point_*, cv::_InputArray const&)'
MeanShift.o: In function `MeanShift::showImage(cv::Mat, std::__cxx11::basic_string, std::allocator > const&)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:789: undefined reference to `cv::namedWindow(cv::String const&, int)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:795: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:797: undefined reference to `cv::waitKey(int)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:800: undefined reference to `cv::destroyWindow(cv::String const&)'
MeanShift.o: In function `MeanShift::makeIt8bit(cv::Mat)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:811: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
MeanShift.o: In function `MeanShift::standardization(cv::Mat const&)':
/usr/include/opencv2/core.hpp:819: undefined reference to `cv::noArray()'
MeanShift.o: In function `MeanShift::standardization(cv::Mat const&)':
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:827: undefined reference to `cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_*, cv::Point_*, cv::_InputArray const&)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:829: undefined reference to `cv::operator-(cv::Mat const&, cv::Scalar_ const&)'
/home/kvasir/Documents/PolytechSchoolWork/2018 Spring (algorithms, software engineering, computer vision, artificial intelligence, computer architecture and organization)/computer-vision/projects/3rd-assignment/MeanShift/MeanShift.cpp:829: undefined reference to `cv::operator*(cv::MatExpr const&, double)'
MeanShift.o: In function `cv::Mat::Mat(int, int const*, int)':
/usr/include/opencv2/core/mat.inl.hpp:446: undefined reference to `cv::Mat::create(int, int const*, int)'
MeanShift.o: In function `cv::Mat::Mat(int, int const*, int, cv::Scalar_ const&)':
/usr/include/opencv2/core/mat.inl.hpp:454: undefined reference to `cv::Mat::create(int, int const*, int)'
/usr/include/opencv2/core/mat.inl.hpp:455: undefined reference to `cv::Mat::operator=(cv::Scalar_ const&)'
MeanShift.o: In function `cv::Mat::create(int, int, int)':
/usr/include/opencv2/core/mat.inl.hpp:796: undefined reference to `cv::Mat::create(int, int const*, int)'
collect2: error: ld returned 1 exit status
make: *** [makefile:6: segmentation] Error 1
What particularly strikes me odd about this output is that the *.o files look in /usr/include/opencv2
for function definitions, it seems. If it was called with $opencv2
, shouldn't it look in /home/kvasir/separate-libs/opencv2/release/installed/*
?
The makefile that produces the above error is shown below:
segmentation : main.cpp Loader.o MeanShift.o ControlParameters.h defs.h
g++ -g -o segmentation main.cpp Loader.o MeanShift.o $(opencv2)
Loader.o : Loader.cpp Loader.h
g++ -g -c Loader.cpp
MeanShift.o : MeanShift.cpp MeanShift.h
g++ -g -c MeanShift.cpp
clean:
rm segmentation *.o
I also tried compiling the object files with the OpenCV 2 version to no avail. My next move will probably be to reinstall OpenCV 2. However, I'm curious as to why this happened in the first place and if there's any way to fix and prevent this from happening in the future.
Additionally, both of these programs successfully compile with OpenCV 3 without issue. For example, changing $(opencv2)
in my makefile above to $(opencv3) results in no errors and a working program.
Edit: I'm a college student and these programs are assignments for a Computer Science course. The more complicated program mentioned above was not written by me. It was provided by my professor and borrowed from another university. I have to modify it, but it is in a compile-able state as is with the one exception of main in main.cpp being void. I changed this to int and made the return statement return 0;
, and it seemed to compile perfectly fine with OpenCV 3.
**Note:** I know the code for both of these programs works. I'm not asking for help with coding, but I'm asking why an update to the OpenCV 3 installation in /usr/include/
would muck up a custom installation of OpenCV 2 in a separate location.
Edit: Here is a link to the more complicated (image segmentation) program.
Edit: I've uploaded the simpler program's source code to Google Drive. It is available here .
ElderFuthark
(101 rep)
Mar 21, 2018, 04:48 AM
• Last activity: Mar 22, 2018, 08:16 PM
7
votes
2
answers
11601
views
something is terribly wrong with pkg-config
I've been having a harrowing time lately just trying to get several C programs compiled because I can't find where the libraries are located and pkg-config seems to be out of order. I installed GNU GSL like this: wget ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz tar xvzf gsl-*gz cd gsl-1.15 ./configure...
I've been having a harrowing time lately just trying to get several C programs compiled because I can't find where the libraries are located and pkg-config seems to be out of order.
I installed GNU GSL like this:
wget ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz
tar xvzf gsl-*gz
cd gsl-1.15
./configure
make
sudo make install
Apparently it installed in
/usr/local/lib
which is a non-standard place? (1) What is a standard place? (2) How would I get it to install there?
And I can't manage to compile a simple program that uses this library:
$ gcc gsl_erf.c -o gsl -I/usr/local/lib -L/usr/local/lib
/tmp/cc3WD9Zq.o: In function `main':
gsl_erf.c:(.text+0x24): undefined reference to `gsl_cdf_gaussian_P'
collect2: error: ld returned 1 exit status
Now, with pkg-config :
pkg-config --libs --cflags gslPackage gsl was not found in the pkg-config search path.
Perhaps you should add the directory containing `gsl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gsl' found
So I did add the directory:
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
But no luck yet! :( pkg-config still gives me the same message as above. (Perhaps you sh ...
)
This is a more general problem I face regularly when I have to compile some C program. I would love a general solution for:
1. Where and how do I install my C libs? (Perhaps the same place yum installs them?)
2. How do I correct/configure and use pkg-config
----
**Update** : I tried one of the answer's suggestions below and running the compiled program gives me this : ./gsl_app: error while loading shared libraries: libgsl.so.0: cannot open shared object
gideon
(353 rep)
Jan 25, 2014, 07:55 AM
• Last activity: Feb 19, 2018, 03:35 PM
Showing page 1 of 20 total questions