<div dir="ltr"><div>Thanks so much for looking into this! When I run that command I get the following:</div><div><br></div><div>/usr/local/lib/libodbc.dylib:<br> /usr/local/opt/unixodbc/lib/libodbc.2.dylib (compatibility version 3.0.0, current version 3.0.0)<br> /usr/local/opt/libtool/lib/libltdl.7.dylib (compatibility version 11.0.0, current version 11.2.0)<br> /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)<br> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.0.0)<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 24, 2024 at 12:19 PM Jon Raiford <<a href="mailto:raiford@labware.com">raiford@labware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class="msg-3866150655654057402">
<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="m_-3866150655654057402WordSection1">
<p class="MsoNormal"><span style="font-size:11pt">I had a quick look at this on my M1 MBP.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">I did the following:<br>
<br>
* git clone Cuis-Smalltalk-Dev<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">* git clone Cuis DatabaseSupport<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">* modified the launch script as you described below<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">* run the script: ./RunCuisOnMacTerminal.sh<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">* open a workspace<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">* doIt: Feature require: ‘ODBC’<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">* printIt: ODBCConnection new sqlAllocEnv => a SQLHENV .<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">If I remove the DYLD_LIBRARY_PATH from the launch script then I get the module not found error.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Based on your info below, your homebrew lib path is /usr/local/lib and libodbc.dylib exists in the directory, which is the moduleName defined in ODBCLibrary class>>moduleName.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">That all looks correct.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">What do you get if you run this from the command line?<br>
<br>
<u></u><u></u></span></p>
<p class="MsoNormal" style="text-indent:0.5in"><span style="font-size:11pt">% otool -L /usr/local/lib/libodbc.dylib<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Jon<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<div id="m_-3866150655654057402mail-editor-reference-message-container">
<div>
<div>
<div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(181,196,223) currentcolor currentcolor;padding:3pt 0in 0in">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="color:black">From:
</span></b><span style="color:black">Mark Volkmann <<a href="mailto:r.mark.volkmann@gmail.com" target="_blank">r.mark.volkmann@gmail.com</a>><br>
<b>Date: </b>Tuesday, October 22, 2024 at 7:32</span><span style="font-family:Arial,sans-serif;color:black"> </span><span style="color:black">PM<br>
<b>To: </b>Jon Raiford <<a href="mailto:raiford@labware.com" target="_blank">raiford@labware.com</a>><br>
<b>Cc: </b>Discussion of Cuis Smalltalk <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>><br>
<b>Subject: </b>Re: [Cuis-dev] ODBC error<u></u><u></u></span></p>
</div>
<div>
<div>
<p class="MsoNormal">See my replies inline below.<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Oct 22, 2024 at 3:56<span style="font-family:Arial,sans-serif"> </span>PM Jon Raiford <<a href="mailto:raiford@labware.com" target="_blank">raiford@labware.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">What exactly do you mean by not working? Is it not able to open the shared library? Or it is not able to connect to a database? The first thing that
happens is allocating the environment by either calling SQLAllocHandle() (current versions of ODBC) or SQLAllocEnv() (old versions of ODBC).</span><u></u><u></u></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I'll describe what I have tried below, but I'm not claiming that I have finished investigating this. It's just my progress so far.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">1. Run the Homebrew command "<span style="font-family:"Courier New";color:black">brew install unixodbc</span>" to install the ODBC dynamic library.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><br>
<br>
</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:black">That gives me the following files in /usr/local/lib:</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><br>
<br>
</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">libodbc.2.dylib<br>
libodbc.a<br>
libodbc.dylib<br>
libodbccr.2.dylib<br>
libodbccr.a<br>
libodbccr.dylib<br>
libodbcinst.2.dylib<br>
libodbcinst.a<br>
libodbcinst.dylib<span style="font-family:"Courier New";color:black"><br>
<br>
</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">2. Run the command <span style="font-family:Arial,sans-serif">
"</span><span class="m_-3866150655654057402ex"><span style="font-family:"Courier New";color:rgb(0,59,79)">brew</span></span><span style="font-family:"Courier New";color:rgb(0,59,79)"> install sqliteodbc</span><span style="font-family:Arial,sans-serif;color:rgb(0,59,79)">" to install the SQLite-specific
shared library.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:rgb(0,59,79)"><br>
<br>
</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:rgb(0,59,79)">That gives me the file
</span><span style="font-family:Consolas;color:rgb(84,84,84);background:repeat rgb(254,254,254)">/usr/local/lib/libsqlite3odbc.dylib</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:rgb(84,84,84);background:repeat rgb(254,254,254)">I'm not certain I need this file, but I reference it below.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><br>
<br>
</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">3. Create the file /usr/local/etc/odbc.ini containing the following which refers to a dynamic library that exists and SQLite database file that exists.<u></u><u></u></p>
</div>
<div>
<pre style="margin-right:0in;margin-bottom:6pt;margin-left:0in;background:repeat rgb(254,254,254);border-radius:0.3em;font-variant-ligatures:normal;text-decoration-style:initial;text-decoration-color:initial;overflow:auto"><code><span style="color:rgb(84,84,84)">[TodoDSN]</span></code><span style="color:rgb(84,84,84)"><br><code>Description = SQLite ODBC Driver</code><br><code>Driver = /usr/local/lib/libsqlite3odbc.dylib</code><br><code>Database = /Users/volkmannm/Documents/dev/lang/smalltalk/Cuis-Smalltalk-Dev-UserFiles/todos.db</code><br><code>Timeout = 2000</code></span><span style="font-size:13.5pt;color:rgb(84,84,84)"><u></u><u></u></span></pre>
</div>
<div>
<p class="MsoNormal">4. Clone the GitHub repository at <a href="https://github.com/Cuis-Smalltalk/DatabaseSupport.git" target="_blank">https://github.com/Cuis-Smalltalk/DatabaseSupport.git</a> into the same directory that holds the Cuis-Smalltalk-Dev
directory.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">5. Change the file <span style="font-family:"Courier New"">RunCuisOnMacTerminal.sh</span> to the following:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal"><span style="font-family:"Courier New"">export DYLD_LIBRARY_PATH="$(brew --prefix)/lib:${DYLD_LIBRARY_PATH}"</span><u></u><u></u></p>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">./CuisVM.app/Contents/MacOS/Squeak CuisImage/Cuis?.?-????.image -u</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">5. Run that script.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">6. Open a "File List", navigate to the DatabaseSupport directory, select
<a href="http://ODBC.pck.st" target="_blank">
ODBC.pck.st</a>, and click "install package".<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">7. Open a Workspace and evaluate the following:<u></u><u></u></p>
</div>
<div>
<pre style="margin-right:0in;margin-bottom:6pt;margin-left:0in;background:repeat rgb(254,254,254);border-radius:0.3em;font-variant-ligatures:normal;text-decoration-style:initial;text-decoration-color:initial;overflow:auto"><code><span style="color:rgb(84,84,84)">conn </span></code><span class="m_-3866150655654057402gmail-token"><span style="color:green">:=</span></span><code><span style="color:rgb(84,84,84)"> ODBCConnection dsn</span></code><span class="m_-3866150655654057402gmail-token"><span style="color:rgb(84,84,84)">:</span></span><code><span style="color:rgb(84,84,84)"> 'TodoDSN' user</span></code><span class="m_-3866150655654057402gmail-token"><span style="color:rgb(84,84,84)">:</span></span><code><span style="color:rgb(84,84,84)"> '' password</span></code><span class="m_-3866150655654057402gmail-token"><span style="color:rgb(84,84,84)">:</span></span><code><span style="color:rgb(84,84,84)"> ''</span></code><span class="m_-3866150655654057402gmail-token"><span style="color:rgb(84,84,84)">.</span></span><span style="font-size:13.5pt;color:rgb(84,84,84)"><u></u><u></u></span></pre>
</div>
<div>
<p class="MsoNormal">This gives the error "External module not found". See the attached screenshot.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I don’t have an easy way to test that old ODBC code at the moment, but it should be easy enough to find the library class. It is a subclass of ExternalLibrary.
From there you can find the alloc call and walk back through senders to figure out how it is called. From there you can see the order things are called.</span><u></u><u></u></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I only see one subclass of ExternalLibrary and it is ODBCLibrary. I think the alloc call you are referring to is the one in the attached screenshot, but I haven't been able to determine which external module it can't find. The line that
fails is:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New""><cdecl: int16 'SQLAllocEnv' (SQLHENV*)></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">One annoying thing to note is that you cannot use the debugger to step through an FFI call. It will always say there is an invalid module or something
like that. I’ve spoken to Eliot about this and we should be able to get it fixed at some point. But for now just put a self halt after the call and then look at the return code.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt">Arranging a call would be difficult at the moment. I’m already burning the candle at both ends so not much time unfortunately.</span><u></u><u></u></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I understand. <u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal"><span class="m_-3866150655654057402gmailsignatureprefix">-- </span><u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif">R. Mark Volkmann</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Arial,sans-serif">Object Computing, Inc.</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><font face="arial, helvetica, sans-serif">R. Mark Volkmann</font></div><div><span style="font-size:12.8px"><font face="arial, helvetica, sans-serif">Object Computing, Inc.</font></span></div></div></div></div></div></div></div></div></div>