3 Replies Latest reply: Oct 2, 2008 6:06 AM by 428025 RSS

    Building OCCI app on Leopard

    428025
      Hi all,

      I have an app written that uses OCCI which compiles and runs quite happily on Windows and Linux. I'm now trying to port this to Mac OS.

      The port into XCode etc was pretty painless. These were the steps :

      1) I created a new C++ command line project
      2) I copied in my source files and added them to the project
      3) Installed instant client (which all works with 'sqlplus')
      4) Set 'Header Search Paths' and 'Library Search Paths' to refer to the instant client
      5) Added fully pathed references to libclntsh, libocci, libnnz10, lobociei dylibs to 'Other Linker Flags'
      6) Used 'ott' to generate classes for the MDSYS.SDO_GEOMETRY and MDSYS.SDO_POINT_TYPE (Oracle Spatial types) and included these source files in the project.

      The code builds ok but fails on the link phase with these errors :

      Line Location Tool:0: "oracle::occi::setVector(oracle::occi::AnyData&, __gnu_debug_def::vector<oracle::occi::Number, std::allocator<oracle::occi::Number> > const&)", referenced from:
      Line Location Tool:0: symbol(s) not found
      Line Location Tool:0: SDOGeometry::readSQL(oracle::occi::AnyData&) in spatial_classeso.o
      Line Location Tool:0: SDOGeometry::writeSQL(oracle::occi::AnyData&) in spatial_classeso.o
      Line Location Tool:0: "oracle::occi::getVector(oracle::occi::AnyData const&, __gnu_debug_def::vector<oracle::occi::Number, std::allocator<oracle::occi::Number> >&)", referenced from:
      Line Location Tool:0: SDOGeometry::writeSQL(oracle::occi::AnyData&) in spatial_classeso.o
      Line Location Tool:0: SDOGeometry::readSQL(oracle::occi::AnyData&) in spatial_classeso.o

      There just seems to be some problem with setVector() but I'm not sure what!

      Anyone else seen this? (Long shot I know, but hey, maybe someone's watching!)

      Thanks,
      Steve
        • 1. Re: Building OCCI app on Leopard
          jgehrke
          Hi,
          symbol lookup failures in the lik phase almost everytime are caused by not linking all libraries.
          In this case: The missing lib seems to the lib, that is generated out of the generated geometry classes.
          Make sure to include that lib in the the link library list (-lxxx).

          Jens
          • 2. Re: Building OCCI app on Leopard
            428025
            Thanks Jens,

            I think there is a problem with these particular symbols (setVector and getVector) as standard OCCI test case to connect to the database and execute a query works fine.

            I have linked in all the dynlibs provided as part of the instant client, and the same code works on Win / Linux so I'm guessing it's a Mac issue. I've raised a TAR with Oracle so let's see what happens!

            Steve
            • 3. Re: Building OCCI app on Leopard
              428025
              FYI..... I found the solution.

              After much digging the problem is with a couple of Preprocessor macros defined by default in XCode, GLIBCXXDEBUG=1 and GLIBCXXDEBUG_PEDANTIC=1.

              Go into the ‘Build Settings’ for the target, find the Preprocessor Macros entry and remove the two macro definitions. Note that setting them to 0 does not seem to work.

              I've put up a full blog post on the subject of building an OCCI app in XCode here (which includes details of the solution) :

              http://www.mercatorgeosystems.com/blog/?p=25

              I'm not too sure of the implications of removing these macro's but my app seems to work (for now)....

              Steve

              Edited by: Steve Hall on Oct 2, 2008 4:05 AM