Trying to install PHP but gives 'undefined reference to symbol' error

seb_dev

Verified User
Joined
Jan 27, 2021
Messages
10
Hi there,

I'm trying to install php 7.4 (7.4.26) on our CentOS 7.9 server with DirectAdmin 1.63.0 and custombuild 2.0 but I get the following error at the end of build:
Code:
/usr/bin/ld: /usr/local/lib64/libcrypto.a(threads_pthread.o): undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
/usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
make: *** Waiting for unfinished jobs....
/usr/bin/ld: /usr/local/lib64/libcrypto.a(threads_pthread.o): undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
/usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sapi/litespeed/php] Error 1
/usr/bin/ld: /usr/local/lib64/libcrypto.a(threads_pthread.o): undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
/usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sapi/fpm/php-fpm] Error 1

Any idea how to fix this?

Thanks in advance.
 
Is that a pure one or do you have made any customisations somewhere to include (or add to compile) things?
 
There are no customizations to php.

This is just done by doing:
Code:
cd /usr/local/directadmin/custombuild
./build php
 
/usr/local/lib64/libcrypto.a - it looks like a custom installation of OpenSSL from the source, DA doesn't do this.
 
you are on the hell ( like me in the past ) :D, But I learning a lot of how to management/adjust/custom complier script,system ..etc..,

when do it on VM, ensure you create Snapshot before do anything.

In this case, you have 2 options, Manual remove Openssl 1.1.1 or recomplier with support version.
 
Any idea what command to type to fix this?

When I do yum install openssl I can see the following:
Code:
Package 1:openssl-1.0.2k-22.el7_9.x86_64 already installed and latest version

But when I run openssl version -a it shows:
Code:
OpenSSL 1.1.1g  21 Apr 2020
built on: Fri Nov 19 13:51:43 2021 UTC
platform: linux-x86_64
options:  bn(64,64) rc4(16x,int) des(int) idea(int) blowfish(ptr)
compiler: gcc -fPIC -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG
OPENSSLDIR: "/usr/ssl"
ENGINESDIR: "/usr/lib64/engines-1.1"
Seeding source: os-specific

Maybe can be fixed by changing the symlink with ln?
 
Last edited:
Okay so now when I run openssl version -a it shows:
Code:
OpenSSL 1.0.2k-fips  26 Jan 2017
built on: reproducible build, date unspecified
platform: linux-x86_64
options:  bn(64,64) md2(int) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx)
compiler: gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DKRB5_MIT -m64 -DL_ENDIAN -Wall -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -Wa,--noexecstack -DPURIFY -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/etc/pki/tls"
engines:  dynamic

But I still get this error:
Code:
/usr/bin/ld: /usr/local/lib64/libcrypto.a(threads_pthread.o): undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5

Here you can see all the symlinks (output for /usr/lib64 ls -l)
 
yeah, that still use 1.1.1 ( /usr/local/*)
Base OS openssl will use in (/usr/*)

You need to move anything relate to 1.1.1 /usr/local/(lib, lib64) to other path ( for temporary testing, if not sure will conflic with other script when removing)

if out of idea, Please reinstall OS and use AlmaLinux or RockyLinux or anyelse that have 1.1.1 version base OS.
 
GLIBC_2.2.5
Do you also have Glibc 2.2.5 installed customly?
Because on Centos 7 the Glibc is version 2.17 so it might be glibc 2.2.5 is calling the wrong part.

You might need to remove glibc and install via yum the 2.17 version.

Or like jamgames2 said, use the script to upgrade to Almalinux.
Or reinstall with other OS.
Be sure to create backups before.
 
Back
Top