Page 1 of 2

Can't read shared library

Posted: Thu May 10, 2007 2:10 pm
by John Duchek
Hi all,
I talked to the author of my astronomy program and he showed me how to use the source code to make a shared library which is named 'libastro.so" I also have the libastro.a available.
Anyway, when I try to open the file with pb, it says it cannot open the file. I have opened several other files and was able to read the functions and cannot see why this won't open. The permissions seem the same.
Here is the opening program:

EnableDebugger
result.l=OpenLibrary(1,"libastro.so")
ExamineLibraryFunctions(1)
Debug result
While NextLibraryFunction() <>0

Debug LibraryFunctionName()
Wend
CloseLibrary(1)

I am getting a 0(false) back as result, but cannot figure out why.

Any ideas?

Posted: Thu May 10, 2007 2:15 pm
by walker
where is the lib located?
Is it in the same directory as the source?
If not try a absolute path to check if it's not a path problem... otherwise does the lib have a filesize > 0?

Posted: Thu May 10, 2007 3:15 pm
by Thalius
Permissions of the Lib correct ?

yes, I think so...

Posted: Thu May 10, 2007 5:43 pm
by John Duchek
It is in the same folder as the program and also in the userlib directory under purebasic. Its length is 450138 bytes and its permissions/ownership are
-rw-r--r-- 1 john users
john is the logged in user who is running purebasic.

Posted: Thu May 10, 2007 7:14 pm
by Nik
try "chmod 777 filename" I don't see an excutable bit set

chmod 777

Posted: Sun May 13, 2007 3:32 pm
by John Duchek
I did it and it made no difference. I am still getting a refusal to open the file. (result =0) The file isn't garbage, I can load it in an editor, and while it isn't text, I can see there are addresses, and routine names and such.
;-(

John

Posted: Sun May 13, 2007 3:38 pm
by walker
can you provide the lib (must not be as download in this forum ; maybe by mail) that someone could have a look at?

library copy

Posted: Sun May 13, 2007 3:45 pm
by John Duchek
Hi,
I sure can, just give me an email address.

I have also found a difference between this file and some that load. When I tried to load libxine.so.1 by reading it with less, it says
==> This is a dynamic library, showing the output of nm
nm: libxine.so.1: no symbols
and pb loads it and displays the routines.

with libastro.so it says
==> This is a dynamic library, showing the output of nm
0006bde0 b Args
000693f8 b CosLat.5361
000694c0 b CosPenumbra
0006bd50 b D1.4085
0006bd4c b D2.4086
0006bd48 b D3.4087
0006bd44 b D4.4088
00017f70 t E0000
0006be80 b Ea_arcsec
00069448 b Eccentricity
00069440 b EpochArgPerigee
00069410 b EpochDay
00069418 b EpochMeanAnomaly
00069420 b EpochOrbitNum
00069428 b EpochRAAN
00069408 b G1.5359
00069400 b G2.5360
00069450 b Inclination
000148f0 t Kepler
0006be70 b LP_equinox
0006be78 b NF_arcsec
00037328 d OldSiteElevation.5364

Could the symbol table be a problem? If so, how do I compile it without it?
John

Posted: Sun May 13, 2007 4:58 pm
by Trond
try chmod +x filename.

Nope

Posted: Sun May 13, 2007 11:15 pm
by John Duchek
after the 777 it was executable. Even so I went ahead and gave it the +x.
It still doesn't load. I noted that the source file for pb wasn't executable so I gave it the +x too. Still doesn't work.

John

Posted: Mon Jul 16, 2007 2:20 pm
by DarkDragon
Same problem here. I can't read my .so files created with PB.

Posted: Wed Jul 18, 2007 10:16 am
by Anonymous
try this :

Code: Select all

result.l=OpenLibrary(1,"./libastro.so")

Posted: Wed Jul 18, 2007 10:25 am
by flaith
did you try a :

Code: Select all

chown john:john libastro.so

Posted: Fri Jul 20, 2007 2:25 pm
by Anonymous
Do you resolve your problem with ? :

Code: Select all

result.l=OpenLibrary(1,"./libastro.so")

Posted: Mon Jul 23, 2007 3:07 pm
by bembulak
Sounds silly, but try to set FULL (absolute) path to the lib, like: "/usr/lib/libastro.so".

I had same problem with a lib a few days ago. And not every.

I know, it's dirty but it might work. I've already got some problems with the LD_PATH variable unter PB-Linux, but don't know why.