Hi there
I'm trying to run some CGI programs under Apache, written in C++,
which use the "libmysqlclient" MySQL library. This is all running on
Solaris.
I build my programs using the following makefile:
all: SCM exampleSQL
SCM: SCM.cpp makefile
@echo "Building SCM"
g++ SCM.cpp -g -o SCM -I/usr/local/include/mysql
-L/usr/local/lib/mysql -lmysqlclient -lz
chmod 555 SCM
cp SCM ../cgi-bin
exampleSQL: exampleSQL.cpp makefile
@echo "Building exampleSQL"
g++ -o exampleSQL exampleSQL.cpp -I/usr/local/include/mysql
-L/usr/local/lib/mysql -lmysqlclient -lz
chmod 555 exampleSQL
cp exampleSQL ../cgi-bin
where "SCM" is the production program, and "exampleSQL" is a test
program I have written to try and get things working.
As you can see these two programs are compiled identically. When I run
program "exampleSQL", everything is fine, it pulls all the stuff out
of the database and sends everything back to my web browser.
But when I try to run program "SCM", I get an Apache error, and when I
look in /var/apache/logs/error_log I get:
ld.so.1: SCM: fatal: libmysqlclient.so.12: open failed: No such file
or directory
[Sun Jun 6 12:34:36 2004] [error] [client 172.17.1.234] Premature end
of script headers: /var/apache/cgi-bin/SCM
How can one program manage to find the correct library at runtime but
not the other ? Permissions ? Or is it dependent on exactly which
MySQL functions the program tries to call ? (NB I have a SetEnv for
LD_LIBRARY_PATH in httpd.conf which I hoped would fix this but
doesn't.)
Any ideas of how I might start investigating this would be
appreciated.
Best rgds
Griff