Question

I built a .CGI in C++. This binary depends on some boost shared library and other resources in a specific folder /usr/local/boost/. The CGI doesn't execute and in the log I can see the error

    error while loading shared libraries: libdxxx: cannot 
    open shared object file: No such file or dire

Now, I've read many logs that say that I have to set in httpd.conf the following, but still doesn't work.

   SetEnv LD_LIBRARY_PATH /usr/local/boost:

In my config I set this line "as it is" at the end of the config file without being included in any VirtualHOst or Directory section. I tried to insert into the Directory for the cgi-bin but still the same

 <Directory "/var/www/cgi-bin">
     AllowOverride None
     Options None
     Order allow,deny
     Allow from all
     SetEnv LD_LIBRARY_PATH /usr/local/boost
 </Directory>

I have also tried (see discurrion below) to add a .conf file for ldconfig but it still doesn't work!

  #added a file called myconfig.conf conrtaining a line
  /usr/local/boost 

  /etc/ld.conf.d/
  ldconfig (as root)

I have also reead that httpd inherits the environment variable of the ROOT user that runs it; as I root I call the following to start Apache and LD_LIBRARY_PATH is correctly set but still something is wrong.

 /etc/init.d/httpd start

I am using Red Hat 6.2.

Was it helpful?

Solution

In our Linux Debian box, we use this:

Create a config file, add string /usr/local/boost in it:

/etc/ld.so.conf.d/boost.conf

Then run:

# ldconfig

And finally:

# /etc/init.d/apache2 restart

I don't know how to do it in Red Hat.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top