Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 699384 - net-misc/openssh-8.0_p1-r4 USE=static with dev-libs/openssl-1.1.1d-r2 - configure: error: *** working libcrypto not found, check config.log
Summary: net-misc/openssh-8.0_p1-r4 USE=static with dev-libs/openssl-1.1.1d-r2 - confi...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-05 18:04 UTC by Nuno
Modified: 2021-02-19 16:56 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/var/tmp/portage/net-misc/openssh-8.0_p1-r4/temp/build.log (build.log.gz,5.06 KB, application/gzip)
2019-11-05 18:05 UTC, Nuno
Details
/var/tmp/portage/net-misc/openssh-8.0_p1-r4/work/openssh-8.0p1/config.log (config.log.gz,31.95 KB, application/gzip)
2019-11-05 18:06 UTC, Nuno
Details
emerge --info '=net-misc/openssh-8.0_p1-r4::gentoo' (emerge-info.txt,8.23 KB, text/plain)
2019-11-05 18:07 UTC, Nuno
Details
emerge --info openssl (openssl_emerge-info.txt,1.43 KB, text/plain)
2019-11-05 18:07 UTC, Nuno
Details
/var/tmp/portage/net-misc/openssh-8.0_p1-r4/work/openssh-8.0p1/config.log after patching -lpthread (config.log.gz,42.39 KB, application/gzip)
2019-11-05 22:24 UTC, Nuno
Details
Patch from Thomas adding -lpthread (bug-699384_lpthread.patch,336 bytes, patch)
2019-11-12 14:27 UTC, Nuno
Details | Diff
valgrind --track-origins=yes -- ./conftest &> valgrind.txt (valgrind.txt,8.66 KB, text/plain)
2020-11-12 19:14 UTC, Nuno
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nuno 2019-11-05 18:04:35 UTC
openssh-7.9_p1-r4 fails with
configure: error: *** Can't find recent OpenSSL libcrypto (see config.log for details) ***

net-misc/openssh-8.0_p1-r4 fails with
configure: error: *** working libcrypto not found, check config.log

Using dev-libs/openssl-1.1.1d-r2 with USE="asm static-libs zlib".

---
USE="static-libs static -pam -pie" emerge -pqv net-misc/openssh
[ebuild   R   ] net-misc/openssh-8.0_p1-r4  USE="X ssl static* -X509 -audit -bindist -debug -hpn -kerberos -ldns -libedit
 -libressl -livecd -pam* -pie* -sctp (-selinux) -test -xmss"
---


config.log (full version attached below):
---
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../
../../../lib64/libcrypto.a(dso_dlfcn.o): in function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x11): warning: Using 'dlopen' in statically linked applications requires at runtime the shared librar
ies from the glibc version used for linking
(...)
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../
../../../lib64/libcrypto.a(threads_pthread.o): in function `CRYPTO_THREAD_get_local':
threads_pthread.c:(.text+0x143): undefined reference to `pthread_getspecific'
collect2: error: ld returned 1 exit status
configure:12634: $? = 1
---
Comment 1 Nuno 2019-11-05 18:05:44 UTC
Created attachment 595074 [details]
/var/tmp/portage/net-misc/openssh-8.0_p1-r4/temp/build.log
Comment 2 Nuno 2019-11-05 18:06:09 UTC
Created attachment 595076 [details]
/var/tmp/portage/net-misc/openssh-8.0_p1-r4/work/openssh-8.0p1/config.log
Comment 3 Nuno 2019-11-05 18:07:27 UTC
Created attachment 595078 [details]
emerge --info '=net-misc/openssh-8.0_p1-r4::gentoo'

note that I currently have openssh installed with USE="-static" but I want to compiled with USE="static"
Comment 4 Nuno 2019-11-05 18:07:55 UTC
Created attachment 595080 [details]
emerge --info openssl
Comment 5 Thomas Deutschmann gentoo-dev Security 2019-11-05 19:54:41 UTC
Please try

--- a/configure.ac
+++ b/configure.ac
@@ -2530,7 +2530,7 @@ AC_ARG_WITH([ssl-engine],
 )

 if test "x$openssl" = "xyes" ; then
