Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2008
    Posts
    2

    Unanswered: 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

  2. #2
    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).
    ________________________________________

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •