Uploaded image for project: 'ActiveMQ C++ Client'
  1. ActiveMQ C++ Client
  2. AMQCPP-210

ActiveMQ-CPP on Mac OS X and iPhone OS link error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.2, 2.2.3, 2.2.4, 2.2.5
    • 2.2.6, 3.0
    • Decaf
    • None
    • Mac OS/X iPhone build

    Description

      Created this from an email

      --Email From - Chris Campbell--

      Thanks for the excellent work on ActiveMQ-CPP! We're using it with
      great success in several of our projects.

      I downloaded version 2.2.2 today and needed to patch src/main/decaf/
      lang/System.cpp to get it to work on Mac OS X and iPhone OS. Not sure
      which variant of 2.2 I was using before, but I didn't recall patching
      it.

      For use in our software, I compile ActiveMQ-CPP as a static library
      (libactivemq-cpp.a) and link it into a Mac OS X framework for use with
      our Mac OS X applications, or link it directly into an iPhone
      application (you're not allowed to build frameworks on the iPhone).

      ActiveMQ-CPP 2.2.2 will successfully compile and link on Mac OS X, but
      if you attempt to use the static library in a non-executable (like a
      shared library or a framework) you get an error at link time that the
      "_environ" symbol could not be found. The reason for this error is
      explained at:

      http://lists.apple.com/archives/xcode-users/2004/Jan/msg00230.html

      I changed System.cpp by adding the following OS X-specific
      implementation of System::getEnvArray() in src/main/decaf/lang/
      System.cpp, created by slightly modifying the non-WIN32 version:

      — BEGIN patch —

      — activemq-cpp-2.2.2-src/src/main/decaf/lang/System.cpp.orig
      2008-12-02 23:51:46.000000000 -0500
      +++ activemq-cpp-2.2.2-src/src/main/decaf/lang/System.cpp 2008-12-02
      19:16:00.000000000 -0500
      @@ -208,6 +208,30 @@
      return buffer;
      }

      +#elif defined(_APPLE_)
      +
      +
      ////////////////////////////////////////////////////////////////////////////////
      +char*** _NSGetEnviron(void);
      +
      +
      ////////////////////////////////////////////////////////////////////////////////
      +std::vector<std::string> System::getEnvArray() {
      +
      + std::vector<std::string> buffer;
      + int count = 0;
      +
      + char **environ = *_NSGetEnviron();
      +
      + for( int i = 0; *(environ + i); i++ )

      { + count++; + }

      +
      + for( int i = 0; *(environ + i); i++ )

      { + buffer.push_back( environ[i] ); + }

      +
      + return buffer;
      +}
      +
      #else

      ////////////////////////////////////////////////////////////////////////////////

      — END patch –

      BTW, what's the first for loop doing? It calculates "count" but
      doesn't use it for anything later in the function?

      Anyway, thanks again for the great software. Wanted to send you the
      patch, and thought you might be interested to know that ActiveMQ-CPP
      is working well on the iPhone!

      Attachments

        Activity

          People

            tabish Timothy A. Bish
            tabish Timothy A. Bish
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: