1

I'm creating a application that is using a pre-compiled third party shared library files.To use these I'm required to set the LD_LIBRARY_PATH or create a conf file under /etc/ld.so.conf.d/application.conf, My problem is There is a system libcurl.so.4 already available under /usr/lib/.The third party Library also has a libcurl.so.4 . If I create /etc/ld.so.conf.d/application.conf file, I'm not able to use "YUM installer" . I'm getting the error

Pycurl error occured ,

Compile time Version is higher than the Linking version

I'm worried to remove the application libcurl.so.4 as it may break the features in that third party library that I'm making use of(making my application meaning less) and I can't neglect the system library either .

Is it possible to use these two libraries without any conflict as I mentioned above.

PS : Setting LD_LIBRARY_PATH too causes the same problem

Thiyagarajan
  • 1,271
  • 1
  • 14
  • 19

2 Answers2

1

Create a script that sets and exports $LD_LIBRARY_PATH before invoking the executable. The variable will disappear once the script exits.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • [Ignacio Vazquez-Abrams](http://stackoverflow.com/users/20862/ignacio-vazquez-abrams) .I tried that earlier before I decided to go with creating conf file under etc/ld.so.conf.d/. The problem I faced is that the shell script exports the path to the child shell and In the current shell it had no effect, this is how I used it , export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/third-party/libraries. – Thiyagarajan Nov 29 '13 at 19:18
  • Why would the current shell need it? The script is invoking the executable. – Ignacio Vazquez-Abrams Nov 29 '13 at 19:19
  • As u said the script is executing the executable but the export command if used as such won't export the command in the shell where the executable in invoked .I refereed [this](http://askubuntu.com/questions/53177/bash-script-to-set-environment-variables-not-working) page . as it suggests I's not Possible for me to use source or . to run the shell script when the system starts up(to my knowledge , correct me If I'm Wrong). – Thiyagarajan Nov 29 '13 at 19:30
  • 1
    The. Script. Is. Invoking. The. Executable. `export LD_LIBRARY_PATH="$PWD"` `./someexecutablewithprivatelibraries` – Ignacio Vazquez-Abrams Nov 29 '13 at 19:31
  • Sorry for the Misleading you .. The Script is used for Executing the Executable .. unless the path is properly the executable is not running.. as u said ./someexecutablewithprivatelibraries will require an additional ". " or " source " before "./someexecutablewithprivatelibraries" for export command to work which is not helping me .. – Thiyagarajan Nov 29 '13 at 19:42
1

If you have 2 conflicting libs and one is system, another one is a user app, don't put application.conf into /etc/ld.so.conf.d/. Instead use something like ~your_user_name/custom_conf , put your application.conf file there (eventually you may need to edit it adding the path to the proper version of libcurl.so.4). libcurl.so.4 should be not in system dirs as well rather in ~your_user_name/lib. You can make a wrapper for your app where you set $LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~your_user_name/lib as Ignacio Vazquez-Abrams suggested or compile your app explicitly pointing out which library to link (use linker flags -L /full/path/to/your/libcurl.so.4)

cur4so
  • 1,750
  • 4
  • 20
  • 28