Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107542 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 10728 invoked from network); 14 Oct 2019 11:47:09 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 14 Oct 2019 11:47:09 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 29E3A2CA62A for ; Mon, 14 Oct 2019 02:31:01 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: X-Spam-Virus: No Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Mon, 14 Oct 2019 02:30:59 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id r134so11284827lff.12 for ; Mon, 14 Oct 2019 02:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tBlCUWpyZTFOX+s27yKZIwgpIe0PUAMPltxW2x2NRzc=; b=uoSjR5ocRycad7Hev2RNlIYLtKtiMGvUR8DHYEJNqzhvd0xO+zy403PV3vkayWTUR+ UyhmNQqmmAJU64bbuo5DC+/pN1ZlFaJxFR634LTPHxvBvtpceTE9k15Z3D8iVPCAfeRn C205FXerUn+C87OoLRa+IN5nkPI5mAao3T7oJwLi9gM+hJJtwRBq+7np/1mpcVz3iqVG XOG6jR6SjkzKpSdb7DjkR+rv9a1Mnhk98F2No0yGyykSol62JXR7Eo2FCLUAkL22Lf0S A5kAejmZ+2jy1xPuHrf+GhE2uSb8vLNmOhnJ+HEZ0xh3Er12a43+w8Lt3NhZtpAwqF5W VQnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tBlCUWpyZTFOX+s27yKZIwgpIe0PUAMPltxW2x2NRzc=; b=ug+zmQUqbCFVmGGE41ExXSNaiU9ArYdyJV/7d/RQi0gUWszLGuAkzH8NSIv6tm+O4Z fvRuEoFqKdUufXYPLWNDMatrfaUFu9IZs/A1Ud7FyPw2PUrGESqGkFc3q28UMJ7JPfPP X3EbiZpd4oY7ELAznzlg2DnakgD7h0TNvXmQEAaPqAzGPpeXDjnCXEEQQNIS1nN2bTWw k1kT5JDm4GdUS6DtggiFUg7d4YamxH7ZcJ01XMHsYXocwWjbxwR8CKhKl9kXM9w4HGaV Ob3CpfAKBA37SQf0kE5B2hS2A8jQCvRGZ7pLmwnTIw5OzW3aosRLKfkhy4vvU6ZqRZe2 vdJA== X-Gm-Message-State: APjAAAXii/a9sJdRedfzvg9MFie2mUgYq+zXSl7S6GzmWlpAv6ZGECdB Ex6MdVMP+AMoBgGKj/CBxEFioRdaulJ1vhUKEQc= X-Google-Smtp-Source: APXvYqzkx4H2GnKFIPUbgkCNhBN47HkpoeO4aj/D8TE5s8deTZpLb5mOdQ2C+pvafu8J8GunoBGya12B1BbwcfLU1cM= X-Received: by 2002:ac2:4c99:: with SMTP id d25mr17706004lfl.112.1571045458576; Mon, 14 Oct 2019 02:30:58 -0700 (PDT) MIME-Version: 1.0 References: <2e358c47-f07d-2bd0-dcbf-8ee1282f1ea1@evermeet.cx> <79bdc208-876f-ea0c-b529-010fe3d129bb@kippdata.de> <6de046b4-905c-e338-d640-14973a448910@evermeet.cx> <6d37qe5jhtm390dqs45hmgpkdvlm3lgj3i@4ax.com> In-Reply-To: Date: Mon, 14 Oct 2019 11:30:42 +0200 Message-ID: To: "Helmut K. C. Tessarek" Cc: Jan Ehrhardt , PHP internals Content-Type: multipart/alternative; boundary="0000000000007c0a140594db86d5" X-Envelope-From: Subject: Re: [PHP-DEV] configure bug with static openssl 1.1.1? - bugid 77288 From: nikita.ppv@gmail.com (Nikita Popov) --0000000000007c0a140594db86d5 Content-Type: text/plain; charset="UTF-8" On Mon, Oct 14, 2019 at 11:22 AM Nikita Popov wrote: > On Sun, Oct 13, 2019 at 11:04 PM Helmut K. C. Tessarek < > tessarek@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. > Looks like the -pthread stripping happens here: https://github.com/php/php-src/blob/5197d0cd5e1f4581db1beca1260e1315368ea911/build/php.m4#L371-L377 It doesn't get stripped as much as relocated to EXTRA_LDFLAGS (for static builds, for shared it goes into SHARED_LIBADD). However EXTRA_LDFLAGS is only used when linking libraries, while programs use EXTRA_LDFLAGS_PROGRAM. This seems like an oversight, and it should be added to both. Nikita --0000000000007c0a140594db86d5--