uFFI: Debugging "External module not found" Error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

uFFI: Debugging "External module not found" Error

Sean P. DeNigris
Administrator
I was trying to get Pharo-LibVLC working on Mac. The following is copied from
a GH issue[1]:

> I have VLC installed via Homebrew cask, the formula for which simply
> installs the dmg. I
> first tried supplying a full path to the dylib that the VLC app uses
> (/Applications/VLC.app/Contents/MacOS/lib/libvlc.5.dylib), which resulted
> in "Error:
> External module not found". I then remembered some trouble people have had
> in the past
> with FFI lookup locations and tried copying into the VM's plugin folder
> both a link and the
> actual dylib, with the same error. I read the uFFI booklet, but didn't
> learn anything more.
>
> I also checked that the VLC lib was 64-bit via:
>
> lipo -info .../Pharo.app/Contents/MacOS/Plugins/libvlc.5.dylib
> which returned:
> Non-fat file: .../Plugins/libvlc.5.dylib is architecture: x86_64

[1] https://github.com/badetitou/Pharo-LibVLC/issues/1



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: uFFI: Debugging "External module not found" Error

Ben Coman


On Wed, 4 Dec 2019 at 00:26, Sean P. DeNigris <[hidden email]> wrote:
I was trying to get Pharo-LibVLC working on Mac. The following is copied from
a GH issue[1]:

> I have VLC installed via Homebrew cask, the formula for which simply
> installs the dmg. I
> first tried supplying a full path to the dylib that the VLC app uses
> (/Applications/VLC.app/Contents/MacOS/lib/libvlc.5.dylib), which resulted
> in "Error:
> External module not found". I then remembered some trouble people have had
> in the past
> with FFI lookup locations and tried copying into the VM's plugin folder

One catch that has confused me in the past, is when the system caches that it couldn't find the external module,
so even when I copyied it to the VM folder or got the path correct, it continued to fail until I restarted the Image.

cheers -ben
 
> both a link and the
> actual dylib, with the same error. I read the uFFI booklet, but didn't
> learn anything more.
>
> I also checked that the VLC lib was 64-bit via:
>
> lipo -info .../Pharo.app/Contents/MacOS/Plugins/libvlc.5.dylib
> which returned:
> Non-fat file: .../Plugins/libvlc.5.dylib is architecture: x86_64

[1] https://github.com/badetitou/Pharo-LibVLC/issues/1



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: uFFI: Debugging "External module not found" Error

Alistair Grant
In reply to this post by Sean P. DeNigris
Hi Sean,

On Tue, 3 Dec 2019 at 17:26, Sean P. DeNigris <[hidden email]> wrote:

>
> I was trying to get Pharo-LibVLC working on Mac. The following is copied from
> a GH issue[1]:
>
> > I have VLC installed via Homebrew cask, the formula for which simply
> > installs the dmg. I
> > first tried supplying a full path to the dylib that the VLC app uses
> > (/Applications/VLC.app/Contents/MacOS/lib/libvlc.5.dylib), which resulted
> > in "Error:
> > External module not found". I then remembered some trouble people have had
> > in the past
> > with FFI lookup locations and tried copying into the VM's plugin folder
> > both a link and the
> > actual dylib, with the same error. I read the uFFI booklet, but didn't
> > learn anything more.
> >
> > I also checked that the VLC lib was 64-bit via:
> >
> > lipo -info .../Pharo.app/Contents/MacOS/Plugins/libvlc.5.dylib
> > which returned:
> > Non-fat file: .../Plugins/libvlc.5.dylib is architecture: x86_64

The same message is returned whether the module itself isn't found, or
if one of its dependencies can't be found.

On linux you can check dependencies with `ldd file.so`, I don't know
what the Mac equivalent is.

HTH,
Alistair

Reply | Threaded
Open this post in threaded view
|

Re: uFFI: Debugging "External module not found" Error

