Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg-config is not able to complete configuration #754

Open
sergey-suloev opened this issue Feb 14, 2025 · 9 comments
Open

pkg-config is not able to complete configuration #754

sergey-suloev opened this issue Feb 14, 2025 · 9 comments

Comments

@sergey-suloev
Copy link

sergey-suloev commented Feb 14, 2025

Please read the troubleshooting guide
before raising a new issue.

Problem

pkg-config is not able to make the full configuration. In order to complete configuration I have to specify a lot of dependencies.

Reproduction steps

cross-compile for armhf/aarch64

Setup

  • ubuntu noble

Additional context

CFLAGS="-I${R}/usr/include"
LDFLAGS="-L${R}/usr/lib"

PKG_CONFIG=${BB_PKG_CONFIG} \
CC=${BB_GCC} \
NM=${BB_NM} STRIP=${BB_STRIP} RANLIB=${BB_RANLIB} OBJCOPY=${BB_OBJCOPY} OBJDUMP=${BB_OBJDUMP} AR=${BB_AR} \
CFLAGS="${CFLAGS}" \
LDFLAGS="${LDFLAGS}" LIBS="-ltinfo" \
GIO2_LIBS="-lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lffi -lz  ${LDFLAGS}" \
BLUEZ_LIBS="-lbluetooth -lncurses -ltinfo  ${LDFLAGS}" \
LIBBSD_LIBS="-lbsd -lmd  ${LDFLAGS}" \
MAKEINFO=/bin/true \
    ./configure --prefix=/usr \
            --enable-shared \
            --host=${BB_PLATFORM} \
            --with-sysroot=${R} \
            --with-dbusconfdir="/usr/share/dbus-1/system.d" \
            --with-alsaplugindir="/usr/lib/alsa-lib" \
            --with-alsaconfdir="/usr/etc/alsa/conf.d" \
            --enable-upower \
            ${BLUEZ_ALSA_EXTRA_PARAMS}
@sergey-suloev sergey-suloev changed the title pkg-config is not fully able to complete configuration pkg-config is not able to complete configuration Feb 14, 2025
@sergey-suloev
Copy link
Author

sergey-suloev commented Feb 14, 2025

BB_PKG_CONFIG points to the script below:

#!/bin/sh
R=/path/to/sysroot
export PKG_CONFIG_SYSROOT_DIR="${R}"
export PKG_CONFIG_LIBDIR="${R}/lib/pkgconfig:${R}/usr/lib/pkgconfig:${R}/usr/share/pkgconfig"
export PKG_CONFIG_PATH=
exec /usr/bin/pkg-config "$@"

@sergey-suloev
Copy link
Author

sergey-suloev commented Feb 14, 2025

user@host: ls -l /path/to/sysroot/usr/lib/pkgconfig/
total 216
-rw-r--r-- 1 root root 271 фев 14 13:19 alsa.pc
-rw-r--r-- 1 root root 152 фев 14 13:19 alsa-topology.pc
-rw-r--r-- 1 root root 191 фев 14 13:15 blkid.pc
-rw-r--r-- 1 root root 214 фев 14 14:49 bluez.pc
-rw-r--r-- 1 root root 262 фев 14 13:16 com_err.pc
-rw-r--r-- 1 root root 616 фев 14 13:10 dbus-1.pc
-rw-r--r-- 1 root root 250 фев 14 13:16 e2p.pc
-rw-r--r-- 1 root root 277 фев 14 13:09 expat.pc
-rw-r--r-- 1 root root 247 фев 14 13:16 ext2fs.pc
-rw-r--r-- 1 root root 419 фев 14 14:18 form.pc
-rw-r--r-- 1 root root 692 фев 14 13:09 gio-2.0.pc
-rw-r--r-- 1 root root 211 фев 14 13:09 gio-unix-2.0.pc
-rw-r--r-- 1 root root 530 фев 14 13:09 girepository-2.0.pc
-rw-r--r-- 1 root root 505 фев 14 13:09 glib-2.0.pc
-rw-r--r-- 1 root root 254 фев 14 13:09 gmodule-2.0.pc
-rw-r--r-- 1 root root 254 фев 14 13:09 gmodule-export-2.0.pc
-rw-r--r-- 1 root root 254 фев 14 13:09 gmodule-no-export-2.0.pc
-rw-r--r-- 1 root root 254 фев 14 13:09 gobject-2.0.pc
-rw-r--r-- 1 root root 223 фев 14 13:09 gthread-2.0.pc
-rw-r--r-- 1 root root 297 фев 14 14:20 history.pc
-rw-r--r-- 1 root root 327 фев 14 15:11 libbsd-ctor.pc
-rw-r--r-- 1 root root 379 фев 14 15:11 libbsd-overlay.pc
-rw-r--r-- 1 root root 268 фев 14 15:11 libbsd.pc
-rw-r--r-- 1 root root 316 фев 14 13:12 libcrypto.pc
-rw-r--r-- 1 root root 199 фев 14 13:09 libffi.pc
-rw-r--r-- 1 root root 260 фев 14 14:19 libical.pc
-rw-r--r-- 1 root root 264 фев 14 14:20 libmd.pc
-rw-r--r-- 1 root root 252 фев 14 13:13 libnl-3.0.pc
-rw-r--r-- 1 root root 303 фев 14 13:13 libnl-cli-3.0.pc
-rw-r--r-- 1 root root 241 фев 14 13:13 libnl-genl-3.0.pc
-rw-r--r-- 1 root root 253 фев 14 13:13 libnl-idiag-3.0.pc
-rw-r--r-- 1 root root 245 фев 14 13:13 libnl-nf-3.0.pc
-rw-r--r-- 1 root root 250 фев 14 13:13 libnl-route-3.0.pc
-rw-r--r-- 1 root root 248 фев 14 13:13 libnl-xfrm-3.0.pc
-rw-r--r-- 1 root root 274 фев 14 13:09 libpcre2-16.pc
-rw-r--r-- 1 root root 274 фев 14 13:09 libpcre2-32.pc
-rw-r--r-- 1 root root 271 фев 14 13:09 libpcre2-8.pc
-rw-r--r-- 1 root root 264 фев 14 13:12 libssl.pc
-rw-r--r-- 1 root root 266 фев 14 13:10 libsyslog.pc
-rw-r--r-- 1 root root 419 фев 14 14:18 menu.pc
-rw-r--r-- 1 root root 642 фев 14 13:15 mount.pc
-rw-r--r-- 1 root root 448 фев 14 14:18 ncurses++.pc
-rw-r--r-- 1 root root 419 фев 14 14:18 ncurses.pc
-rw-r--r-- 1 root root 218 фев 14 13:12 openssl.pc
-rw-r--r-- 1 root root 421 фев 14 14:18 panel.pc
-rw-r--r-- 1 root root 311 фев 14 14:20 readline.pc
-rw-r--r-- 1 root root 186 фев 14 14:20 sbc.pc
-rw-r--r-- 1 root root 204 фев 14 13:15 smartcols.pc
-rw-r--r-- 1 root root 275 фев 14 13:20 sndfile.pc
-rw-r--r-- 1 root root 273 фев 14 13:16 ss.pc
-rw-r--r-- 1 root root 426 фев 14 14:18 tinfo.pc
-rw-r--r-- 1 root root 241 фев 14 13:16 uuid.pc
-rw-r--r-- 1 root root 252 фев 14 13:08 zlib.pc

@borine
Copy link
Collaborator

borine commented Feb 14, 2025

Are you sure you have included all the relevant .pc file directories? I know every build environment is different, but for my cross-compiler I have

PKG_CONFIG_LIBDIR=$sysroot/usr/local/lib/arm-linux-gnueabihf/pkgconfig:$sysroot/usr/local/lib/pkgconfig:$sysroot/usr/local/share/pkgconfig:$sysroot/usr/lib/pkgconfig:$sysroot/usr/share/pkgconfig:$sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig

@sergey-suloev
Copy link
Author

Are you sure you have included all the relevant .pc file directories? I know every build environment is different, but for my cross-compiler I have

PKG_CONFIG_LIBDIR=$sysroot/usr/local/lib/arm-linux-gnueabihf/pkgconfig:$sysroot/usr/local/lib/pkgconfig:$sysroot/usr/local/share/pkgconfig:$sysroot/usr/lib/pkgconfig:$sysroot/usr/share/pkgconfig:$sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig

I attached above the list of all the pc files I have installed. It seems to cover all required deps for bluealsa.

@sergey-suloev
Copy link
Author

sergey-suloev commented Feb 14, 2025

btw, LIBS="-ltinfo" is required for libreadline , otherwise ld fails to link it.
i think this must be fixed in your configure script first of all.

here is pc file for readline:

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: Readline
Description: Gnu Readline library for command line editing
URL: http://tiswww.cwru.edu/php/chet/readline/rltop.html
Version: 8.2
Requires.private: tinfo
Libs: -L${libdir} -lreadline
Cflags: -I${includedir}

