Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107543 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14696 invoked from network); 14 Oct 2019 12:03:23 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 14 Oct 2019 12:03:23 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id A542B2C2E08 for ; Mon, 14 Oct 2019 02:47:15 -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-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (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:47:15 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id c195so11316642lfg.9 for ; Mon, 14 Oct 2019 02:47:14 -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=eHIDHptXBsGeHcnp7bSueAOrE5YS4vJuLU4OHu0sRUg=; b=cHM8ax+02JMyhTBrKFx49aOuU7N2yJ7oPgi3sgOjPUFPG0QaXuxxhcdMeeOL7Qjdl8 +tCXmF5MPTUbKMXSJkWeVq4c3yEmXVaLRi8epOkPP/BdBLEYcHC8Rc/fgLcpUXN/lI7G T5mMA6a/sBYcI1C+B1czt34/BSSRQ2yvHgln/wddL8CQQhgghC58RGHErJ3t5FF/HKuc oCzmVt7n1s5IJwRbRjkzTZbdZ6re91X62jsN2NkySizQpIwMwLHWtuz+TN1IO5S8qvWB aQ4yBil5gPG6uYOaT3sXBKUUlsug4onxglSmqF7wr7yv/sJRbzYyETIzWnixfu22ThNs ZDpw== 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=eHIDHptXBsGeHcnp7bSueAOrE5YS4vJuLU4OHu0sRUg=; b=ju+w7wqHaC+iowCjnjSAD62oo5fSVZu7vm4fAvvkf2GTNNoKVCDh/dk0BYg5HmrRDg +LpQdadZNVeoLiwVRR791c5AOBYr9rKdV5NhsmAjuf3THQd7e+0yJerezJRh3U1X1Dmn z2+BUoFe/uqBIW31+dHrQmWIuY7RObzpfNiYamf+Xt0BwqvoRzZAE771ckIga4ep+390 AQTxJpd1rWlJefxb2ACURDUjPnSwTltKWcgQHWFn6w+MRFgVx4k4DF5YUKRBun50vR8w l4SPjQieDws7gbc4ZQRmmO7wNT4yilhCDuxE004UYWUd+elRH2DNgTTpycPZxY2C6G+9 jpjw== X-Gm-Message-State: APjAAAUmtbUZgzFgpg7HETHWMrq0Q/spxOoIiVX7ynpMDWmyzCo8Z2Id uYlJ4g1tDN3zEZSt0ogX6gNdM3ZiHgxXT1tc7gs= X-Google-Smtp-Source: APXvYqz2FQA0LOSVirpm6vc8aMrEE88VPsTgLk3ZDSNPRT9ats0+YhbWCDawMS2wdsPl3OPIqcH/+Gx0eFAhDKA8jds= X-Received: by 2002:a19:a402:: with SMTP id q2mr16888806lfc.128.1571046433764; Mon, 14 Oct 2019 02:47:13 -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:46:57 +0200 Message-ID: To: "Helmut K. C. Tessarek" Cc: Jan Ehrhardt , PHP internals Content-Type: multipart/alternative; boundary="0000000000009c383f0594dbc0c5" X-Envelope-From: Subject: Re: [PHP-DEV] configure bug with static openssl 1.1.1? - bugid 77288 From: nikita.ppv@gmail.com (Nikita Popov) --0000000000009c383f0594dbc0c5 Content-Type: text/plain; charset="UTF-8" On Mon, Oct 14, 2019 at 11:30 AM Nikita Popov wrote: > 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. > This should be fixed with https://github.com/php/php-src/commit/c518932c0326a938f0fd0254f2adb03b1cddfbca. Now using just ./configure --disable-all --with-openssl OPENSSL_LIBS="-l:libssl.a -l:libcrypto.a -ldl -pthread" works for me. Nikita --0000000000009c383f0594dbc0c5--