Bug 8589 - Bootstrap packages get wrong pkg-config information
Summary: Bootstrap packages get wrong pkg-config information
Status: RESOLVED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Build system (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.20.0
Assignee: Pierre Ossman
URL:
Keywords: prosaic
Depends on:
Blocks: 8361 8591
  Show dependency treegraph
 
Reported: 2025-05-15 08:38 CEST by Pierre Ossman
Modified: 2025-07-04 09:20 CEST (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments

Description Pierre Ossman cendio 2025-05-15 08:38:31 CEST
Packages that are built as part of the bootstrapping (before we have a working chroot) will be built incorrectly if they rely on pkg-config. Either failing, or producing the wrong result.


The problem is that the only special setup we do during bootstrapping is to alter $PATH. That means that our gcc and binutils are used instead of the system's.

For programs that test things via the compiler, this is sufficient. But programs that look for dependencies via pkg-config will use the system's pkg-config, and get the wrong results.



E.g., if ncurses-devel is installed on the host, then util-linux will find that and fail:

> /bin/sh ./libtool  --tag=CC   --mode=link i686-pc-linux-gnu-gcc -fsigned-char -fno-common -Wall -Werror=sequence-point -Wextra -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wno-missing-field-initializers -Wredundant-decls -Wsign-compare -Wtype-limits -Wuninitialized -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-parameter -Wunused-result -Wunused-variable -Wnested-externs -Wpointer-arith -Wstrict-prototypes -Wimplicit-function-declaration -O2 -g  -g -o dmesg sys-utils/dmesg-dmesg.o lib/dmesg-monotonic.o  libcommon.la libtcolors.la -lrt 
> libtool: link: i686-pc-linux-gnu-gcc -fsigned-char -fno-common -Wall -Werror=sequence-point -Wextra -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wno-missing-field-initializers -Wredundant-decls -Wsign-compare -Wtype-limits -Wuninitialized -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-parameter -Wunused-result -Wunused-variable -Wnested-externs -Wpointer-arith -Wstrict-prototypes -Wimplicit-function-declaration -O2 -g -g -o dmesg sys-utils/dmesg-dmesg.o lib/dmesg-monotonic.o  ./.libs/libcommon.a ./.libs/libtcolors.a -ltinfo -lrt
> /opt/cendio-build/arch/i386/usr/bootstrap/lib/gcc/i686-pc-linux-gnu/5.5.0/../../../../i686-pc-linux-gnu/bin/ld: cannot find -ltinfo
> collect2: error: ld returned 1 exit status


We need to provide some mechanism to redirect pkg-config to our stuff.
Comment 1 Pierre Ossman cendio 2025-07-03 16:56:58 CEST
Our current approach to cross compiling with pkg-config is to build special variants of pkg-config with other default values. This doesn't fit well with the bootstrapping.

Instead, let's use the wrapper script approach recommended by pkg-config:

https://autotools.info/pkgconfig/cross-compiling.html

This is clean enough that it will work well even during bootstrapping.
Comment 2 Pierre Ossman cendio 2025-07-03 16:58:09 CEST
We need to fix up ncurses for bug 8361. Since that package is part of the current issue here, let's do a general cleanup of our ncurses packaging at the same time.
Comment 14 Pierre Ossman cendio 2025-07-04 09:18:45 CEST
Done. Tested that both cenbuild and ThinLinc fully builds without issue after these changes.
Comment 15 Pierre Ossman cendio 2025-07-04 09:20:25 CEST
Tester should primarily check that pkg-config gives the correct results in:

 * Bootstrapping

 * Cross-compilation in cenbuild

 * Non-cross-compilation in cenbuild

Note You need to log in before you can comment on or make changes to this bug.