# configure bug with static openssl 1.1.1?

- Thread: https://externals.io/message/103582
- Original archive: https://news-web.php.net/php.internals/103582
- Started by Helmut K. C. Tessarek on 2018-12-08T21:43:55+00:00
- Messages: 27
- Page 1 of 2: messages 1 to 25 (25 per page, add `?page=N` to the URL)
- Next page: https://externals.io/message/103582.md?page=2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #103582 — Helmut K. C. Tessarek — 2018-12-08T21:43:55+00:00

URL: https://externals.io/message/103582#103582

Please don't bite my head off for posting to the internals list, but I
think it is a bug in configure. If it is not, I'm more than happy to
post it in the users group.

I run into an error when trying to configure PHP 7.2.13 with a static
openssl 1.1.1. The strange thing however is that using a static openssl
1.0.2 works.

The error is as follows:

checking for OpenSSL version... >= 1.0.1
checking for CRYPTO_free in -lcrypto... yes
checking for SSL_CTX_set_ssl_version in -lssl... no
configure: error: libssl not found!

I've also tried to set:
export PKG_CONFIG_PATH=/usr/local/ssl-1.1.1/lib/pkgconfig/

But it did not help.

Here's my config.log: https://evermeet.cx/pub/logs/config.log

(I've compiled Apache httpd successfully against this static openssl
1.1.1 version, so I know that it works.)

Has someone seen this issue before? Any ideas why this is happening?

Cheers,
  K. C.

-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the `NULL` pointer for chaos and madness
   await thee at its end.
*/

---

## #103593 — Helmut K. C. Tessarek — 2018-12-12T14:58:19+00:00

URL: https://externals.io/message/103582#103593 · In reply to: #103582

> Please don't bite my head off for posting to the internals list, but I
> think it is a bug in configure. If it is not, I'm more than happy to
> post it in the users group.
> 
> I run into an error when trying to configure PHP 7.2.13 with a static
> openssl 1.1.1. The strange thing however is that using a static openssl
> 1.0.2 works.
> 
> The error is as follows:
> 
> checking for OpenSSL version... >= 1.0.1
> checking for CRYPTO_free in -lcrypto... yes
> checking for SSL_CTX_set_ssl_version in -lssl... no
> configure: error: libssl not found!
> 
> I've also tried to set:
> export PKG_CONFIG_PATH=/usr/local/ssl-1.1.1/lib/pkgconfig/
> 
> But it did not help.
> 
> Here's my config.log: https://evermeet.cx/pub/logs/config.log
> 
> (I've compiled Apache httpd successfully against this static openssl
> 1.1.1 version, so I know that it works.)
> 
> Has someone seen this issue before? Any ideas why this is happening?
> 
> Cheers,
>   K. C.
> 

It seems that nobody thinks this belongs in this group.

Can anyone tell me where I should post this question to?
To the General user list, or the Installation issues and problems list?

Cheers,
  K. C.

---

## #103594 — Jakub Zelenka — 2018-12-12T15:11:47+00:00

URL: https://externals.io/message/103582#103594 · In reply to: #103593

On Wed, Dec 12, 2018 at 2:58 PM Helmut K. C. Tessarek <tessarek@evermeet.cx>
wrote:

> 
> > […]
>
> It seems that nobody thinks this belongs in this group.
>
> Can anyone tell me where I should post this question to?
> To the General user list, or the Installation issues and problems list?
>

You should create a bug report.

Please note that a static configuration has some issues (e.g.
https://bugs.php.net/bug.php?id=73609 and think there were more issues
maybe). Basically it's not well supported so I would recommend to do a
shared build instead otherwise you are probably on your own unless someone
finds time to look into it.

Cheers

Jakub

---

## #103595 — Helmut K. C. Tessarek — 2018-12-12T15:32:35+00:00

URL: https://externals.io/message/103582#103595 · In reply to: #103594

> 
> You should create a bug report.
> 
> Please note that a static configuration has some issues (e.g.
> https://bugs.php.net/bug.php?id=73609 and think there were more issues
> maybe). Basically it's not well supported so I would recommend to do a
> shared build instead otherwise you are probably on your own unless
> someone finds time to look into it.

