On Sun, Oct 13, 2019 at 11:04 PM Helmut K. C. Tessarek <tessa...@evermeet.cx> wrote:
> On 2019-10-13 17:00, Nikita Popov wrote: > > Don't know about previous versions, but at least on 7.4 setting > > OPENSSL_CFLAGS and OPENSSL_LIBS appropriately (e.g. using pkg-config > > --static --cflags/--libs return values) should work. These environment > > variables allow you to bypass normal pkg-config checks, which are > generally > > going to be non-static. > > I've tried pretty much anything, so if you have flags and env vars that > work, > please post them here. > Here's what pkg-config --static tells me on my system: -lssl -lcrypto -ldl -pthread So I use this for OPENSSL_LIBS, while explicitly requesting the static .a libs (on the assumption that only openssl should be linked statically, not all libs): ./configure --disable-all --with-openssl OPENSSL_LIBS="-l:libssl.a -l:libcrypto.a -ldl -pthread" configure passes, but then during linking I get: /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libcrypto.a(threads_pthread.o): undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5' It looks like the "-pthread" flag gets stripped. Then I tried: ./configure --disable-all --with-openssl OPENSSL_LIBS="-l:libssl.a -l:libcrypto.a -ldl" CFLAGS="-pthread" This compiles successfully. > ldd sapi/cli/php linux-vdso.so.1 (0x00007ffd1531f000) libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f04b79a9000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f04b77a1000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f04b7403000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f04b71ff000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f04b6fe0000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f04b6bef000) /lib64/ld-linux-x86-64.so.2 (0x00007f04b8bee000) The fact that "-pthread" gets stripped from LIBS might be a bug. Hope this helps, Nikita