-       LIBS="-lcrypto $LIBS"
+       LIBS="-lcrypto -lpthread $LIBS"
        AC_TRY_LINK_FUNC([RAND_add], ,
            [AC_MSG_ERROR([*** working libcrypto not found, check config.log])])
        AC_CHECK_HEADER([openssl/opensslv.h], ,
Comment 6 Nuno 2019-11-05 22:22:26 UTC
(In reply to Thomas Deutschmann from comment #5)
> Please try
> 

Thanks, Thomas!

It helps a bit: after applying that patch (had to chance a few spaces to tabs), it gives a different error in build.log:

checking whether OpenSSL's PRNG is internally seeded... no
checking for PRNGD/EGD socket... not found
configure: error: OpenSSH has no source of random numbers. Please configure OpenSSL with an entropy source or re-run configure using one of 
the --with-prngd-port or --with-prngd-socket options
Comment 7 Nuno 2019-11-05 22:24:12 UTC
Created attachment 595106 [details]
/var/tmp/portage/net-misc/openssh-8.0_p1-r4/work/openssh-8.0p1/config.log after patching -lpthread
Comment 8 Nuno 2019-11-12 14:27:09 UTC
Created attachment 595888 [details, diff]
Patch from Thomas adding -lpthread

/etc/portage/patches/net-misc/openssh-8.0_p1-r4/bug-699384_lpthread.patch

If anyone wants to try it.
Comment 9 Nuno 2020-02-03 17:42:29 UTC
Any update on this? :/
Comment 10 Nuno 2020-02-03 18:06:10 UTC
the newer net-misc/openssh-8.1_p1-r1 is also affected


(...)
checking if openpty correctly handles controlling tty... yes
checking whether AI_NUMERICSERV is declared... yes
checking for getpgrp... yes
checking if getpgrp accepts zero args... yes
configure: error: *** working libcrypto not found, check config.log
Comment 11 Nuno 2020-06-26 19:31:31 UTC
net-misc/openssh-8.3_p1-r2 (currently ~amd64) is still affected:

# USE="static -pam -pie" emerge -1v --buildpkgonly net-misc/openssh --quiet-build=n

(...)

[ebuild     U ~] net-misc/openssh-8.3_p1-r2::gentoo [8.1_p1-r3::gentoo] USE="X ssl static* -X509 -audit -bindist -debug -hpn -kerberos -ldns -libedit -libressl -livecd -pam* -pie* -sctp -security-key% (-selinux) -test -xmss" 1,667 KiB

(...)

checking if SA_RESTARTed signals interrupt select()... yes
checking for getpgrp... yes
checking if getpgrp accepts zero args... yes
configure: error: *** working libcrypto not found, check config.log




config.log says:

(...)

configure:12933: x86_64-pc-linux-gnu-gcc -o conftest -O2 -pipe -march=ivybridge -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -maes -mpclmul -mpopcnt -mavx -msse4.2 -msse4.1 -mrdrnd -mf16c -mfsgsbase -mfxsr -mxsave -mxsaveopt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -mtune=ivybridge -pipe -Wno-error=format-truncation -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wimplicit-fallthrough -fno-strict-aliasing  -ftrapv -fno-builtin-memset -fstack-protector-strong  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -Wl,-O1 -Wl,--as-needed -static -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -fstack-protector-strong -Wl,-O1 -Wl,--as-needed -static conftest.c -lssl -lcrypto -ldl -lutil -lz  >&5
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(dso_dlfcn.o): in function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x13): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(b_addr.o): in function `BIO_lookup_ex':
b_addr.c:(.text+0xcee): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(b_sock.o): in function `BIO_gethostbyname':
b_sock.c:(.text+0x71): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libgcc_eh.a(unwind-dw2.o): in function `__gthread_once':
/var/tmp/portage/sys-devel/gcc-9.3.0/work/build/x86_64-pc-linux-gnu/libgcc/./gthr-default.h:700: undefined reference to `pthread_once'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(threads_pthread.o): in function `CRYPTO_THREAD_lock_new':
threads_pthread.c:(.text+0x46): undefined reference to `pthread_rwlock_init'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(threads_pthread.o): in function `CRYPTO_THREAD_read_lock':
threads_pthread.c:(.text+0x85): undefined reference to `pthread_rwlock_rdlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(threads_pthread.o): in function `CRYPTO_THREAD_write_lock':
threads_pthread.c:(.text+0xa5): undefined reference to `pthread_rwlock_wrlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(threads_pthread.o): in function `CRYPTO_THREAD_unlock':
threads_pthread.c:(.text+0xc5): undefined reference to `pthread_rwlock_unlock'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(threads_pthread.o): in function `CRYPTO_THREAD_lock_free':
threads_pthread.c:(.text+0xea): undefined reference to `pthread_rwlock_destroy'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(threads_pthread.o): in function `CRYPTO_THREAD_run_once':
threads_pthread.c:(.text+0x115): undefined reference to `pthread_once'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(threads_pthread.o): in function `CRYPTO_THREAD_init_local':
threads_pthread.c:(.text+0x135): undefined reference to `pthread_key_create'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(threads_pthread.o): in function `CRYPTO_THREAD_set_local':
threads_pthread.c:(.text+0x167): undefined reference to `pthread_setspecific'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(threads_pthread.o): in function `CRYPTO_THREAD_cleanup_local':
threads_pthread.c:(.text+0x187): undefined reference to `pthread_key_delete'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(threads_pthread.o): in function `openssl_init_fork_handlers':
threads_pthread.c:(.text+0x1e3): undefined reference to `pthread_once'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/libcrypto.a(threads_pthread.o): in function `CRYPTO_THREAD_get_local':
threads_pthread.c:(.text+0x153): undefined reference to `pthread_getspecific'
collect2: error: ld returned 1 exit status
configure:12933: $? = 1

(...)
Comment 12 Nuno 2020-11-12 19:14:37 UTC
Created attachment 671131 [details]
valgrind --track-origins=yes  -- ./conftest &> valgrind.txt

net-misc/openssh-8.4_p1-r2 (~amd64) still affected

[ebuild     U ] net-misc/openssh-8.4_p1-r2 [8.1_p1-r4] USE="X scp%* ssl static* -X509 -audit -bindist -debug -hpn -kerberos -ldns -libedit -libressl -livecd -pam* -pie* -sctp -security-key% (-selinux) -test -xmss"

(...)
checking if openpty correctly handles controlling tty... yes
checking whether AI_NUMERICSERV is declared... yes
checking if SA_RESTARTed signals interrupt select()... yes
checking for getpgrp... yes
checking if getpgrp accepts zero args... yes
configure: error: *** working libcrypto not found, check config.log


Applying Thomas' patch (attachment 595888 [details, diff]) results in the same as openssh-8.0p1:

(...)
checking for ia_openinfo in -liaf... no
checking whether OpenSSL's PRNG is internally seeded... no
checking for PRNGD/EGD socket... not found
configure: error: OpenSSH has no source of random numbers. Please configure OpenSSL with an entropy source or re-run configure using one of the --with-prngd-port or --with-prngd-socket options


Upon investigating, this fails not because there is no PRNG, but because the test program exits with 139 (Segmentation fault).

Running the test program (conftest) using gdb, it segfauls before entering main():

(gdb) break main
Breakpoint 1 at 0x402dcd: file conftest.c, line 317.
(gdb) r
Starting program: /tmp/conftest 

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()


Using valgrind:

==2369== Conditional jump or move depends on uninitialised value(s)                                                    
==2369==    at 0x593398: malloc (malloc.c:3044)                                                                        
==2369==    by 0x5E3E4A: _dl_get_origin (dl-origin.c:50)                                                               
==2369==    by 0x5E7DC0: _dl_non_dynamic_init (dl-support.c:311)                                                       
==2369==    by 0x5EA891: __libc_init_first (init-first.c:74)                                                           
==2369==    by 0x5751C1: (below main) (libc-start.c:244)
(...)

==2369== Jump to the invalid address stated on the next line
==2369==    at 0x0: ???
==2369==    by 0x57453B: __gthread_mutex_lock (gthr-default.h:749)
==2369==    by 0x57453B: __register_frame_info_bases.part.0 (unwind-dw2-fde.c:103)
==2369==    by 0x402DBC: ??? (in /tmp/conftest)
==2369==    by 0x575903: __libc_csu_init (elf-init.c:88)
==2369==    by 0x5751F6: (below main) (libc-start.c:264)
==2369==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==2369== 
==2369==
==2369== Process terminating with default action of signal 11 (SIGSEGV)
==2369==  Bad permissions for mapped region at address 0x0
==2369==    at 0x0: ???
==2369==    by 0x57453B: __gthread_mutex_lock (gthr-default.h:749)
==2369==    by 0x57453B: __register_frame_info_bases.part.0 (unwind-dw2-fde.c:103)
==2369==    by 0x402DBC: ??? (in /tmp/conftest)
==2369==    by 0x575903: __libc_csu_init (elf-init.c:88)
==2369==    by 0x5751F6: (below main) (libc-start.c:264)

Complete valgrind output attached.
I hope this helps somewhat. I don't know where to go from here :/

I can provide the config.log if anyone wants to look at it.
Comment 13 Nathan Shearer 2021-02-19 16:40:05 UTC
net-misc/openssh-8.4_p1-r3 is also affected by this.