<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.ex
{mso-style-name:ex;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.gmail-token
{mso-style-name:gmail-token;}
span.gmailsignatureprefix
{mso-style-name:gmail_signature_prefix;}
span.EmailStyle24
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:2133547868;
mso-list-type:hybrid;
mso-list-template-ids:819869900 -171788690 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Symbol;
mso-fareast-font-family:Aptos;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Wingdings;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">I had a quick look at this on my M1 MBP.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I did the following:<br>
<br>
* git clone Cuis-Smalltalk-Dev<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">* git clone Cuis DatabaseSupport<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">* modified the launch script as you described below<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">* run the script: ./RunCuisOnMacTerminal.sh<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">* open a workspace<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">* doIt: Feature require: ‘ODBC’<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">* printIt: ODBCConnection new sqlAllocEnv => a SQLHENV .<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">If I remove the DYLD_LIBRARY_PATH from the launch script then I get the module not found error.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">That all looks correct.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">What do you get if you run this from the command line?<br>
<br>
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-size:11.0pt">% otool -L /usr/local/lib/libodbc.dylib<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Jon<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="color:black">From:
</span></b><span style="color:black">Mark Volkmann <r.mark.volkmann@gmail.com><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 <raiford@labware.com><br>
<b>Cc: </b>Discussion of Cuis Smalltalk <cuis-dev@lists.cuis.st><br>
<b>Subject: </b>Re: [Cuis-dev] ODBC error<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal">See my replies inline below.<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></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">raiford@labware.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">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><o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><br>
<br>
</span><o:p></o:p></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><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><br>
<br>
</span><o:p></o:p></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><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">2. Run the command <span style="font-family:"Arial",sans-serif">
"</span><span class="ex"><span style="font-family:"Courier New";color:#003B4F">brew</span></span><span style="font-family:"Courier New";color:#003B4F"> install sqliteodbc</span><span style="font-family:"Arial",sans-serif;color:#003B4F">" to install the SQLite-specific
shared library.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#003B4F"><br>
<br>
</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#003B4F">That gives me the file
</span><span style="font-family:Consolas;color:#545454;background:#FEFEFE">/usr/local/lib/libsqlite3odbc.dylib</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#545454;background:#FEFEFE">I'm not certain I need this file, but I reference it below.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><br>
<br>
</span><o:p></o:p></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.<o:p></o:p></p>
</div>
<div>
<pre style="mso-margin-top-alt:6.0pt;margin-right:0in;margin-bottom:6.0pt;margin-left:0in;background:#FEFEFE;border-radius:0.3em;font-variant-ligatures:normal;text-decoration-style:initial;text-decoration-color:initial;overflow:auto"><code><span style="color:#545454">[TodoDSN]</span></code><span style="color:#545454"><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:#545454"><o:p></o:p></span></pre>
</div>
<div>
<p class="MsoNormal">4. Clone the GitHub repository at <a href="https://github.com/Cuis-Smalltalk/DatabaseSupport.git">https://github.com/Cuis-Smalltalk/DatabaseSupport.git</a> into the same directory that holds the Cuis-Smalltalk-Dev
directory.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">5. Change the file <span style="font-family:"Courier New"">RunCuisOnMacTerminal.sh</span> to the following:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><span style="font-family:"Courier New"">export DYLD_LIBRARY_PATH="$(brew --prefix)/lib:${DYLD_LIBRARY_PATH}"</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">./CuisVM.app/Contents/MacOS/Squeak CuisImage/Cuis?.?-????.image -u</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">5. Run that script.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">6. Open a "File List", navigate to the DatabaseSupport directory, select
<a href="http://ODBC.pck.st">
ODBC.pck.st</a>, and click "install package".<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">7. Open a Workspace and evaluate the following:<o:p></o:p></p>
</div>
<div>
<pre style="mso-margin-top-alt:6.0pt;margin-right:0in;margin-bottom:6.0pt;margin-left:0in;background:#FEFEFE;border-radius:0.3em;font-variant-ligatures:normal;text-decoration-style:initial;text-decoration-color:initial;overflow:auto"><code><span style="color:#545454">conn </span></code><span class="gmail-token"><span style="color:green">:=</span></span><code><span style="color:#545454"> ODBCConnection dsn</span></code><span class="gmail-token"><span style="color:#545454">:</span></span><code><span style="color:#545454"> 'TodoDSN' user</span></code><span class="gmail-token"><span style="color:#545454">:</span></span><code><span style="color:#545454"> '' password</span></code><span class="gmail-token"><span style="color:#545454">:</span></span><code><span style="color:#545454"> ''</span></code><span class="gmail-token"><span style="color:#545454">.</span></span><span style="font-size:13.5pt;color:#545454"><o:p></o:p></span></pre>
</div>
<div>
<p class="MsoNormal">This gives the error "External module not found". See the attached screenshot.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">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><o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></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:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New""><cdecl: int16 'SQLAllocEnv' (SQLHENV*)></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">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><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt">Arranging a call would be difficult at the moment. I’m already burning the candle at both ends so not much time unfortunately.</span><o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I understand. <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><span class="gmailsignatureprefix">-- </span><o:p></o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif">R. Mark Volkmann</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:"Arial",sans-serif">Object Computing, Inc.</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>