Thanks, Jakub for your reply.

Hmm, I checked the link you sent, but this ticket has nothing to do with
linking against a static openssl library.

This ticket mentions that openssl is not supported as a shared
extension. But that is not what I'm doing.

I try to link against a static openssl library. But it works when
linking against a static openssl 1.0.2 lib.
Therefore I highly suspect that there's a problem with configure. But I
will open a ticket, and I will also try to link against a dynamic
openssl 1.1.1.

So linking against a static openssl 1.0.2 works, but against a static
openssl 1.1.1 does not work.

However, linking against a static openssl library should be supported.
Years back people even suggested to always link against a static openssl
lib because of security reasons (no hijacking of dynamic libs and
whatnot). This might not be relevant anymore, but there's no logical
reason why linking against a static openssl 1.1.1 should not work.

Cheers,
  K. C.

---

## #103596 — Jakub Zelenka — 2018-12-12T15:37:49+00:00

URL: https://externals.io/message/103582#103596 · In reply to: #103595

On Wed, Dec 12, 2018 at 3:32 PM Helmut K. C. Tessarek <tessarek@evermeet.cx>
wrote:

> 
> > […]
>
> Thanks, Jakub for your reply.
>
> Hmm, I checked the link you sent, but this ticket has nothing to do with
> linking against a static openssl library.
>
> This ticket mentions that openssl is not supported as a shared
> extension. But that is not what I'm doing.
>
> I try to link against a static openssl library. But it works when
> linking against a static openssl 1.0.2 lib.
> Therefore I highly suspect that there's a problem with configure. But I
> will open a ticket, and I will also try to link against a dynamic
> openssl 1.1.1.
>
> So linking against a static openssl 1.0.2 works, but against a static
> openssl 1.1.1 does not work.
>
> However, linking against a static openssl library should be supported.
> Years back people even suggested to always link against a static openssl
> lib because of security reasons (no hijacking of dynamic libs and
> whatnot). This might not be relevant anymore, but there's no logical
> reason why linking against a static openssl 1.1.1 should not work.
>
>
Ah I see! Yeah I think it should work so it might be a bug if it doesn't. I
would suggest to create a bug report.

Cheers

Jakub

---

## #103597 — Helmut K. C. Tessarek — 2018-12-12T15:40:16+00:00

URL: https://externals.io/message/103582#103597 · In reply to: #103596

> On Wed, Dec 12, 2018 at 3:32 PM Helmut K. C. Tessarek
> <tessarek@evermeet.cx <mailto:tessarek@evermeet.cx>> wrote:
> 
>     
> > […]
> 
>     Thanks, Jakub for your reply.
> 
>     Hmm, I checked the link you sent, but this ticket has nothing to do with
>     linking against a static openssl library.
> 
>     This ticket mentions that openssl is not supported as a shared
>     extension. But that is not what I'm doing.
> 
>     I try to link against a static openssl library. But it works when
>     linking against a static openssl 1.0.2 lib.
>     Therefore I highly suspect that there's a problem with configure. But I
>     will open a ticket, and I will also try to link against a dynamic
>     openssl 1.1.1.
> 
>     So linking against a static openssl 1.0.2 works, but against a static
>     openssl 1.1.1 does not work.
> 
>     However, linking against a static openssl library should be supported.
>     Years back people even suggested to always link against a static openssl
>     lib because of security reasons (no hijacking of dynamic libs and
>     whatnot). This might not be relevant anymore, but there's no logical
>     reason why linking against a static openssl 1.1.1 should not work.
> 
> 
> Ah I see! Yeah I think it should work so it might be a bug if it
> doesn't. I would suggest to create a bug report.

Will do.

Thanks,
  K. C.

---

## #103605 — Rainer Jung — 2018-12-13T16:52:33+00:00

URL: https://externals.io/message/103582#103605 · In reply to: #103596

