PSQL 64bit driver error

Solution 1:

It looks like you or the installer have added /usr/local/pgsql/lib64/ to /etc/ld.so.conf or to the LD_LIBRARY_PATH environment variable. If it's in ld.so.conf remove it and run ldconfig. Ditto if it's in the default LD_LIBRARY_PATH - check /etc/environment, the system-wide startup scripts, your .bashrc and .bash_profile etc to see where it might've been added.

It's a terrible idea to have an incompatible libstdc++ on the library search path. If Pervasive's installer did this, report a bug, it's totally unacceptable and (as you've discovered) can break your system.

Once it's no longer on your library search path everything else will resume working, but the drivers won't work. You might be able to get them to work by running the program that uses them with a wrapper script that sets LD_LIBRARY_PATH="/usr/local/pgsql/lib64/:${LD_LIBRARY_PATH}" but only if those programs themselves do not require the other libstdc++.


A wrapper script can be as simple as:

#!/bin/sh
set -e
LD_LIBRARY_PATH="/usr/local/pgsql/lib64/:${LD_LIBRARY_PATH}"
/path/to/my/program "$@"

"$@" is a "magic" variable that expands into the original arguments passed to the shell script. Save the script as, say, myprogram_wrapper.sh, edit /path/to/my/program to point to the location of the application executable you want to launch, and use chmod a+x my_program_wrapper.sh to make it executable. You can then launch the app with ./my_program_wrapper.sh or add that wrapper to desktop shortcuts etc in place of the original application.

This is how lots of software that's bundled as binaries, like Adobe Reader, launches its self with its bundled libraries without affecting the rest of the system. It's not the best way (that's to use rpath linking) but it's OK.

Solution 2:

Someone on the Pervasive forums suggested this fix:

Due to some versions conflicts I needed to move some files to be able to run "apt-get" without complaining about versions.

sudo mv /usr/local/psql/lib/libgcc_s.so.1 /usr/local/psql/lib/libgcc_s.so.1.org

sudo mv /usr/local/psql/lib/libstdc++.so.6 /usr/local/psql/lib/libstdc++.so.6.org

and after that not run "sudo ldconfig"

This works, but after reading @CraigRinger's answer, I think it seems a bit of a hack. Unfortunately I don't know enough to be able to implement the LD_LIBRARY_PATH fix.