Sean P. DeNigris
Administrator
In reply to this post by Ben Coman
Ben Coman wrote
> One catch that has confused me in the past, is when the system caches that
> it couldn't find the external module,
> so even when I copyied it to the VM folder or got the path correct, it
> continued to fail until I restarted the Image.

Great gotcha! We should add that to the docs. I'll have a go after I figure
this error out. In my case, restarting did not help  :/



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: uFFI: Debugging "External module not found" Error

Sean P. DeNigris
Administrator
In reply to this post by Alistair Grant
Alistair Grant wrote
> The same message is returned whether the module itself isn't found, or
> if one of its dependencies can't be found.

Good to know. I wonder if we can't provide more detailed error messages
here...


Alistair Grant wrote
> On linux you can check dependencies with `ldd file.so`, I don't know
> what the Mac equivalent is.

Apparently, it's `otool -L whatever.dylib`, which returns:
        @rpath/libvlc.dylib (compatibility version 12.0.0, current version 12.0.0)
        @rpath/libvlccore.dylib (compatibility version 10.0.0, current version
10.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
1252.50.4)
        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version
7.0.0)


Still investigating...



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: uFFI: Debugging "External module not found" Error

Pharo Smalltalk Users mailing list
This is the most annoying thing about UFFI - the library search seems to opaque and I don't understand how it works.

So far I am finding best practice is to find the library yourself and then provide the exact file path you want.  

That way, you can actually prompt the user to find it if you don't and they get a decent experience.

> On Dec 3, 2019, at 11:34 AM, Sean P. DeNigris <[hidden email]> wrote:
>
> Alistair Grant wrote
>> The same message is returned whether the module itself isn't found, or
>> if one of its dependencies can't be found.
>
> Good to know. I wonder if we can't provide more detailed error messages
> here...
>
>
> Alistair Grant wrote
>> On linux you can check dependencies with `ldd file.so`, I don't know
>> what the Mac equivalent is.
>
> Apparently, it's `otool -L whatever.dylib`, which returns:
> @rpath/libvlc.dylib (compatibility version 12.0.0, current version 12.0.0)
> @rpath/libvlccore.dylib (compatibility version 10.0.0, current version
> 10.0.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
> 1252.50.4)
> /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version
> 7.0.0)
>
>
> Still investigating...
>
>
>
> -----
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>


Reply | Threaded
Open this post in threaded view
|

Re: uFFI: Debugging "External module not found" Error

Ben Coman
> On Dec 3, 2019, at 11:34 AM, Sean P. DeNigris <[hidden email]> wrote:
>
> Alistair Grant wrote
>> The same message is returned whether the module itself isn't found, or
>> if one of its dependencies can't be found.

Secondary dependencies are awkward to track via command line.  

 
>
> Good to know. I wonder if we can't provide more detailed error messages
> here...

The following turned up in a search (I've no experience with it), but could be useful... 

Or perhaps the system can examine the DYNAMIC section of an ELF to pre-load each dependency.
From the image, something in part equivalent to... https://github.com/finixbit/elf-parser/blob/master/elf_parser.cpp
GT inspector on an ELF file could an interesting demo ;)

btw, I wasn't aware of how "Runtime Search Path: Security" affected the search path...


> Alistair Grant wrote
>> On linux you can check dependencies with `ldd file.so`, I don't know
>> what the Mac equivalent is.
>
> Apparently, it's `otool -L whatever.dylib`, which returns:
>       @rpath/libvlc.dylib (compatibility version 12.0.0, current version 12.0.0)
>       @rpath/libvlccore.dylib (compatibility version 10.0.0, current version
> 10.0.0)
>       /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
> 1252.50.4)
>       /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version
> 7.0.0)

On Wed, 4 Dec 2019 at 03:58, Todd Blanchard via Pharo-users <[hidden email]> wrote:
This is the most annoying thing about UFFI - the library search seems to opaque and I don't understand how it works.

So far I am finding best practice is to find the library yourself and then provide the exact file path you want. 

That way, you can actually prompt the user to find it if you don't and they get a decent experience.


cheers -ben