I'm doing a compilation of PHP for an application with make. The problem is when I do a ldd php I have something like this:
libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f5b4e661000)
But libk5crypto.so.3 is a symlic that point to libk5crypto.so.3.1
I would like my php to point directly to libk5crypto.so.3.1.
Is-it possible ?
EDIT: I have a web application with a php server that I compile myself. I don't want to install it in /etc, I just want it to be inside my application.
Inside my application I have a folder named server where I store php, fop, mapserver etc...
Inside my php folder, I have a lib folder and inside I put all dependencies (ldd bin/php)
When I install my application, I modify the file /etc/ld.so.conf to add the lib dir from my php server, then I do a ldconfig.
Sometimes the libs already exists in /usr/lib/x86_64-linux-gnu and PHP take this libs instead the one on his folder. It's nearly not a problem, but sometimes I have a lib inside /usr/lib... that have the same major version but has a lower minor version. PHP tries to get it from /usr/lib and thrown me an error because php was copile with the newest dependencies.
Is for that reason that I want to point to libk5crypto.so.3.1 directly.
When I update my application, I delete my php and I put a newer one with all the new libs.
Another things, I try to tell PHP to look the libs in a given directory, but my problem I don't know where it will be at compile time.
EDIT for JigglyNaga : I compile PHP, Then I compile imap and others extensions. The problem is with php and the extension. So the compilation is shorter for imap so I give you all.
root@ubuntu16:~/compilPHP/php-7.2.2/ext/imap# make
/bin/bash /root/compilPHP/php-7.2.2/ext/imap/libtool --mode=compile cc -I. -I/root/compilPHP/php-7.2.2/ext/imap -DPHP_ATOM_INC -I/root/compilPHP/php-7.2.2/ext/imap/include -I/root/compilPHP/php-7.2.2/ext/imap/main -I/root/compilPHP/php-7.2.2/ext/imap -I/php/include/php -I/php/include/php/main -I/php/include/php/TSRM -I/php/include/php/Zend -I/php/include/php/ext -I/php/include/php/ext/date/lib -I/usr/include/c-client -DHAVE_CONFIG_H -g -O2 -c /root/compilPHP/php-7.2.2/ext/imap/php_imap.c -o php_imap.lo
mkdir .libs
cc -I. -I/root/compilPHP/php-7.2.2/ext/imap -DPHP_ATOM_INC -I/root/compilPHP/php-7.2.2/ext/imap/include -I/root/compilPHP/php-7.2.2/ext/imap/main -I/root/compilPHP/php-7.2.2/ext/imap -I/php/include/php -I/php/include/php/main -I/php/include/php/TSRM -I/php/include/php/Zend -I/php/include/php/ext -I/php/include/php/ext/date/lib -I/usr/include/c-client -DHAVE_CONFIG_H -g -O2 -c /root/compilPHP/php-7.2.2/ext/imap/php_imap.c -fPIC -DPIC -o .libs/php_imap.o
/bin/bash /root/compilPHP/php-7.2.2/ext/imap/libtool --mode=link cc -DPHP_ATOM_INC -I/root/compilPHP/php-7.2.2/ext/imap/include -I/root/compilPHP/php-7.2.2/ext/imap/main -I/root/compilPHP/php-7.2.2/ext/imap -I/php/include/php -I/php/include/php/main -I/php/include/php/TSRM -I/php/include/php/Zend -I/php/include/php/ext -I/php/include/php/ext/date/lib -I/usr/include/c-client -DHAVE_CONFIG_H -g -O2 -o imap.la -export-dynamic -avoid-version -prefer-pic -module -rpath /root/compilPHP/php-7.2.2/ext/imap/modules php_imap.lo -Wl,-rpath,/usr/lib/x86_64-linux-gnu/mit-krb5 -L/usr/lib/x86_64-linux-gnu/mit-krb5 -lc-client -lcrypt -lpam -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto
cc -shared .libs/php_imap.o -L/usr/lib/x86_64-linux-gnu/mit-krb5 -lc-client -lcrypt -lpam -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -Wl,-rpath -Wl,/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,-soname -Wl,imap.so -o .libs/imap.so
creating imap.la
(cd .libs && rm -f imap.la && ln -s ../imap.la imap.la)
/bin/bash /root/compilPHP/php-7.2.2/ext/imap/libtool --mode=install cp ./imap.la /root/compilPHP/php-7.2.2/ext/imap/modules
cp ./.libs/imap.so /root/compilPHP/php-7.2.2/ext/imap/modules/imap.so
cp ./.libs/imap.lai /root/compilPHP/php-7.2.2/ext/imap/modules/imap.la
PATH="$PATH:/sbin" ldconfig -n /root/compilPHP/php-7.2.2/ext/imap/modules
FINAL EDIT: It worked, I change the rpath before making the make. export LDFLAGS='-Wl,-rpath,\$${ORIGIN}/../lib' Thanks a lot for all your answers.
make
runs a series of separate commands to create thephp
executable. Can you edit your question to include (the end of) the output frommake
, to show what exact command was used here?make
output shows that this is a typical build process that handles the fine details automatically. But those details are the exact parts you're trying to change. You can't achieve this with an option tomake
, you'd have to dig right down to the part where it calls the linker. Please can you expand on "I try to tell PHP to look the libs in a given directory"? This sounds more like the right approach for your problem.