pkgconf — pkg-config for WASIX
pkgconf 2.4.3, built for WASIX. Reads .pc files and prints the flags a build
needs. Installs both names, so existing makefiles that call pkg-config work
unchanged.
wasmer run icedcoffee/pkgconf -- --cflags --libs foo
wasmer run icedcoffee/pkgconf -- --modversion openssl
PKG_CONFIG_PATH=/usr/lib/pkgconfig wasmer run icedcoffee/pkgconf -- --cflags zlib
What is in the package
pkgconf and pkg-config. Queries: --cflags, --libs, --cflags-only-I,
--libs-only-l, --cflags --libs combined, --modversion, --version,
--exists, --atleast-version, --exact-version, --max-version, --print-requires,
--print-requires-private, --print-provides, --variable=NAME,
--define-variable=NAME=VALUE, --list-all, --path, --static, --shared,
--with-path, --define-prefix, --errors-to-stdout, --silence-errors,
--keep-system-cflags/--keep-system-libs, --dont-define-prefix,
--relocate, and Requires/Requires.private/Conflicts/Provides
resolution. Exit status is 0 when every module was found, 1 when not.
Search path defaults to <prefix>/lib/pkgconfig and <prefix>/share/pkgconfig
under each of /usr, /usr/local, /; PKG_CONFIG_PATH,
PKG_CONFIG_LIBDIR and PKG_CONFIG_SYSROOT_DIR are honoured. pkgconf also
supports the bare foo >= 1.2 module expression form.
Verified
$ pkgconf --modversion foo # foo requires bar
1.2.3
$ pkgconf --cflags foo
-I/usr/include -DFOO
$ pkgconf --libs foo
-L/usr/lib -lfoo -lbar
$ pkgconf --exists foo; echo $?
0
$ pkgconf --atleast-version=1.0 foo; echo $?
0
$ pkgconf --print-requires foo
bar
$ pkgconf --variable=libdir foo
/usr/lib
The one thing that needed changing
The build needed nothing patched, but the link needs an explicit 2 MiB stack:
-Wl,-z,stack-size=2097152. pkgconf puts PKGCONF_BUFSIZE-sized buffers
(64 KiB) on the stack, and the default stack in this toolchain is smaller than
one frame of that, so every invocation — even --version — trapped with
out of bounds memory access until the stack was raised. Other packages with
big local arrays hit the same wall.
No asyncify: pkgconf does not fork, exec or longjmp.
Building
./configure --host=wasm32-wasi --build=x86_64-linux-gnu --disable-shared --enable-static
make
with -matomics -mbulk-memory -mmutable-globals -pthread -mthread-model posix -ftls-model=local-exec, -D_WASI_EMULATED_{MMAN,SIGNAL,PROCESS_CLOCKS,GETPID},
-lwasi-emulated-{mman,process-clocks,getpid}, -Wl,--shared-memory -Wl,--max-memory=4294967296 -Wl,--import-memory -Wl,-z,stack-size=2097152, and
the __heap_base/__stack_pointer/__wasm_init_tls/__tls_* exports.
License: ISC, as upstream.