Am 12.12.2018 um 16:37 schrieb Jakub Zelenka:
> On Wed, Dec 12, 2018 at 3:32 PM Helmut K. C. Tessarek <tessarek@evermeet.cx>
> wrote:
> 
> > […]
> Ah I see! Yeah I think it should work so it might be a bug if it doesn't. I
> would suggest to create a bug report.
> 
> Cheers
> 
> Jakub

I might be wrong, but I vaguely remember that PHp does not call 
"pkg-config --static --libs openssl" with a correctly setup 
PKG_CONFIG_PAATZ to get the libs needed for static compilation. 
Typically OpenSSL installs correct pc files that contain pthread as such 
a dependency. Without asking pkg-config some fixed decisin logic would 
need to find all the needed libs.

Regards,

Rainer

---

## #103606 — Helmut K. C. Tessarek — 2018-12-13T17:39:50+00:00

URL: https://externals.io/message/103582#103606 · In reply to: #103605

> 
> I might be wrong, but I vaguely remember that PHp does not call
> "pkg-config --static --libs openssl" with a correctly setup
> PKG_CONFIG_PAATZ to get the libs needed for static compilation.
> Typically OpenSSL installs correct pc files that contain pthread as such
> a dependency. Without asking pkg-config some fixed decisin logic would
> need to find all the needed libs.

Thanks for the reply.

I've opened a bug: https://bugs.php.net/bug.php?id=77288

Yep, the following entry is in the .pc file for libcrypto:
Libs.private: -ldl -pthread

Cheers,
  K. C.

---

## #104286 — Helmut K. C. Tessarek — 2019-02-07T12:39:11+00:00

URL: https://externals.io/message/103582#104286

Hello,


> I might be wrong, but I vaguely remember that PHp does not call
> "pkg-config --static --libs openssl" with a correctly setup
> PKG_CONFIG_PAATZ to get the libs needed for static compilation.
> Typically OpenSSL installs correct pc files that contain pthread as such
> a dependency. Without asking pkg-config some fixed decisin logic would
> need to find all the needed libs.

I'd like to follow up on bug https://bugs.php.net/bug.php?id=77288

It's not stated in the documentation anywhere that a static openssl is
not supported.
It's ok, if devs don't have the time to look into it right away, but
I've opened this bug 2 months ago, and it would be nice, if someone
could at least acknowledge the bug and/or give some sort of a feedback.

If PHP does not support static openssl, please change the documentation
accordingly.

However, it's wotking with openssl 1.0.2, so I must assume that there's
a bug somewhere otherwise it would work with openssl 1.1.1 as well.

Cheers,
  K. C.

-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the `NULL` pointer for chaos and madness
   await thee at its end.
*/

---

## #104514 — Jakub Zelenka — 2019-02-24T15:19:56+00:00

URL: https://externals.io/message/103582#104514

On Thu, Feb 7, 2019 at 12:39 PM Helmut K. C. Tessarek <tessarek@evermeet.cx>
wrote:

> Hello,
>
> 
> > […]
>
> I'd like to follow up on bug https://bugs.php.net/bug.php?id=77288
>
> It's not stated in the documentation anywhere that a static openssl is
> not supported.
> It's ok, if devs don't have the time to look into it right away, but
> I've opened this bug 2 months ago, and it would be nice, if someone
> could at least acknowledge the bug and/or give some sort of a feedback.
>
> If PHP does not support static openssl, please change the documentation
> accordingly.
>
> However, it's wotking with openssl 1.0.2, so I must assume that there's
> a bug somewhere otherwise it would work with openssl 1.1.1 as well.
>
>
Looks like a bug. Just not the highest priority for me atm.

---

## #104515 — Helmut K. C. Tessarek — 2019-02-24T21:55:49+00:00

URL: https://externals.io/message/103582#104515

Thanks for the reply.


> Looks like a bug. Just not the highest priority for me atm.

It would be great, if you could add that info to the bug. e.g. change the
status to verified, change priority to low, severity to high (since you can't
use PHP with a static openssl 1.1.1).

Cheers,
  K. C.

-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the `NULL` pointer for chaos and madness
   await thee at its end.
