[Gambas-user] Cannot find proprietary shared libraries.

ML d4t4full at gmail.com
Tue Jun 5 19:38:46 CEST 2018


On 05/06/18 09:10, Benoît Minisini wrote:
> Le 05/06/2018 à 14:02, ML a écrit :
>> Guys, need help accessing proprietary shared libs from Gambas
>> (v3.11.2) from PPA in Ubuntu 16.04 x64.
>> I've been given -after signing an NDA with a company- a couple of
>> development .so files.
>> I placed these .so files in a subfolder inside my home folder.
>> I've put this path inside a .conf file, put this .conf file inside
>> /etc/ld.so.conf.d and ran ldconfig as superuser.
>> I verified the libs and their location are in the cache by grepping
>> the output from ldconfig -p: They are both there.
>> But alas! Gambas cannot find them. I have this sample code (sorry,
>> cannot give real code details 'cos of the NDA):
>> Lib call declaration in a module (say it is called modLib):
>>
>>    'The call name used is the actual call name, respecting
>> upper/lowercase, ie: no need for EXEC.
>>    Public Extern SomeLib_GetVersion(versionStrPtr As Pointer) In
>> "libName"
>>
>> I also have a form with -appx- the following code:
>>
>>    Public Sub Form_Open()
>>      Dim libVersion As String = String(128, " ")
>>      Dim strPtr As Pointer = VarPtr(libVersion)
>>      Try modLibrary.SomeLib_GetVersion(strPtr)
>>      If (Error.Code) Then
>>        Message.Error(Error.Text)
>>      End If
>>    End
>>
>> When I call this from a form, I get the following error:
>> Cannot find dynamic library 'libName.so': libName.so: cannot open
>> shared object file: No such file or directory
>> Now, I've seen lib names with a trailing colon and (version?) number.
>> I don't know how or where can I get this info from, or if I need them.
>> How can I get Gambas able to find and use these .so files?
>> Regarding these trailing ":<number>" in EXTERN declarations: How do I
>> find these out, and how do I know whether I need them or not?
>
> The name of the library is directly passed to the dlopen() function,
> and the error you get is the error returned by dlopen().
> The "<number>" after the colon is just the version number of the
> shared library. You find it in the name of the shared library symbolic
> link. You have to specify it only if you have multiple versions of the
> same library, or if you requested a specific feature of a specific
> version of the library.
> Regards,

Benoît,

Thanks a ton for the tips.
Further investigation led me to find the root of all evil (this means I
wrote and compiled a quick&dirty C 'hello world' targeting the libraries
and compiled 32 and 64 bit versions; 32bit worked and 64bit did not
giving the same error as Gambas).
Libs are 32bit, my OS is 64bit. Using a virtual Ubuntu (32bit) inside my
Ubuntu (64bit), the 32bit virtual Gambas version works as expected.

Beware, probably stupid question: Is there a way I can install a 32bit
Gambas alongside a 64bit Gambas in my 64bit OS?




More information about the User mailing list