-
-
Notifications
You must be signed in to change notification settings - Fork 464
Description
Xmake Version
xmake v3.0.0+HEAD.0db4fe610
Operating System Version and Architecture
Windows 10
Describe Bug
The libpng
package generates a pkg-config
file (.pc
) with a Version
field prefixed by a "v" (e.g., Version: v1.6.48
).
This version string is not correctly parsed by other build systems, such as Meson. When a dependent package like cairo
performs a version check (e.g., libpng >= 1.4.0
), the check fails. Consequently, the build system ignores the existing xmake-installed libpng
and attempts to download its own version, defeating the purpose of the package manager.
Expected Behavior
The Version
field in the generated libpng.pc
file should contain a standard, parsable version string without the "v" prefix, such as Version: 1.6.48
.
Project Configuration
$ xrepo install -vD cairo
...
Dependency libpng found: NO. Found v1.6.48 but need: '>= 1.4.0'
Run-time dependency libpng found: NO (tried pkgconfig and cmake)
Looking for a fallback subproject for the dependency libpng
Downloading libpng source from https://github.com/glennrp/libpng/archive/v1.6.43.tar.gz
Downloading libpng patch from https://wrapdb.mesonbuild.com/v2/libpng_1.6.43-1/get_patch
Executing subproject libpng
libpng| Project name: libpng
libpng| Project version: 1.6.43
libpng| C compiler for the host machine: /home/runner/work/_temp/cfdf5e8e-9c47-4d09-b13c-e3dbeb641388/emsdk-main/upstream/emscripten/emcc (emscripten 4.0.10 "emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.10 (b7dc6e5747465580df5984e723b9d1f10d8e804b)")
libpng| C linker for the host machine: /home/runner/work/_temp/cfdf5e8e-9c47-4d09-b13c-e3dbeb641388/emsdk-main/upstream/emscripten/emcc ld.wasm 21.0.0
libpng| C compiler for the build machine: cc (gcc 13.3.0 "cc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0")
libpng| C linker for the build machine: cc ld.bfd 2.42
libpng| Dependency zlib found: YES v1.3.1 (cached)
libpng| Library m found: YES
libpng| Fetching value of define "__ARM_NEON" : (undefined)
libpng| Configuring libpng16.pc using configuration
libpng| Configuring libpng.pc using configuration
libpng| Build targets in project: 2
libpng| Subproject libpng finished.
Dependency libpng from subproject subprojects/libpng-1.6.43 found: YES 1.6.43
...
Additional Information and Error Logs
Here is a comparison of different .pc
files for context.
1. .pc
file currently generated:
Name: libpng
Description: The official PNG reference library
Version: v1.6.48
Libs: -L${libdir}/../../../../../z/zlib/v1.3.1/95786712bac941e795afa187a68143a4/lib -L${libdir} -lpng -lzlib
Libs.private:
Cflags: -I${includedir}/../../../../../z/zlib/v1.3.1/95786712bac941e795afa187a68143a4/include -I${includedir}
2. Output with pkgconfig_importfiles
rule:
Strip the leading "v" from the version string obtained via package:version_str()
and apply it using set_version()
.
Append add_rules("utils.install.pkgconfig_importfiles", {filename = "libpng.pc", links = {"z"}})
Name: png
Description: png
Version: 1.6.48
Libs: -L${libdir} -lz
Cflags: -I${includedir}
3. Reference .pc
file from libpng's native build system:
For comparison, a .pc
file generated by libpng's own build system provides a good reference for the expected format and content.
Name: libpng
Description: Loads and saves PNG files
Version: 1.6.49
Requires.private: zlib
Libs: -L${libdir} -lpng16
Libs.private: -lz
Cflags: -I${includedir}