You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am logging this as a "bug" and not a "build error", because it looks like a conceptual problem and not a build error tied to a specific package. However, I can best describe this with a specific example:
Package freetype depends on libpng, which itself depends on zlib-api. freetype uses pkg-config to find libpng in the (default) autotools build. pkg-config on my system is built by spack, zlib-api is provided by the OS libz in /usr, and libpng is built by spack. The freetype build fails with:
134 checking /p/app/projects/NEPTUNE/spack-stack/spack-stack-dev-20241220/spack/lib/spack/env/intel/icc compiler flag -pedantic to assure ANSI C99 works correctly... ok, adding to XX_ANSIFLAGS
135 checking /p/app/projects/NEPTUNE/spack-stack/spack-stack-dev-20241220/spack/lib/spack/env/intel/icc compiler flag -std=c99 to assure ANSI C99 works correctly... ok, adding to XX_ANSIFLAGS
136 checking for -fvisibility=hidden compiler flag... yes
137 checking for BZIP2... yes
138 checking for LIBPNG... no
139 checking for libpng-config... no
>> 140 configure: error: libpng support requested but library not found
With some digging, this is because of:
> cat /p/app/projects/NEPTUNE/spack-stack/spack-stack-dev-20241220/cache/build_stage/heinzell/spack-stage-freetype-2.13.2-rmiuppfxo5jswfbvwfzyj2cvwunak6t3/spack-src/builds/unix/config.log
...
configure:14272: $PKG_CONFIG --exists --print-errors "$libpng_pkg"
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
Package 'zlib', required by 'libpng', not found
configure:14275: $? = 1
configure:14282: checking for LIBPNG
configure:14289: $PKG_CONFIG --exists --print-errors "$libpng_pkg"
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
Package 'zlib', required by 'libpng', not found
configure:14292: $? = 1
configure:14306: $PKG_CONFIG --exists --print-errors "$libpng_pkg"
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
Package 'zlib', required by 'libpng', not found
configure:14309: $? = 1
configure:14323: result: no
Package 'zlib', required by 'libpng', not found
configure:14369: checking for libpng-config
configure:14402: result: no
configure:14421: error: libpng support requested but library not found
Error message
The error is shown above. Since pkg-config is built by spack, the default=OS PKG_CONFIG_PATH is not /usr etc. But because zlib is an external package in /usr, and presumably because spack does not add OS paths to the spack build environments, zlib.pc isn't found (it exists in /usr/lib64/pkgconfig/zlib.pc).
I can fix this for freetype by setting environment variables that configure knows about that override pkg-config, but I imagine that this situation isn't unique to freetype and that a more general solution is preferred:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
LT_SYS_LIBRARY_PATH
User-defined run-time library search path.
ZLIB_CFLAGS C compiler flags for ZLIB, overriding pkg-config
ZLIB_LIBS linker flags for ZLIB, overriding pkg-config
BZIP2_CFLAGS
C compiler flags for BZIP2, overriding pkg-config
BZIP2_LIBS linker flags for BZIP2, overriding pkg-config
LIBPNG_CFLAGS
C compiler flags for LIBPNG, overriding pkg-config
LIBPNG_LIBS linker flags for LIBPNG, overriding pkg-config
HARFBUZZ_CFLAGS
C compiler flags for HARFBUZZ, overriding pkg-config
HARFBUZZ_LIBS
linker flags for HARFBUZZ, overriding pkg-config
BROTLI_CFLAGS
C compiler flags for BROTLI, overriding pkg-config
BROTLI_LIBS linker flags for BROTLI, overriding pkg-config
LIBRSVG_CFLAGS
C compiler flags for LIBRSVG, overriding pkg-config
LIBRSVG_LIBS
linker flags for LIBRSVG, overriding pkg-config
climbfuji
changed the title
Does a spack-built pkg-config work with external packages
Does a spack-built pkg-config work with external packages?
Dec 26, 2024
Steps to reproduce
I am logging this as a "bug" and not a "build error", because it looks like a conceptual problem and not a build error tied to a specific package. However, I can best describe this with a specific example:
Package
freetype
depends onlibpng
, which itself depends onzlib-api
.freetype
usespkg-config
to findlibpng
in the (default) autotools build.pkg-config
on my system is built by spack,zlib-api
is provided by the OSlibz
in/usr
, andlibpng
is built by spack. Thefreetype
build fails with:With some digging, this is because of:
Error message
The error is shown above. Since
pkg-config
is built by spack, the default=OSPKG_CONFIG_PATH
is not/usr
etc. But becausezlib
is an external package in/usr
, and presumably because spack does not add OS paths to the spack build environments,zlib.pc
isn't found (it exists in/usr/lib64/pkgconfig/zlib.pc
).I can fix this for
freetype
by setting environment variables thatconfigure
knows about that overridepkg-config
, but I imagine that this situation isn't unique tofreetype
and that a more general solution is preferred:Information on your system
General information
spack debug report
and reported the version of Spack/Python/PlatformThe text was updated successfully, but these errors were encountered: