[SqueakDBX] how to use SqueakDBX with Oracle in Mac OS [WAS] Fwd: Problem with Oracle in Mac OS

Mariano Martinez Peck marianopeck at gmail.com
Thu Aug 19 11:51:26 UTC 2010


For those who needs to run SqueakDBX or OpenDBX with Oracle in Mac OS. Here
is what Colin had to do in order to make it work.

Cheers

Mariano

---------- Forwarded message ----------
From: Colin Doherty <colin.doherty at gmail.com>
Date: Thu, Aug 19, 2010 at 12:10 PM
Subject: Re: Problem with Oracle in Mac OS
To: Mariano Martinez Peck <marianopeck at gmail.com>


Hi Mariano,

This is what I did if you want to add it to the documentation:

Platform: OSX 10.6.4 with Squeak 4.1, Oracle Instant Client for OSX 10.2

Installed SqueakDBX using Monticello.

Installed Oracle Instant Client (downloaded base, sqlplus and sdk packages)
to here: /usr/local/instantclient10_2
Created a subdirectory in /usr/local/instantclient10_2 called tns,
containing tnsnames.ora file.

Added the following environment settings to .bash_profile for compilation of
libopendbx-1.5.0:

DYLD_LIBRARY_PATH=/usr/local/instantclient10_2
ORACLE_HOME=/usr/local/instantclient10_2
TNS_ADMIN=/usr/local/instantclient10_2/tns

Compiled libopendbx-1.5.0 using these flags:

CFLAGS="-m32" CPPFLAGS="-m32 -I/usr/local/instantclient10_2/sdk/include"
LDFLAGS="-arch i386 -L/usr/local/instantclient10_2" ./configure
--disable-utils --with-backends=oracle
make
make install

To get SqueakDBX/Oracle to work when Squeak is launched as an OSX
application need to create the following launch configuration file
/etc/launchd.conf, containing:

setenv DYLD_LIBRARY_PATH /usr/local/instantclient10_2
setenv ORACLE_HOME /usr/local/instantclient10_2
setenv TNS_ADMIN /usr/local/instantclient10_2/tns

Need to reboot for launchd.conf to take effect.

You also need to add these environment settings to your .bash_profile in
order to run squeak with SqueakDBX/Oracle from command line:

DYLD_LIBRARY_PATH=/usr/local/lib:/usr/local/instantclient10_2
ORACLE_HOME=/usr/local/instantclient10_2
TNS_ADMIN=/usr/local/instantclient10_2/tns


Cheers
Colin

On Thu, Aug 19, 2010 at 8:36 AM, Mariano Martinez Peck <
marianopeck at gmail.com> wrote:

