<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Edited for clarity<br><div dir="ltr"><br></div><div dir="ltr"><b>From:</b> Eliot Miranda <eliot.miranda@gmail.com><br><b>Date:</b> August 14, 2020 at 9:19:40 PM PDT<br><b>To:</b> The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org><br><b>Subject:</b> <b>Re:  [squeak-dev] Has anyone gotten FFI working on squeak on a Mac lately?</b><br><br></div><div dir="ltr"><span>Hi Lawson,</span><br><span></span><br><blockquote type="cite"><span>On Aug 14, 2020, at 6:21 PM, LawsonEnglish <LEnglish5@cox.net> wrote:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I’m not saying it isn’t stable.</span><br></blockquote><span></span><br><span>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.</span><br><span></span><br><blockquote type="cite"><span>However, the test functions are in the FFI plugin, which is a .bundle. I’ve been trying to use a .dylib.</span><br></blockquote><span></span><br><span>There’s a SqueakFFIPlugin dylib (a dylib in all but name) in SqueakFFIPlugin.bundle/Contents/MacOS/SqueakFFIPlugin.  That’s what the FFI actually loads.</span><br><span></span><br><blockquote type="cite"><span>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.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>SO again: has anyone used a non-Squeak distribution/non-bundle with FFI lately?</span><br></blockquote><span></span><br><span>Yes.</span><br><span></span><br><blockquote type="cite"><span>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.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>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.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>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?</span><br></blockquote><span></span><br><span>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 dylibs a dylib 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.</span><br><span></span><br><blockquote type="cite">I’m still trying to figure out how to PUT a library into a .bundle, or I’d test my theory.<span></span></blockquote><span></span><br><span>Look at the vm build makefiles for macos; they do this and they can be configured to generate dylibs in a directory, etc.</span><br><span></span><br><span>So first question, what’s the output of</span><br><span>     otool -L mylib</span><br><span></span><br><span>(You can omit all the /System/Library ones)</span><br><span></span><br><blockquote type="cite"><span>L</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>On Aug 14, 2020, at 6:14 PM, Eliot Miranda <eliot.miranda@gmail.com> wrote:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Hi Lawson,</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>On Aug 14, 2020, at 6:04 PM, LawsonEnglish <LEnglish5@cox.net> wrote:</span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>I realize that the test library works, but I can’t use ANY kind of library user specified/user made library for FFI with Squeak on Catalina OR Mojave, and I can’t tell what I am doing wrong.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>I let Craig Latta watch me, via screen sharing on skype, set up the whole thing from scratch, and his response was to start to coach me in how to create and use the VM with a c-debugger.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>So I don’t think I’m doing anything obviously wrong or at least Craig didn’t catch it while he watched.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Still don’t have the VM working, so I thought I ask if anyone has actually done it lately? The FFIPrim libray is in a .bundle, which may or may not be signficiant to this issue.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>The FFI tests work out if the biz for me on MacOS 64-bit. The test functions are included in the FFI plugin.  I haven’t tried x86/32-bit in a while but I’d be surprised if this was broken.  The code is stable.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>L</span></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span></blockquote></blockquote><blockquote type="cite"><span></span></blockquote></div></body></html>