*/

---

## #107529 — Jan Ehrhardt — 2019-10-13T20:50:58+00:00

URL: https://externals.io/message/103582#107529 · In reply to: #104286

"Helmut K. C. Tessarek" in php.internals (Thu, 7 Feb 2019 13:39:11
+0100):
>
> > […]
>
>I'd like to follow up on bug https://bugs.php.net/bug.php?id=77288
>
>It's not stated in the documentation anywhere that a static openssl is
>not supported.
>It's ok, if devs don't have the time to look into it right away, but
>I've opened this bug 2 months ago, and it would be nice, if someone
>could at least acknowledge the bug and/or give some sort of a feedback.
>
>If PHP does not support static openssl, please change the documentation
>accordingly.
>
>However, it's wotking with openssl 1.0.2, so I must assume that there's
>a bug somewhere otherwise it would work with openssl 1.1.1 as well.

Did you ever find a solution to compile PHP with a static OpenSSL 1.1.1?
-- 
Jan

---

## #107530 — Helmut K. C. Tessarek — 2019-10-13T20:59:49+00:00

URL: https://externals.io/message/103582#107530 · In reply to: #107529

> Did you ever find a solution to compile PHP with a static OpenSSL 1.1.1?

Unfortunately not. I really hoped that someone would look into it, but I guess
security is not that important.

-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the `NULL` pointer for chaos and madness
   await thee at its end.
*/

---

## #107531 — Nikita Popov — 2019-10-13T21:00:43+00:00

URL: https://externals.io/message/103582#107531 · In reply to: #107529

> "Helmut K. C. Tessarek" in php.internals (Thu, 7 Feb 2019 13:39:11
> +0100):
> > […]
>
> Did you ever find a solution to compile PHP with a static OpenSSL 1.1.1?
> --
> Jan
>

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.

Nikita

---

## #107532 — Helmut K. C. Tessarek — 2019-10-13T21:04:01+00:00

URL: https://externals.io/message/103582#107532 · In reply to: #107531

> 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.

-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the `NULL` pointer for chaos and madness
   await thee at its end.
*/

---

## #107537 — Rainer Jung — 2019-10-14T08:12:12+00:00

URL: https://externals.io/message/103582#107537 · In reply to: #107532

Am 13.10.2019 um 23:04 schrieb Helmut K. C. Tessarek:
> 
> > […]
> 
> I've tried pretty much anything, so if you have flags and env vars that work,
> please post them here.

I think what he means is doing:

% export PKG_CONFIG_PATH=/path/to/my/openssl111/pkgconfig

where that directory should contain the pc files from your OpenSSL 1.1.1 
installation.

Then (example, you results may vary):

% pkg-config --cflags openssl

-I/path/to/my/openssl111/include

So you would set

export OPENSSL_CFLAGS=/path/to/my/openssl111/include

and then

% pkg-config --libs --static openssl

-L/path/to/my/openssl111/lib -lssl -lcrypto -ldl -pthread

so you would set

export OPENSSL_LIBS="-L/path/to/my/openssl111/lib -lssl -lcrypto -ldl 
-pthread"

You might try with the values you get back from the above pkg-config 
command on your system.

If it doesn't work, it would be helpful, if you could then post again 
your config.log so we can understand the remaining problems.

Regards,

Rainer

---

## #107538 — Rainer Jung — 2019-10-14T08:14:20+00:00

URL: https://externals.io/message/103582#107538 · In reply to: #107537

Am 14.10.2019 um 10:12 schrieb Rainer Jung:
> Am 13.10.2019 um 23:04 schrieb Helmut K. C. Tessarek:
> > […]
> 
> I think what he means is doing:
> 
> % export PKG_CONFIG_PATH=/path/to/my/openssl111/pkgconfig
> 
> where that directory should contain the pc files from your OpenSSL 1.1.1 
> installation.
> 
> Then (example, you results may vary):
> 
> % pkg-config --cflags openssl
> 
> -I/path/to/my/openssl111/include
> 
> So you would set
> 
> export OPENSSL_CFLAGS=/path/to/my/openssl111/include
> 
> and then
> 
> % pkg-config --libs --static openssl
> 
> -L/path/to/my/openssl111/lib -lssl -lcrypto -ldl -pthread
> 
> so you would set
> 
> export OPENSSL_LIBS="-L/path/to/my/openssl111/lib -lssl -lcrypto -ldl 
> -pthread"
> 
> You might try with the values you get back from the above pkg-config 
> command on your system.
> 
> If it doesn't work, it would be helpful, if you could then post again 
> your config.log so we can understand the remaining problems.

