Bugs item #2715, was opened at 2005-10-24 23:01
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2715&group_id=426

Category: Core
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Blair Zajac (blairzajac)
Assigned to: Nobody (None)
Summary: [PATCH] 1.8.3 ruby.c doesn't compile on OS X due to missing char **environ

Initial Comment:
Hello,

I'm working on getting Ruby 1.8.3 into Fink, the Debian style
package managed system for Mac OS X.

Ruby 1.8.3 introduced the usage of the

extern char **environ;

in ruby.c.

Mac OS X does not have this symbol, which you can confirm by greping
through /usr/include and nm on the /usr/lib/*.

The work around is to do something like this:

--- ruby-1.8.3.org/ruby.c       Tue Jun 28 15:09:58 2005
+++ ruby-1.8.3/ruby.c   Sun Oct 16 23:42:31 2005
@@ -975,7 +975,13 @@
 static struct {
     char *begin, *end;
 } envspace;
+
+#ifdef __APPLE__
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
 extern char **environ;
+#endif

 static void
 set_arg0space()

The note referencing this patch is from the Fink developers mailing list:

http://article.gmane.org/gmane.os.apple.fink.devel/11417

Regards,
Blair


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2715&group_id=426