activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <j...@apache.org>
Subject [jira] Created: (AMQCPP-210) ActiveMQ-CPP on Mac OS X and iPhone OS link error
Date Wed, 03 Dec 2008 11:32:05 GMT
ActiveMQ-CPP on Mac OS X and iPhone OS link error
-------------------------------------------------

                 Key: AMQCPP-210
                 URL: https://issues.apache.org/activemq/browse/AMQCPP-210
             Project: ActiveMQ C++ Client
          Issue Type: Bug
          Components: Decaf
    Affects Versions: 2.2.2
         Environment: Mac OS/X iPhone build
            Reporter: Timothy Bish
            Assignee: Timothy Bish


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!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message