Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I am compiling php 5.3.13 on my server. I want to create an autonome php5 folder. So prefix is:
/usr/local/php5
In this folder I have a lib folder, where I put all lib needed for php to be executed such as:
libk5crypto.so.3 libxml2.so.2 libjpeg.so.62 ....
Even if I compile with --with-jpeg-dir=/usr/local/php5/lib/, php binary is still looking for the file in /usr/lib64.
--with-jpeg-dir=/usr/local/php5/lib/
/usr/lib64
The only solution I found so far is to manually export LD_LIBRARY_PATH=/usr/local/php5/lib
LD_LIBRARY_PATH=/usr/local/php5/lib
I would like the same automatically at compile time. Is that possible?
There are two distinct linker paths, the compile time, and the run time.
I find autoconf (configure) is rarely set up to do the correct thing with alternate library locations, using --with-something= usually does not generate the correct linker flags (-R or -Wl,-rpath). If you only had .a libraries it would work, but for .so libraries what you need to specify is the RPATH:
configure
--with-something=
-R
-Wl,-rpath
.a
.so
RPATH
export PHP_RPATHS=/usr/local/php5/lib ./configure [options as required]
(In many cases just appending LDFLAGS to the configure command is used, but PHP's build process is slightly different.)
LDFLAGS
This effectively adds extra linker search paths to each binary, as if those paths were specified in LD_LIBRARY_PATH or your default linker config (/etc/ld.so.conf). This also takes care of adding -L/usr/local/php5/lib to LDFLAGS so that the compile-time and run-time use libraries are from the same directory (there's the potential for problems with mismatched versions in different locations, but you don't need to worry here).
LD_LIBRARY_PATH
/etc/ld.so.conf
-L/usr/local/php5/lib
Once built, you can check with:
$ objdump -j dynamic -x ./sapi/cli/php | grep RPATH RPATH /usr/local/php5/lib $ objdump -j dynamic -x ./libs/libphp5.so | fgrep RPATH RPATH /usr/local/php5/lib
Running ldd will also confirm which libraries are loaded from where.
ldd
What --with-jpeg-dir should be really be used for is to point at /usr/local/ or some top-level directory, the directories include/, lib/, and possibly others are appended depending on what the compiler/linker needs.
--with-jpeg-dir
/usr/local/
include/
lib/
You only need --with-jpeg-dir if configure cannot find the installation, configure will automatically find it in /usr/local and other (possibly platform specific) "standard" places. In your case I think configure is finding libjpeg in a standard place, and silently disregarding the directive.
/usr/local
(Also, PHP 5.3.13 is no longer current, I suggest 5.3.21, the current version at this time.)
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.