<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">It’s the simplest library I could think of:<div class=""><br class=""><div class="">.h file:</div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(100, 56, 32); background-color: rgb(255, 255, 255);" class="">#ifndef FFITest_h</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(100, 56, 32); background-color: rgb(255, 255, 255);" class="">#define FFITest_h</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgba(0, 0, 0, 0.85); background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(100, 56, 32); background-color: rgb(255, 255, 255);" class="">#define PI <span style="color: #1c00cf" class="">3.14159</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><b class="">double</b><span style="color: rgba(0, 0, 0, 0.85)" class=""> </span><span style="color: #0f68a0" class="">GetPi</span><span style="color: rgba(0, 0, 0, 0.85)" class="">(</span><b class="">void</b><span style="color: rgba(0, 0, 0, 0.85)" class="">);</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(93, 108, 121); background-color: rgb(255, 255, 255);" class=""><span style="color: #643820" class="">#endif </span>/* FFITest_h */</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">.c file:</div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #643820" class="">#include </span>"FFITest.h"</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><b class="">double</b><span style="color: rgba(0, 0, 0, 0.85)" class=""> </span><span style="color: #0f68a0" class="">GetPi</span><span style="color: rgba(0, 0, 0, 0.85)" class="">(</span><b class="">void</b><span style="color: rgba(0, 0, 0, 0.85)" class="">){</span><b class="">return</b><span style="color: rgba(0, 0, 0, 0.85)" class=""> </span><span style="color: #643820" class="">PI</span><span style="color: rgba(0, 0, 0, 0.85)" class="">;};</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><span style="color: rgba(0, 0, 0, 0.85)" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><span style="color: rgba(0, 0, 0, 0.85)" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><span style="color: rgba(0, 0, 0, 0.85)" class="">.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><span style="color: rgba(0, 0, 0, 0.85)" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><span style="color: rgba(0, 0, 0, 0.85)" class="">By the way, I managed to get things working just fine in my own build of the Mac 64-bit vm, but some new odd behavior as shown up.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><span style="color: rgba(0, 0, 0, 0.85)" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="color: rgba(0, 0, 0, 0.85);" class="">I</span><span style="caret-color: rgba(0, 0, 0, 0.85); color: rgba(0, 0, 0, 0.85);" class="">’</span><span style="color: rgba(0, 0, 0, 0.85);" class="">ll explain in a yet another thread.</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="color: rgba(0, 0, 0, 0.85);" class=""><br class=""></span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="color: rgba(0, 0, 0, 0.85);" class="">L</span></font></div><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 20, 2020, at 12:31 AM, Tobias Pape <<a href="mailto:Das.Linux@gmx.de" class="">Das.Linux@gmx.de</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">On 20.08.2020, at 09:19, LawsonEnglish <<a href="mailto:LEnglish5@cox.net" class="">LEnglish5@cox.net</a>> wrote:<br class=""><br class="">If you look at the FFIPrim bundle, it looks different.<br class=""><br class="">I still can’t get anything to work except those bundles that are included with the all-in-one.<br class=""><br class=""><br class="">L<br class=""><br class="">This is with Cataina.<br class=""><br class="">L<br class=""></blockquote><br class="">Can you share the source of your test library?<br class=""><br class="">best regards<br class=""><span class="Apple-tab-span" style="white-space:pre">   </span>-tobias<br class=""><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">On Aug 19, 2020, at 12:31 AM, Tobias Pape <<a href="mailto:Das.Linux@gmx.de" class="">Das.Linux@gmx.de</a>> wrote:<br class=""><br class="">Hi<br class=""><br class=""><blockquote type="cite" class="">On 16.08.2020, at 09:36, LawsonEnglish <<a href="mailto:LEnglish5@cox.net" class="">LEnglish5@cox.net</a>> wrote:<br class=""><br class="">Running otool -L on my dylib:<br class=""><br class="">otool -L otool -L libFFITest.dylib<br class="">libFFITest.dylib:<br class=""><span class="Apple-tab-span" style="white-space:pre">  </span>/libFFITest.dylib (compatibility version 1.0.0, current version 1.0.0)<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)<br class=""><br class="">however, running it on the executable int eh SqueakFFIPrims.bundle:<br class=""><br class="">otool -L SqueakFFIPrims<br class="">SqueakFFIPrims:<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2)<br class=""><br class=""><br class="">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.<br class=""><br class=""><br class=""></blockquote><br class="">there's a stark difference, sadly.<br class="">The Plugins, which are bundles on macOS, are _not_ simply dynamic libs:<br class=""><br class=""><br class="">[Squeak.app/Contents/Resources]$ otool -L CameraPlugin.bundle/Contents/MacOS/CameraPlugin<br class="">CameraPlugin.bundle/Contents/MacOS/CameraPlugin:<br class=""><span class="Apple-tab-span" style="white-space:pre">    </span>/System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, current version 2.0.0)<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1450.15.0)<br class=""><span class="Apple-tab-span" style="white-space:pre">       </span>/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1129.5.0)<br class=""><span class="Apple-tab-span" style="white-space:pre">     </span>/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1450.15.0)<br class=""><span class="Apple-tab-span" style="white-space:pre">       </span>/System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia (compatibility version 1.0.0, current version 1.0.0)<br class=""><span class="Apple-tab-span" style="white-space:pre">       </span>/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.5.0)<br class=""><span class="Apple-tab-span" style="white-space:pre">       </span>/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)<br class=""><span class="Apple-tab-span" style="white-space:pre">     </span>/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)<br class=""><br class="">[Squeak.app/Contents/Resources]$ file CameraPlugin.bundle/Contents/MacOS/CameraPlugin<br class="">CameraPlugin.bundle/Contents/MacOS/CameraPlugin: Mach-O 64-bit bundle x86_64<br class=""><br class="">Dynamic libs look differently:<br class=""><br class="">[~]$ otool -L /usr/lib/libbz2.dylib<br class="">/usr/lib/libbz2.dylib:<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)<br class=""><br class="">[~]$  file /usr/lib/libbz2.dylib<br class="">/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]<br class="">/usr/lib/libbz2.dylib (for architecture x86_64):<span class="Apple-tab-span" style="white-space:pre">       </span>Mach-O 64-bit dynamically linked shared library x86_64<br class="">/usr/lib/libbz2.dylib (for architecture i386):<span class="Apple-tab-span" style="white-space:pre">   </span>Mach-O dynamically linked shared library i386<br class=""><br class="">=-=-=<br class=""><br class="">I would suggest you first try to call a known function in a  known library. For example:<br class=""><br class="">const char* BZ2_bzlibVersion(void); from libbzip2.<br class=""><br class=""><br class="">=-=-=<br class=""><br class="">Other than that, I can't help without some artifact to look at, sorry :/<br class=""><br class="">Best regards<br class=""><span class="Apple-tab-span" style="white-space:pre">    </span>-Tobias<br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class=""><br class="">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?<br class=""><br class="">L<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Aug 14, 2020, at 9:19 PM, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" class="">eliot.miranda@gmail.com</a>> wrote:<br class=""><br class="">Hi Lawson,<br class=""><br class=""><blockquote type="cite" class="">On Aug 14, 2020, at 6:21 PM, LawsonEnglish <<a href="mailto:LEnglish5@cox.net" class="">LEnglish5@cox.net</a>> wrote:<br class=""><br class="">I’m not saying it isn’t stable.<br class=""></blockquote><br class="">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.<br class=""><br class=""><blockquote type="cite" class="">However, the test functions are in the FFI plugin, which is a .bundle. I’ve been trying to use a .dylib.<br class=""></blockquote><br class="">There’s a SqueakFFIPlugin dylib (a dylib in all but name) in SqueakFFIPlugin.bundle/Contents/MacOS/SqueakFFIPlugin.  That’s what the FFI actually loads.<br class=""><br class=""><blockquote type="cite" class="">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.<br class=""><br class="">SO again: has anyone used a non-Squeak distribution/non-bundle with FFI lately?<br class=""></blockquote><br class="">Yes.<br class=""><br class=""><blockquote type="cite" class="">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.<br class=""><br class="">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.<br class=""><br class="">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?<br class=""></blockquote><br class="">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.<br class=""><br class=""><blockquote type="cite" class=""><br class="">I’m still trying to figure out how to PUT a library into a .bundle, or I’d test my theory.<br class=""></blockquote><br class="">Look at the vm build makefiles for macos; they do this and they can be configured to generate dylibs in a directory, etc.<br class=""><br class="">So first question, what’s the output of<br class=""> otool -L mylib<br class=""><br class="">(You can omit all the /System/Library ones)<br class=""><br class=""><blockquote type="cite" class="">L<br class=""><br class=""><br class=""><br class=""></blockquote><br class=""></blockquote><br class=""><br class=""></blockquote><br class=""><br class=""><br class=""></blockquote><br class=""><br class=""></blockquote><br class=""><br class=""><br class=""></div></div></blockquote></div><br class=""></div></div></body></html>