as you can see, tinfo.pc is referenced and should be handled appropriately

@borine
Copy link
Collaborator

borine commented Feb 14, 2025

Hmm, everything works just fine as it is in my cross-build environment (build: x86_64-linux-gnu, host: arm-linux-gnueabihf)

$ arm-linux-gnueabihf-ldd ./rpi-bookworm/Build/bluealsa/utils/rfcomm/bluealsa-rfcomm 
        libdbus-1.so.3 => /lib/arm-linux-gnueabihf/libdbus-1.so.3 (0x8badf00d)
        libsystemd.so.0 => /lib/arm-linux-gnueabihf/libsystemd.so.0 (0x8badf00d)
        libcap.so.2 => /lib/arm-linux-gnueabihf/libcap.so.2 (0x8badf00d)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x8badf00d)
        ld-linux-armhf.so.3 => /lib/ld-linux-armhf.so.3 (0x8badf00d)
        libgcrypt.so.20 => /lib/arm-linux-gnueabihf/libgcrypt.so.20 (0x8badf00d)
        libgpg-error.so.0 => /lib/arm-linux-gnueabihf/libgpg-error.so.0 (0x8badf00d)
        liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0x8badf00d)
        libzstd.so.1 => /lib/arm-linux-gnueabihf/libzstd.so.1 (0x8badf00d)
        liblz4.so.1 => /lib/arm-linux-gnueabihf/liblz4.so.1 (0x8badf00d)
        libreadline.so.8 => /lib/arm-linux-gnueabihf/libreadline.so.8 (0x8badf00d)
        libtinfo.so.6 => /lib/arm-linux-gnueabihf/libtinfo.so.6 (0x8badf00d)
        libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x8badf00d)

As you can see it has picked up libreadine and libtinfo, without needing me to define any environment variables for configure. If you are needing to define BLUEZ_LIBS and GIO2_LIBS then surely this suggests that you build environment is incomplete?

@sergey-suloev
Copy link
Author

Hmm, everything works just fine as it is in my cross-build environment (build: x86_64-linux-gnu, host: arm-linux-gnueabihf)

$ arm-linux-gnueabihf-ldd ./rpi-bookworm/Build/bluealsa/utils/rfcomm/bluealsa-rfcomm
libdbus-1.so.3 => /lib/arm-linux-gnueabihf/libdbus-1.so.3 (0x8badf00d)
libsystemd.so.0 => /lib/arm-linux-gnueabihf/libsystemd.so.0 (0x8badf00d)
libcap.so.2 => /lib/arm-linux-gnueabihf/libcap.so.2 (0x8badf00d)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x8badf00d)
ld-linux-armhf.so.3 => /lib/ld-linux-armhf.so.3 (0x8badf00d)
libgcrypt.so.20 => /lib/arm-linux-gnueabihf/libgcrypt.so.20 (0x8badf00d)
libgpg-error.so.0 => /lib/arm-linux-gnueabihf/libgpg-error.so.0 (0x8badf00d)
liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0x8badf00d)
libzstd.so.1 => /lib/arm-linux-gnueabihf/libzstd.so.1 (0x8badf00d)
liblz4.so.1 => /lib/arm-linux-gnueabihf/liblz4.so.1 (0x8badf00d)
libreadline.so.8 => /lib/arm-linux-gnueabihf/libreadline.so.8 (0x8badf00d)
libtinfo.so.6 => /lib/arm-linux-gnueabihf/libtinfo.so.6 (0x8badf00d)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x8badf00d)
As you can see it has picked up libreadine and libtinfo, without needing me to define any environment variables for configure. If you are needing to define BLUEZ_LIBS and GIO2_LIBS then surely this suggests that you build environment is incomplete?

No, everything is complete here. But you should not rely on the assumption that the binaries are built with rpath because this is not always the case

@borine
Copy link
Collaborator

borine commented Feb 14, 2025

you should not rely on the assumption that the binaries are built with rpath

Yes, good point. So as far as libreadline is concerned, perhaps configure.ac should use pkgconfig. @arkq I wonder, can you remember why pkgconfig was not used for libreadline?

But for bluez, libbsd, and libgio they should be correctly configured by pkgconfig; I think it is not the fault of configure.ac if pkgconfig fails.

@arkq
Copy link
Owner

arkq commented Feb 14, 2025

I wonder, can you remember why pkgconfig was not used for libreadline?

I think that there was no pkg-config support for readline when it was added as a project dependency. If the pkg-config for readline nowadays is widely supported among Linux distributions we should add it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants