If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Compiling library wrappers on OS X with Informix 11

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-10-08, 10:33
stevetrot stevetrot is offline
Registered User
 
Join Date: Aug 2008
Posts: 2
Compiling library wrappers on OS X with Informix 11

Hi,

I've been trying to compile some libraries so that I can open connections to my Informix 11 server through a TCL shell. So I have two files, one called say db.ec and the other called inftcl.c. inftcl.c contains the TCL commands to do this and db.ec handles using the informix esql libraries to contact the DB server. To do this on Linux I can do something along the following lines:

esql -e db.ec
gcc -c db.c -o db.o
gcc -c inftcl.c -o inftcl.o

Up to this point everything is the same on mac. Then to link to a shared library, say libinftcl I do the followin on Linux:

gcc -shared db.o inftcl.o -o libinftcl.so -shared-libgcc -L/opt/informix/lib -L/opt/informix/lib/esql -lifsql -lifasf -lifgen -lifos -lifgls /opt/informix/lib/esql/checkapi.o -lifglx <non informix includes>

This works fine on Linux but then if I do (what I understand to be the equivalent on OS X):

gcc -dynamiclib db.o inftcl.o -o libinftcl.dylib ....

I get the following warnings and errors:

ld: warning in /opt/informix/lib/esql/libifsql.dylib, file is not of required architecture
ld: warning in /opt/informix/lib/libifasf.dylib, file is not of required architecture
ld: warning in /opt/informix/lib/esql/libifgen.dylib, file is not of required architecture
ld: warning in /opt/informix/lib/esql/libifos.dylib, file is not of required architecture
ld: warning in /opt/informix/lib/esql/libifgls.dylib, file is not of required architecture
ld: warning in /opt/informix/lib/esql/checkapi.o, file is not of required architecture
ld: warning in /opt/informix/lib/esql/libifglx.dylib, file is not of required architecture
Undefined symbols:
"_sqgetdbs", referenced from:
_infGetDbs in db.o
ld: symbol(s) not found

Has anyone come across this kind of thing before? Is there perhaps another way to compile dylib files that might work?

Note that I'm using Informix 11.50 Developer Edition, Mac OS X 10.5.4 and gcc 4.0.1 from XCode 3.0.

Thanks in advance,

Steve
Reply With Quote
  #2 (permalink)  
Old 08-10-08, 19:26
ceinma ceinma is offline
Registered User
 
Join Date: Apr 2007
Location: Jundiai / SP - Brasil
Posts: 311
I don't believed somebody here in this forum already works with Mac.

My suggestion to this questions is this two forums on IBM sites:

http://www-128.ibm.com/developerwork...pa?forumID=548
http://www-128.ibm.com/developerwork...D=19&ca=drs-fo

Or on CDI list:
http://groups.google.com/group/comp....topics?lnk=srg
http://www.iiug.org/forums/informix-list/index.php
__________________
________________________________________
César Inacio Martins
Jundiai / SP - Brasil
http://www.imartins.com.br/informix - em Português
http://www.imartins.com.br/informix - English (translated by Google).
________________________________________
Reply With Quote
  #3 (permalink)  
Old 08-11-08, 09:34
stevetrot stevetrot is offline
Registered User
 
Join Date: Aug 2008
Posts: 2
Thanks for the answer and apologies for using the wrong forum. Have figured it out now however. For those interested it turns out its actually a linker problem, the libraries that come with informix 11 on OS X use architecture x86_64:

otool -hv /opt/informix/lib/esql/libifsql.dylib
/opt/informix/lib/esql/libifsql.dylib:
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC_64 X86_64 ALL 0x00 DYLIB 9 1448 NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS

and I was compiling for architecture i386. Once I recompiled with x86_64 everything worked fine.

Steve
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On