3 Replies Latest reply: Sep 10, 2002 7:21 AM by 336258 RSS

    Linking OCI libraries with Cocoa in Project Builder (MAC OS 10.2)

    336258
      Dear reader,

      ORACLE for MacOS X Jaguar runs beautifully on my Powerbook G4!!

      Does anyone know how to link ORACLE OCI dynamic libraries with Objective C code ? My builds fail as it looks for a library in /Users/oracle/Source/9iR2, a path that does not exist under the ORACLE_HOME directory that was generated by default from the downloaded tar file.

      If any ORACLE engineer reads this message and knows how to fix the problem, please let me know.

      Thank you very much for your help and your patience, and for providing us with ORACLE on Mac.

      Best regards

      Georges BREFORT
      georges.brefort@aventis.com
        • 1. re:Linking OCI libraries with Cocoa in Project Builder (MAC OS 10.2)
          69377
          Is the library you're talking about named libclntsh.dylib.9.0, right?

          I haven't had much experience with compiling on OS X. Indeed, I haven't tried to link with Objective C but I have done compiled an Apache module for PL/SQL access. It's a cousin to the MOD_PLSQL module that usually ships with the database but not in the developers' release. Sorry, I'm digressing.

          Here is my Makefile. I do not statically include any Oracle stuff. It then becomes a link-at-runtime issue that is dealt with by setting the necessary environment variables.

          Does this help?

          Mark
          Oracle Corp
          ==========================================================
          ==========================================================
          ORACLE_HOME=/Users/oracle/9iR2/orahome
          APACHE=/usr/include/httpd
          APACHE_LIB=/usr/libexec/httpd

          all: mod_owarepl.so zlib/zlib.a

          cleanup:
          rm *.o zlib/*.a zlib/*.o

          include $(ORACLE_HOME)/rdbms/demo/demo_rdbms.mk
          CC=gcc

          OBJS = wrb.o utils.o startup.o heap.o \
          logon.o timing.o postqury.o \
          selinto.o ldimage.o cgienv.o \
          ociblock.o ocidesc.o owai.o \
          owassi.o getpage.o ssiblk.o \
          wrbio.o

          DBINCL = $(ORACLE_HOME)/rdbms/demo

          zlib/zlib.a:
          (cd zlib; make -f Makefile.UNX)

          mod_owarepl.so: $(OBJS) mod_owarepl.o zlib/zlib.a owarepl.h
          cc -bundle -undefined suppress -flat_namespace -o $@ $(OBJS) mod_owarepl.o zlib/zlib.a \
          -L$(ORACLE_HOME)/lib -L/Users/oracle/9iR2/orahome/rdbms/lib \
          -L$(APACHE_LIB) $(OCISHAREDLIBS)
          chmod +x mod_owarepl.so

          CFLAGS= -O2 -fPIC -fno-common -DEAPI -DSHARED_MODULE -DDARWIN -I. -I$(DBINCL) -I$(APACHE) -Wall -DERROR_BROKEN
          .c.o:
          $(ECHODO) $(CC) -c $(INCLUDE) $(CFLAGS) $<
          ==========================================================
          ==========================================================
          • 2. re:Linking OCI libraries with Cocoa in Project Builder (MAC OS 10.2)
            abehari
            You need to include these two directories in link command:
            -L$(ORACLE_HOME)/lib -L$(ORACLE_HOME)/rdbms/lib
            Please specify name of missing library.
            • 3. re:Linking OCI libraries with Cocoa in Project Builder (MAC OS 10.2)
              336258
              Good Morning,

              Thank you for your answer.
              Is the library you're talking about named libclntsh.dylib.9.0, right?
              Yes, it is this one. I worked on the issue after posting my message. Actually Apple ProjectBuilder (the July 2002 Jaguar-compatible edition) compiles properly OCI routines together with Objective C code, and builds the executable linked to that dynamic library. One needs to initialize the proper search paths for header files ans libraries, and to add the linker flags "-lclntsh -lm". This is finally equivalent from my (or your) usual UNIX development environment (I could have guessed earlier...).

              Finally the compiled executable runs properly when launched from a BASH shell, with ORACLE environment variables set ( everything is well explained in the ORACLE 9i Release Notes for Mac OS X Part No. B10046-01 ). We get the best of both worlds: ORACLE in the Mac windowing system, and I am gearing up to develop a prototype using this release.

              Thank you again for your help and your patience.

              Georges B.