flightaware / Pgtcl

Tcl client side interface to PostgreSQL (libpgtcl)
https://flightaware.github.io/Pgtcl/
BSD 3-Clause "New" or "Revised" License
31 stars 10 forks source link

couldn't load file "/usr/local/lib/pgtcl2.1/libpgtcl2.1.0.so" #13

Closed jungle-boogie closed 8 years ago

jungle-boogie commented 8 years ago

Hello,

I installed tclsh8.6 from source with no special configurations. I've also installed Pgtcl from source without any special configurations.

So what's happening here:

$ tclsh8.6
% package require Pgtcl
couldn't load file "/usr/local/lib/pgtcl2.1/libpgtcl2.1.0.so": libpq.so.5: cannot open shared object file: No such file or directory
$ sudo find / -name libpgtcl2.1.0.so
/usr/local/lib/pgtcl2.1/libpgtcl2.1.0.so
/home/debian/bin/Pgtcl/libpgtcl2.1.0.so
$ sudo find / -name libpq.so.5
/usr/local/pgsql/lib/libpq.so.5
/home/debian/bin/postgres/src/interfaces/libpq/libpq.so.5 
$ tclsh8.6
% lappend ::auto_path /usr/local/lib/pgtcl2.1/
/usr/local/lib/tcl8.6 /usr/local/lib /usr/local/lib/pgtcl2.1/
% package require Pgtcl
couldn't load file "/usr/local/lib/pgtcl2.1/libpgtcl2.1.0.so": libpq.so.5: cannot open shared object file: No such file or directory
jungle-boogie commented 8 years ago

Also getting this on a different machine (raspberry pi 3) with postgres, tclsh8.6 and pgtcl all compiled from souce.

resuna commented 8 years ago

Yeh, that's a kind of confusing error message. It's actually complaining that it can't load libpq.so.5 which is required by libpgtcl2.1.0.so

Do you have LD_LIBRARY_PATH pointing through /usr/local/pgsql/lib?

jungle-boogie commented 8 years ago

Thanks for writing back, @resuna.

How do I set the LD_LIBRARY_PATH? I see this in the config options:

LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>

taking a guess, I did this:

./configure LDFLAGS="-L/usr/local/pgsql/lib"

but the results are the same:

$ tclsh8.6
% lappend ::auto_path /usr/local/lib/pgtcl2.1/
/usr/local/lib/tcl8.6 /usr/local/lib /usr/local/lib/pgtcl2.1/
% package require Pgtcl
couldn't load file "/usr/local/lib/pgtcl2.1/libpgtcl2.1.0.so": libpq.so.5: cannot open shared object file: No such file or directory
% exit

in config.log I see this: LDFLAGS='-L/usr/local/pgsql/lib -Wl,--export-dynamic '

jungle-boogie commented 8 years ago

HEY! It's actually working no!!

$ tclsh8.6
% package require Pgtcl
2.1.0