Addition to self:

plus temporarily rename libssl.so and libcrypto.so during the PHP build, 
e.g. adding a trailing underscore. The versioned *.so.* files can stay 
in place, just not *.so.

Regards,

Rainer

---

## #107540 — Helmut K. C. Tessarek — 2019-10-14T09:06:59+00:00

URL: https://externals.io/message/103582#107540 · In reply to: #107537

Hello,


> I think what he means is doing:

Yep, I remember I had tried that as well, but I just went through it again to
get the info you requested:

export PKG_CONFIG_PATH=/usr/local/ssl-1.1.1/lib/pkgconfig
export OPENSSL_CFLAGS="-I/usr/local/ssl-1.1.1/include"
export OPENSSL_LIBS="-L/usr/local/ssl-1.1.1/lib -lssl -lcrypto -ldl -pthread"

> If it doesn't work, it would be helpful, if you could then post again your
> config.log so we can understand the remaining problems.

https://evermeet.cx/pub/logs/config.php72.log

Cheers,
 K. C.

-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the `NULL` pointer for chaos and madness
   await thee at its end.
*/

---

## #107541 — Nikita Popov — 2019-10-14T09:22:24+00:00

URL: https://externals.io/message/103582#107541 · In reply to: #107532

On Sun, Oct 13, 2019 at 11:04 PM Helmut K. C. Tessarek <tessarek@evermeet.cx>
wrote:

> 
> > […]
> generally
> > […]
>
> 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

---

## #107542 — Nikita Popov — 2019-10-14T09:30:42+00:00

URL: https://externals.io/message/103582#107542 · In reply to: #107541

> On Sun, Oct 13, 2019 at 11:04 PM Helmut K. C. Tessarek <
> tessarek@evermeet.cx> wrote:
>
> > […]
>
> 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.
>
> > […]
> 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

---

## #107543 — Nikita Popov — 2019-10-14T09:46:57+00:00

URL: https://externals.io/message/103582#107543 · In reply to: #107542

> On Mon, Oct 14, 2019 at 11:22 AM Nikita Popov <nikita.ppv@gmail.com>
> wrote:
>
> > […]
>
> 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

---

## #107544 — Rainer Jung — 2019-10-14T11:01:47+00:00

URL: https://externals.io/message/103582#107544 · In reply to: #107540

Am 14.10.2019 um 11:06 schrieb Helmut K. C. Tessarek:
> Hello,
> 
> 
> > […]
> 
> Yep, I remember I had tried that as well, but I just went through it again to
> get the info you requested:
> 
> export PKG_CONFIG_PATH=/usr/local/ssl-1.1.1/lib/pkgconfig
> export OPENSSL_CFLAGS="-I/usr/local/ssl-1.1.1/include"
> export OPENSSL_LIBS="-L/usr/local/ssl-1.1.1/lib -lssl -lcrypto -ldl -pthread"
> 
> > […]
> 
> https://evermeet.cx/pub/logs/config.php72.log

Thanks, the relevant lines are:

configure:18782: cc -o conftest -I/usr/local/include -fvisibility=hidden 
  -Wl,-rpath,/usr/local/ssl-1.1.1/lib -L/usr/local/ssl-1.1.1/lib 
-L/usr/local/lib conftest.c -lcrypto  -lrt -lm -ldl -lnsl -lgpg-error 
-lsystemd-daemon -lxml2 -lz -lm -ldl >&5
configure:18782: $? = 0
configure:18791: result: yes
configure:18934: checking for SSL_CTX_set_ssl_version in -lssl
configure:18959: cc -o conftest -I/usr/local/include -fvisibility=hidden 
  -Wl,-rpath,/usr/local/ssl-1.1.1/lib -L/usr/local/ssl-1.1.1/lib 
