You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2008/12/03 12:32:05 UTC

[jira] Created: (AMQCPP-210) ActiveMQ-CPP on Mac OS X and iPhone OS link error

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.


[jira] Updated: (AMQCPP-210) ActiveMQ-CPP on Mac OS X and iPhone OS link error

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQCPP-210?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish updated AMQCPP-210:
--------------------------------

    Affects Version/s: 2.2.3
                       2.2.4
                       2.2.5
        Fix Version/s:     (was: 2.2.3)
                       3.0
                       2.2.6

> 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, 2.2.3, 2.2.4, 2.2.5
>         Environment: Mac OS/X iPhone build
>            Reporter: Timothy Bish
>            Assignee: Timothy Bish
>             Fix For: 2.2.6, 3.0
>
>
> 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.


[jira] Reopened: (AMQCPP-210) ActiveMQ-CPP on Mac OS X and iPhone OS link error

Posted by "Francesco Pierfederici (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQCPP-210?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Francesco Pierfederici reopened AMQCPP-210:
-------------------------------------------


Hi,

I was getting the same error (i.e. the deaded "Symbol not found: _environ") with activemqcpp 2.2.6 on Mac OS X 10.5.6 using GCC 4.0.1.

I noticed that System.cpp checks for the var. _APPLE_ instead of __APPLE__ and so the corresponding #elif block was not compiled.

I finally got it working with these modifications to System.cpp:

{noformat}
inanna> diff -up src/main/decaf/lang/System.cpp.orig src/main/decaf/lang/System.cpp
--- src/main/decaf/lang/System.cpp.orig 2009-04-26 14:34:49.000000000 -0700
+++ src/main/decaf/lang/System.cpp      2009-04-26 15:27:13.000000000 -0700
@@ -208,17 +208,18 @@ std::vector<std::string> System::getEnvA
     return buffer;
 }
 
-#elif defined(_APPLE_)
+#elif defined(__APPLE__)
 
 ////////////////////////////////////////////////////////////////////////////////
-char*** _NSGetEnviron();
-
+// char*** _NSGetEnviron();
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
 ////////////////////////////////////////////////////////////////////////////////
 std::vector<std::string> System::getEnvArray() {
 
     std::vector<std::string> buffer;
 
-    char **environ = *_NSGetEnviron();
+    // char **environ = *_NSGetEnviron();
 
     for( int i = 0; *(environ + i); i++ ){
         buffer.push_back( environ[i] );
{noformat}

> 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
>             Fix For: 2.2.3
>
>
> 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.


[jira] Resolved: (AMQCPP-210) ActiveMQ-CPP on Mac OS X and iPhone OS link error

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQCPP-210?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish resolved AMQCPP-210.
---------------------------------

    Resolution: Fixed

Patch applied with modification:  Resolved issue in trunk and in 2.x branch.

> 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, 2.2.3, 2.2.4, 2.2.5
>         Environment: Mac OS/X iPhone build
>            Reporter: Timothy Bish
>            Assignee: Timothy Bish
>             Fix For: 2.2.6, 3.0
>
>
> 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.


[jira] Resolved: (AMQCPP-210) ActiveMQ-CPP on Mac OS X and iPhone OS link error

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQCPP-210?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish resolved AMQCPP-210.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3

Resloved in Trunk, tested on Mac OS/X

> 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
>             Fix For: 2.3
>
>
> 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.