[squeak-dev] Has anyone gotten FFI working on squeak on a Mac lately?
Tobias Pape
Das.Linux at gmx.de
Thu Aug 20 07:31:11 UTC 2020
> On 20.08.2020, at 09:19, LawsonEnglish <LEnglish5 at cox.net> wrote:
>
> If you look at the FFIPrim bundle, it looks different.
>
> I still can’t get anything to work except those bundles that are included with the all-in-one.
>
>
> L
>
> This is with Cataina.
>
> L
Can you share the source of your test library?
best regards
-tobias
>
>> On Aug 19, 2020, at 12:31 AM, Tobias Pape <Das.Linux at gmx.de> wrote:
>>
>> Hi
>>
>>> On 16.08.2020, at 09:36, LawsonEnglish <LEnglish5 at cox.net> wrote:
>>>
>>> Running otool -L on my dylib:
>>>
>>> otool -L otool -L libFFITest.dylib
>>> libFFITest.dylib:
>>> /libFFITest.dylib (compatibility version 1.0.0, current version 1.0.0)
>>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
>>>
>>> however, running it on the executable int eh SqueakFFIPrims.bundle:
>>>
>>> otool -L SqueakFFIPrims
>>> SqueakFFIPrims:
>>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2)
>>>
>>>
>>> I’m not sure what the difference means. I can sorta remove /libFFITest.dylib but the "(compatibility version 1.0.0, current version 1.0.0)” remains, and I still get the same error whether or not /libFFITest.dylib is present.
>>>
>>>
>>
>> there's a stark difference, sadly.
>> The Plugins, which are bundles on macOS, are _not_ simply dynamic libs:
>>
>>
>> [Squeak.app/Contents/Resources]$ otool -L CameraPlugin.bundle/Contents/MacOS/CameraPlugin
>> CameraPlugin.bundle/Contents/MacOS/CameraPlugin:
>> /System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, current version 2.0.0)
>> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1450.15.0)
>> /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1129.5.0)
>> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1450.15.0)
>> /System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia (compatibility version 1.0.0, current version 1.0.0)
>> /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.5.0)
>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
>> /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
>>
>> [Squeak.app/Contents/Resources]$ file CameraPlugin.bundle/Contents/MacOS/CameraPlugin
>> CameraPlugin.bundle/Contents/MacOS/CameraPlugin: Mach-O 64-bit bundle x86_64
>>
>> Dynamic libs look differently:
>>
>> [~]$ otool -L /usr/lib/libbz2.dylib
>> /usr/lib/libbz2.dylib:
>> /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
>>
>> [~]$ file /usr/lib/libbz2.dylib
>> /usr/lib/libbz2.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386]
>> /usr/lib/libbz2.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
>> /usr/lib/libbz2.dylib (for architecture i386): Mach-O dynamically linked shared library i386
>>
>> =-=-=
>>
>> I would suggest you first try to call a known function in a known library. For example:
>>
>> const char* BZ2_bzlibVersion(void); from libbzip2.
>>
>>
>> =-=-=
>>
>> Other than that, I can't help without some artifact to look at, sorry :/
>>
>> Best regards
>> -Tobias
>>
>>
>>
>>>
>>> Can you give me a hint as to what the output from otool -L should look like for a dylib that is useable from within /Resources?
>>>
>>> L
>>>
>>>
>>>> On Aug 14, 2020, at 9:19 PM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>>>>
>>>> Hi Lawson,
>>>>
>>>>> On Aug 14, 2020, at 6:21 PM, LawsonEnglish <LEnglish5 at cox.net> wrote:
>>>>>
>>>>> I’m not saying it isn’t stable.
>>>>
>>>> I know. I was just saying I don’t think anything has been broken recently, so the issue is not in the FFI per se.
>>>>
>>>>> However, the test functions are in the FFI plugin, which is a .bundle. I’ve been trying to use a .dylib.
>>>>
>>>> There’s a SqueakFFIPlugin dylib (a dylib in all but name) in SqueakFFIPlugin.bundle/Contents/MacOS/SqueakFFIPlugin. That’s what the FFI actually loads.
>>>>
>>>>> I realize that this should. make no difference, and yet, as I said, Craig Latta watched me do the whole thing from scratch via skype screensharing and he didn’t see an error.
>>>>>
>>>>> SO again: has anyone used a non-Squeak distribution/non-bundle with FFI lately?
>>>>
>>>> Yes.
>>>>
>>>>> I tested it on both Catlaina and Mojave and I get teh External module not found error, even with my own .dylib that isn’t hardcoded to sit in a specific directory.
>>>>>
>>>>> WHich leads to a suggestion: if it really is a Mac OS x issue, rather than my own stupidity, it may be necessary to start testing against a library that is merely sitting in the Resource directory, rather than inside a .bundle.
>>>>>
>>>>> WHich is why I’m still asking: has anyone used their own library (outside a .bundle) with FFI lately on Mac OS X, Catalina OR Mojave?
>>>>
>>>> Yes, and it is extremely tricky. I’ve been using libav and libffmpeg and others. I’ve found one has to examine carefully the output of otool -L and use install_name_tool to change the hard-coded paths of any other non-system Dublin’s a Bykov depends on and make sure one understands and uses @rpath. If your dylib uses any other dylib you’re going to have to do the same exploration.
>>>>
>>>>>
>>>>> I’m still trying to figure out how to PUT a library into a .bundle, or I’d test my theory.
>>>>
>>>> Look at the vm build makefiles for macos; they do this and they can be configured to generate dylibs in a directory, etc.
>>>>
>>>> So first question, what’s the output of
>>>> otool -L mylib
>>>>
>>>> (You can omit all the /System/Library ones)
>>>>
>>>>> L
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>
More information about the Squeak-dev
mailing list
|