-L/usr/local/lib conftest.c -lssl  -lcrypto -lrt -lm -ldl -lnsl 
-lgpg-error -lsystemd-daemon -lxml2 -lz -lm -ldl -lcrypto >&5
/bin/ld: /usr/local/ssl-1.1.1/lib/libcrypto.a(threads_pthread.o): 
undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
/bin/ld: note: 'pthread_rwlock_wrlock@@GLIBC_2.2.5' is defined in DSO 
/lib64/libpthread.so.0 so try adding it to the linker command line
/lib64/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
configure:18959: $? = 1
configure: failed program was:

So although "-pthread" is part of OPENSSL_LIBS, it doesn't get used 
during configure (which uses hard-coded 'LIBS=" -lssl -lcrypto 
`$PKG_CONFIG --libs openssl`   $LIBS"' in this check). So a checken or 
egg problem.

Could you do yet another test? First manipulate the configure script 
with the following two commands:

cp -p configure configure.saved

# the following is one long line

sed -e 's#PKG_CONFIG --libs openssl#PKG_CONFIG --libs --static 
openssl#g' configure.saved > configure


and then redo the whole build including running configure. If that works 
fine, it might be possible to add a configure flag for static OpenSSL 
linking.

Thanks and regards,

Rainer

---

## #107622 — Helmut K. C. Tessarek — 2019-10-22T03:28:50+00:00

URL: https://externals.io/message/103582#107622 · In reply to: #107544

> Could you do yet another test? First manipulate the configure script with the
> following two commands:
> 
> cp -p configure configure.saved
> 
> # the following is one long line
> 
> sed -e 's#PKG_CONFIG --libs openssl#PKG_CONFIG --libs --static openssl#g'
> configure.saved > configure
> 
> 
> and then redo the whole build including running configure. If that works fine,
> it might be possible to add a configure flag for static OpenSSL linking.

Sorry that it took so long.

Nope, this didn't help either. here's the log:
https://evermeet.cx/pub/logs/config.php72.1.log

Cheers,
  K. C.

-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the `NULL` pointer for chaos and madness
   await thee at its end.
*/

---

## #107623 — Helmut K. C. Tessarek — 2019-10-22T03:34:58+00:00

URL: https://externals.io/message/103582#107623 · In reply to: #107543

> 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.

Hmm, I can't get it to work. My ssl is in: /usr/local/ssl-1.1.1

Cheers,
  K. C.

-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the `NULL` pointer for chaos and madness
   await thee at its end.
*/

---

## #107624 — Rainer Jung — 2019-10-22T06:32:17+00:00

URL: https://externals.io/message/103582#107624 · In reply to: #107622

Am 22.10.2019 um 05:28 schrieb Helmut K. C. Tessarek:
> 
> > […]
> 
> Sorry that it took so long.
> 
> Nope, this didn't help either. here's the log:
> https://evermeet.cx/pub/logs/config.php72.1.log

I am sorry, error on my side. I forgot I had already adjusted configure 
myself, so the above sed wouldn't change anything in the original file 
(you can also diff the original and the new file to see the outcome of 
the sed command yourself).

If you are willing for another round:

# The next line only if configure.saved
# no longer exists from the previous try
cp -p configure configure.saved

# The sed command here is three lines,
# the first two of them continued by a
# backslash at the end of line
sed -e 's/\(LIBS=.*\)-lssl \(.*\)/\1 -lssl -lcrypto \2/' \
     -e 's/\(LIBS=.*-lssl  *-lcrypto\)\(.*\)/\1 `$PKG_CONFIG --libs 
--static openssl` \2/' \
     configure.saved > configure

If it doesn't work, then please again give us the config.log plus the 
"diff configure.saved configure".

Regards,

Rainer

---

Next page: https://externals.io/message/103582.md?page=2