>
>
> On Thu, Aug 19, 2010 at 2:48 AM, Colin Doherty <colin.doherty at gmail.com>wrote:
>
>> Hi,
>>
>> I've got it working. The problem turned out to be that environment that
>> launched applications in OSX was very minimal and wasn't including all the
>> required paths. You have to add the DYLD_LIBRARY_PATH to the Oracle
>> libraries for the systems /etc/launchd.conf file and it then works, no
>> memory errors etc.
>>
>>
> Great news!  I had a similar problem with DYLD_LIBRARY_PATH and oracle but
> in Linux. See this link
> http://www.squeakdbx.org/Oracle
>
> In http://www.squeakdbx.org/Different%20backends%20under%20Mac
> you see there is no entry for Oracle ;)
> So....if you want to give us a hand and help with the documentation, please
> let me know. I can create you a user or to send me text.
>
> thanks
>
> mariano
>
>
>
>> Thanks for all your help previously.
>>
>> Cheers
>> Colin
>>
>>
>> On Wed, Aug 18, 2010 at 6:25 PM, Mariano Martinez Peck <
>> marianopeck at gmail.com> wrote:
>>
>>>
>>>
>>> On Wed, Aug 18, 2010 at 7:21 PM, Colin Doherty <colin.doherty at gmail.com>wrote:
>>>
>>>> That's quite possible given my limited C skills. This is what I did,
>>>> just added switch statement and declared error variable:
>>>>
>>>>
>>> Don't worry. I am C limited also...Norbert is the expert here ;)
>>>
>>>
>>>> sb4 error;
>>>>
>>>> if( ( conn->errcode = OCIEnvCreate( &env, OCI_THREADED, NULL, NULL,
>>>> NULL, NULL, 0, NULL ) ) != OCI_SUCCESS )
>>>> {
>>>>         switch( conn->errcode )
>>>>         {
>>>>                 case OCI_SUCCESS:
>>>>                         snprintf( conn->errmsg, OCI_ERROR_MAXMSG_SIZE,
>>>> "Success" );
>>>>                         break;
>>>>                 case OCI_SUCCESS_WITH_INFO:
>>>>                         snprintf( conn->errmsg, OCI_ERROR_MAXMSG_SIZE,
>>>> "Success with info" );
>>>>                         break;
>>>>                 case OCI_NEED_DATA:
>>>>                         snprintf( conn->errmsg, OCI_ERROR_MAXMSG_SIZE,
>>>> "Need data" );
>>>>                         break;
>>>>                 case OCI_NO_DATA:
>>>>                         snprintf( conn->errmsg, OCI_ERROR_MAXMSG_SIZE,
>>>> "No data" );
>>>>                         break;
>>>>                 case OCI_ERROR:
>>>>                         OCIErrorGet( (dvoid*) conn->err, 1, NULL,
>>>> &error, (text*) conn->errmsg, OCI_ERROR_MAXMSG_SIZE, OCI_HTYPE_ERROR
>>>> );
>>>>                         break;
>>>>                 case OCI_INVALID_HANDLE:
>>>>                         snprintf( conn->errmsg, OCI_ERROR_MAXMSG_SIZE,
>>>> "Invalid handle" );
>>>>                         break;
>>>>                 case OCI_STILL_EXECUTING:
>>>>                         snprintf( conn->errmsg, OCI_ERROR_MAXMSG_SIZE,
>>>> "Still executing" );
>>>>                         break;
>>>>                 case OCI_CONTINUE:
>>>>                         snprintf( conn->errmsg, OCI_ERROR_MAXMSG_SIZE,
>>>> "Continue" );
>>>>                         break;
>>>>                 default:
>>>>                         snprintf( conn->errmsg, OCI_ERROR_MAXMSG_SIZE,
>>>> "Unknown error" );
>>>>                         break;
>>>>         }
>>>>
>>>> printf("2-hndl-cleanup");
>>>> printf("ODBX_ERR_NOMEM1 error: %d \n", conn->errcode);
>>>> oracle_odbx_error(handle);
>>>> oracle_priv_handle_cleanup( handle );
>>>> return -ODBX_ERR_NOMEM;
>>>> }
>>>>
>>>
>>> And all the output of these printf where are they? did you check in the
>>> console?  If you run Squeak from the console, and squeak uses OpenDBX
>>> binaries that you modified and added this log, they should appear in the
>>> console output....But....be SURE you are using your own compiled and
>>> modified opendbx binary  :)
>>>
>>> do you know in which of the case it is entering?
>>>
>>> Thanks for all the testing you are doing...hope we can get it ;)
>>>
>>> cheers
>>>
>>> Mariano
>>>
>>>
>>>
>>>>
>>>> However, the memory error was occurring in Squeak/Pharo with SqueakDBX
>>>> before I did this, so even if there is a memory bug above it doesn't explain
>>>> that error.
>>>>
>>>
>>> maybe you are right.
>>>
>>>
>>>>
>>>> Cheers
>>>> Colin
>>>>
>>>>
>>>> On Wed, Aug 18, 2010 at 2:44 PM, Mariano Martinez Peck <
>>>> marianopeck at gmail.com> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Wed, Aug 18, 2010 at 3:17 PM, Colin Doherty <
>>>>> colin.doherty at gmail.com> wrote:
>>>>>
>>>>>>  Did you do what Norbert said about using the oracle functions to get
>>>>>> more info about the error ?
>>>>>>
>>>>>> - Yes, I believe so, that's what produced the additional log entries
>>>>>> from what I can see:
>>>>>>
>>>>>>
>>>>> Can you paste please the code you did in OpenDBX for this?  Maybe there
>>>>> is something wrong there and that's what is causing the malloc error, and
>>>>> not the real cause of the error ;)
>>>>>
>>>>> CC Norbert also.
>>>>>
>>>>>
>>>>>
>>>>>> Aug 15 21:54:09 Colin-Dohertys-MacBook
>>>>>> [0x0-0x29029].org.squeak.SqueakAllInOne41[9243]: Squeak VM
>>>>>> Opt(9243,0xa035f500) malloc: *** error for object 0xf1f2f3f4: pointer being
>>>>>> freed was not allocated
>>>>>> Aug 15 21:54:09 Colin-Dohertys-MacBook
>>>>>> [0x0-0x29029].org.squeak.SqueakAllInOne41[9243]: *** set a breakpoint in
>>>>>> malloc_error_break to debug
>>>>>> Aug 15 21:54:09 Colin-Dohertys-MacBook Squeak VM Opt[9243]: Squeak VM
>>>>>> Opt(9243,0xa035f500) malloc: *** error for object 0xf1f2f3f4: pointer being
>>>>>> freed was not allocated\n*** set a breakpoint in malloc_error_break to debug
>>>>>>
>>>>>> From what I've read malloc_error_break is an OSX memory error,
>>>>>> presumably it's trying to free memory on an object that doesn't exist ?
>>>>>> It looks like you can use Xcode to set a malloc_error_break but I
>>>>>> don't know how you would hook SqueakDBX to this, if it's possible ?
>>>>>>
>>>>>>
>>>>> This is "complicated" since you have to compile the SqueakVM with XCode
>>>>> and maybe put a breakpoint from there....
>>>>>
>>>>>
>>>>>
>>>>>> Cheers
>>>>>> Colin
>>>>>>
>>>>>>
>>>>>> On Wed, Aug 18, 2010 at 9:39 AM, Mariano Martinez Peck <
>>>>>> marianopeck at gmail.com> wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Aug 15, 2010 at 10:58 PM, Colin Doherty <
>>>>>>> colin.doherty at gmail.com> wrote:
>>>>>>>
>>>>>>>> Works with odbxtest too:
>>>>>>>>
>>>>>>>>
>>>>>>> ok....So..opendbx is working correctly. The problem is then with
>>>>>>> SqueakDBX.
>>>>>>>
>>>>>>>
>>>>>>>> Seem to have got some further debug info by adding the additional
>>>>>>>> error code suggested for the OutOfMemory error occurring in Squeak, not sure
>>>>>>>> if it helps:
>>>>>>>>
>>>>>>>>
>>>>>>> I am not sure if this helps. Did you do what Norbert said about using
>>>>>>> the oracle functions to get more info about the error ?
>>>>>>>
>>>>>>>
>>>>>>> " use the OCI error functions and pass the return value to them (like
>>>>>>> in oracle_odbx_error()). Maybe you get a descriptive error message and a
>>>>>>> hint for further investigations."
>>>>>>>
>>>>>>> Probably with that we can know which is the problem...
>>>>>>>
>>>>>>> thanks for the testing
>>>>>>>
>>>>>>> Mariano
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Aug 15 21:54:09 Colin-Dohertys-MacBook
>>>>>>>> [0x0-0x29029].org.squeak.SqueakAllInOne41[9243]: Squeak VM
>>>>>>>> Opt(9243,0xa035f500) malloc: *** error for object 0xf1f2f3f4: pointer being
>>>>>>>> freed was not allocated
>>>>>>>> Aug 15 21:54:09 Colin-Dohertys-MacBook
>>>>>>>> [0x0-0x29029].org.squeak.SqueakAllInOne41[9243]: *** set a breakpoint in
>>>>>>>> malloc_error_break to debug
>>>>>>>> Aug 15 21:54:09 Colin-Dohertys-MacBook Squeak VM Opt[9243]: Squeak
>>>>>>>> VM Opt(9243,0xa035f500) malloc: *** error for object 0xf1f2f3f4: pointer
>>>>>>>> being freed was not allocated\n*** set a breakpoint in malloc_error_break to
>>>>>>>> debug
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> Colin
>>>>>>>>
>>>>>>>> On Sun, Aug 15, 2010 at 9:16 PM, Mariano Martinez Peck <
>>>>>>>> marianopeck at gmail.com> wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Sun, Aug 15, 2010 at 9:18 PM, Colin Doherty <
>>>>>>>>> colin.doherty at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Mariano, Norbert,
>>>>>>>>>>
>>>>>>>>>> I've got the odbxplustest to work with Oracle, it needed the fully
>>>>>>>>>> qualified service name defined on the server rather than that defined
>>>>>>>>>> locally in the TNS settings to function correctly:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> and what about odbxtest  ??  not plus....as that's uses c++
>>>>>>>>>
>>>>>>>>> is it working too?
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> However, in order to get around the problem of Squeak not finding
>>>>>>>>>> the Oracle client library referenced by the odbx library I had to create the
>>>>>>>>>> /b/32_216/rdbms/lib/ directory referenced from within the Oracle library
>>>>>>>>>> libclntsh.dylib.10.1 distributed with Oracle Instant Client. When I try to
>>>>>>>>>> then use this in Squeak I get a DBXFatalError: FATAL OpenDBX: Out of memory
>>>>>>>>>> - note no errors are logged to the squeak debug log when this occurs.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> Could you try what Norbert say to use Oracle funcions to see more
>>>>>>>>> details about the problem?
>>>>>>>>>
>>>>>>>>> thanks a lot in advance
>>>>>>>>>
>>>>>>>>> mariano
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> So it appears odbx is working but SqueakDBX seems to have an issue
>>>>>>>>>> ?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>> Colin
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Mon, Aug 2, 2010 at 8:27 PM, Mariano Martinez Peck <
>>>>>>>>>> marianopeck at gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi Norbert. Colin (in this mail, so please reply to all), has a
>>>>>>>>>>> problem with Oracle in Mac OS.
>>>>>>>>>>>
>>>>>>>>>>> He can configure and compiles without any problem. But when
>>>>>>>>>>> running the opendbx tests, he has the following error:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> 1. Run:
>>>>>>>>>>>   Conn::Conn()
>>>>>>>>>>> Caught exception: Out of memory
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> That problem is in odbx_init_oracle, as it is answering
>>>>>>>>>>> ODBX_ERR_NOMEM  in oracle_odbx_init() where it does:
>>>>>>>>>>>
>>>>>>>>>>>      if( ( conn->errcode = OCIEnvCreate( &env, OCI_THREADED,
>>>>>>>>>>> NULL, NULL, NULL, NULL, 0, NULL ) ) != OCI_SUCCESS )
>>>>>>>>>>>         {
>>>>>>>>>>>                 printf("2-hndl-cleanup");
>>>>>>>>>>>                 oracle_priv_handle_cleanup( handle );
>>>>>>>>>>>                 return -ODBX_ERR_NOMEM;
>>>>>>>>>>>         }
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> The error code was: ODBX_ERR_NOMEM1 error: -1
>>>>>>>>>>>
>>>>>>>>>>> So OCIEnvCreate is answering -1....
>>>>>>>>>>>
>>>>>>>>>>> I had the same problem in Windows, and my problem is that I was
>>>>>>>>>>> using ANOTHER oci.dll. In his case, he checked and only has ONE library.
>>>>>>>>>>>
>>>>>>>>>>> So, we have no idea what to do.
>>>>>>>>>>>
>>>>>>>>>>> Any quotes?
>>>>>>>>>>>
>>>>>>>>>>> Thanks in advance,
>>>>>>>>>>>
>>>>>>>>>>> Mariano
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Aug 2, 2010 at 7:43 PM, Colin Doherty <
>>>>>>>>>>> colin.doherty at gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I've added the printf() to oracle_basic.c and it's failing here:
>>>>>>>>>>>>
>>>>>>>>>>>>         if( ( conn->errcode = OCIEnvCreate( &env, OCI_THREADED,
>>>>>>>>>>>> NULL, NULL, NULL, NULL, 0, NULL ) ) != OCI_SUCCESS )
>>>>>>>>>>>>         {
>>>>>>>>>>>>                 printf("2-hndl-cleanup");
>>>>>>>>>>>>                 oracle_priv_handle_cleanup( handle );
>>>>>>>>>>>>                 return -ODBX_ERR_NOMEM;
>>>>>>>>>>>>         }
>>>>>>>>>>>>
>>>>>>>>>>>> Cheers
>>>>>>>>>>>> Colin
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Sun, Aug 1, 2010 at 8:43 PM, Mariano Martinez Peck <
>>>>>>>>>>>> marianopeck at gmail.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> maybe you can edit oracle_basic.c  and put some flags in the
>>>>>>>>>>>>> function oracle_odbx_init()
>>>>>>>>>>>>> There, you will see several times it is returned
>>>>>>>>>>>>> -ODBX_ERR_NOMEM
>>>>>>>>>>>>> (the error you have)
>>>>>>>>>>>>>
>>>>>>>>>>>>> So maybe we should detect WHERE it is failing, and then, why.
>>>>>>>>>>>>>
>>>>>>>>>>>>> You can just add some printf() and then just recompile.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I know this is crap....but it is the only thing I can do.
>>>>>>>>>>>>>
>>>>>>>>>>>>> cheers
>>>>>>>>>>>>>
>>>>>>>>>>>>> mariano
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Sun, Aug 1, 2010 at 9:39 PM, Mariano Martinez Peck <
>>>>>>>>>>>>> marianopeck at gmail.com> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ---------- Forwarded message ----------
>>>>>>>>>>>>>> From: OpenDBX devel list <
>>>>>>>>>>>>>> libopendbx-devel at lists.sourceforge.net>
>>>>>>>>>>>>>> Date: Tue, Jun 9, 2009 at 9:34 PM
>>>>>>>>>>>>>> Subject: Re: [opendbx] OpenDBX binaries for Windows
>>>>>>>>>>>>>> To: libopendbx-devel at lists.sourceforge.net
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi Mariano
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> > I tried again with your dll for oracle and I get the SAME
>>>>>>>>>>>>>> error I got when
>>>>>>>>>>>>>> > I compiled by myself. I have the OUT_OF_MEMORY problem. See
>>>>>>>>>>>>>> mail with
>>>>>>>>>>>>>> > subject: 'Oracle in Windows' (i couldnt find it in gmane).
>>>>>>>>>>>>>> Perhaps during
>>>>>>>>>>>>>> > this week I can put some flags and see where the problem is.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Did you found something new?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ODBX_ERR_NOMEM is probably returned by oracle_odbx_init() when
>>>>>>>>>>>>>> a handle
>>>>>>>>>>>>>> couldn't be allocated.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Norbert
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> OpenPGP public key
>>>>>>>>>>>>>> http://www.linuxnetworks.de/norbert.pubkey.asc
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>>>>>>> Crystal Reports - New Free Runtime and 30 Day Trial
>>>>>>>>>>>>>> Check out the new simplified licensing option that enables
>>>>>>>>>>>>>> unlimited
>>>>>>>>>>>>>> royalty-free distribution of the report engine for externally
>>>>>>>>>>>>>> facing
>>>>>>>>>>>>>> server and web deployment.
>>>>>>>>>>>>>> http://p.sf.net/sfu/businessobjects
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>> libopendbx-devel mailing list
>>>>>>>>>>>>>> libopendbx-devel at lists.sourceforge.net
>>>>>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/libopendbx-devel
>>>>>>>>>>>>>> http://www.linuxnetworks.de/doc/index.php/OpenDBX
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeakdbx/attachments/20100819/5e9d7547/attachment.htm


More information about the SqueakDBX mailing list