Hi, Leo Famulari writes: > On Mon, Jun 13, 2016 at 12:58:52PM -0400, Leo Famulari wrote: >> On Sat, Jun 11, 2016 at 11:24:23PM -0500, Lukas Gradl wrote: >> > Oh, that is true. I searched around, but I could not find anything >> > about zbuffer.h[pp]. I am not sure what it is used for. FWIW, it is >> > only referenced in src/Makefile, src/Makefile.in, src/Makefile.am >> > CMakeLists.txt and in the tests: >> >> [...] >> >> > Judging from this, I am inclined to think that msgpack does not use >> > these two headers for anything but tests. But I am not sure about >> > this. >> >> I think that another application would call the zbuffer functions, >> although the string 'zbuffer' does not exist in the opendht source code. >> But, we should make sure msgpack will work for other calling >> applications that might be added later. OK, I agree. >> >> On #guix, bavier suggested we patch 'msgpack.pc.in'. Specifically, we >> should append the include flag to 'Cflags:' and create a 'Libs.private:' >> field for the -L and -l flags. There are some examples in >> 'gnu/packages'. >> >> More details on the IRC log: >> https://gnunet.org/bot/log/guix/2016-06-13#T1056507 >> >> I've cc-ed Eric since I don't know much about pkg-config. Neither do I. I have experimented with this a bit. IIUC, since our zlib provides a pkg-config file we can generate the the -I flag by adding ---8<--- cut here -------------------- start --->8--- Requires.private: zlib ---8<--- cut here -------------------- end ----->8--- to the msgpack.pc.in file. This also gives me the -L flag. The -l flag is only emitted when --static is passed to pkg-config. I tried to fix this by adding -lz to Libs.private resulting in: ---8<--- cut here -------------------- start --->8--- lukas@serenity$ guix environment msgpack lukas@serenity [env]$ cat /gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/lib/pkgconfig/msgpack.pc prefix=/gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1 exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: MessagePack Description: Binary-based efficient object serialization library Version: 1.4.1 Libs: -L${libdir} -lmsgpackc Cflags: -I${includedir} Requires.private: zlib Libs.private: -lz lukas@serenity [env]$ pkg-config --libs --cflags /gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/lib/pkgconfig/msgpack.pc -I/gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/include -I/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/include -L/gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/lib -lmsgpackc lukas@serenity [env]$ pkg-config --libs --cflags --static /gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/lib/pkgconfig/msgpack.pc -I/gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/include -I/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/include -L/gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/lib -L/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/lib -lmsgpackc -lz lukas@serenity [env]$ guix gc --references /gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1 /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22 /gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1 /gnu/store/v39bh3ln3ncnzhyw0kd12d46kww9747v-gcc-4.9.3-lib lukas@serenity [env]$ ---8<--- cut here -------------------- end ----->8--- So I still only get the -lz flag for static linking. I am not sure if this is what we want, what do you think? Also, still no store refernece. BTW, where is "guix gc --references" implemented? I looked for it but failed to find the actual logic, since I am not that fluent with Scheme... From this I think that adding the -lz to Libs.private is redundant if zlib is in "Requires.private". But if we want -lz also for dynamic linking then I think we need to move zlib to "Requires". I went ahead and tried that leading to this result: ---8<--- cut here -------------------- start --->8--- lukas@serenity$ guix environment msgpack lukas@serenity [env]$ cat /gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/lib/pkgconfig/msgpack.pc prefix=/gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1 exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: MessagePack Description: Binary-based efficient object serialization library Version: 1.4.1 Libs: -L${libdir} -lmsgpackc Cflags: -I${includedir} Requires: zlib lukas@serenity [env]$ pkg-config --libs --cflags /gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/lib/pkgconfig/msgpack.pc -I/gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/include -I/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/include -L/gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/lib -L/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/lib -lmsgpackc -lz lukas@serenity [env]$ pkg-config --libs --cflags --static /gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/lib/pkgconfig/msgpack.pc -I/gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/include -I/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/include -L/gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/lib -L/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/lib -lmsgpackc -lz lukas@serenity [env]$ guix gc --references /gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1 /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22 /gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1 /gnu/store/v39bh3ln3ncnzhyw0kd12d46kww9747v-gcc-4.9.3-lib lukas@serenity [env]$ ---8<--- cut here -------------------- end ----->8--- So the flags -I, -L, -l for zlib are all there for both dynamic and static linking. But still no store reference. A patch for this last case is attached. IIUC, zlib has to be a propagated input in this case. Do you agree with that? More general, do you think what I did makes sense? I am not really sure if -lz is needed for dynamic linking or not. Also, is it OK to do things like that in a snippet as in the attached patch? Thank you for your help! Best, Lukas