Gmane
From: Johan Sörensen <johans <at> gmail.com>
Subject: [patch] osx linker errors [was: Re: mod_fastcgi with 1.3.10 on osx]
Newsgroups: gmane.comp.web.lighttpd
Date: 2005-02-09 07:55:36 GMT (4 years, 20 weeks, 5 days, 13 hours and 9 minutes ago)
Hi,

By a combination of luck and google I got 1.3.10 to compile on osx
with the patch below. I say "luck" because I'm not too well versed in
the land of the classic unix dev tools such as ld, so the below patch
may or may not be a workaround to a problem that should be fixed in a
makefile or somewhere else.
But it does make it work on osx 10.3 so I'm happy, perhaps someone
who's a little more known with the lighttpd internals want to take a
look at it too see of it's the kosher way to fix the "ld: Undefined
symbols: _environ" error.

--- ../lighttpd-1.3.10.1/src/base.h	Sun Feb  6 13:19:58 2005
+++ src/base.h	Wed Feb  9 00:19:44 2005
@@ -45,6 +45,13 @@
 # define SSIZE_MAX ((size_t)~0 >> 1)
 #endif

+#ifdef __APPLE__
+#include <crt_externs.h>
+#define environ (* _NSGetEnviron())
+#else
+extern char **environ;
+#endif

 /* for solaris 2.5 and NetBSD 1.3.x */
 #ifndef HAVE_SOCKLEN_T

Regards,
johan

On Tue, 8 Feb 2005 12:46:17 +0100, Johan Sörensen <johans <at> gmail.com> wrote:
> Hi,
> 
> Having resolved my previous libmysql errors on osx, I've come across
> another showstopper with mod_fastcgi:
> 
> [...]
> /bin/sh ../libtool --mode=link gcc  -g -O2 -Wall -W -Wshadow -pedantic
>   -o mod_fastcgi.la -rpath /usr/local/lib -module -export-dynamic
> -avoid-version -no-undefined fcgi.lo liblightcomp.la
> [...]
> gcc  -o .libs/mod_fastcgi.so -bundle  .libs/fcgi.o  -L/usr/local/lib
> ./.libs/liblightcomp.dylib /usr/local/lib/libpcre.dylib
> ld: Undefined symbols:
> _environ
> make[2]: *** [mod_fastcgi.la] Error 1
> make[2]: *** Waiting for unfinished jobs....
> gcc  -o .libs/mod_access.so -bundle  .libs/mod_access.o
> -L/usr/local/lib ./.libs/liblightcomp.dylib
> /usr/local/lib/libpcre.dylib
> creating mod_access.la
> (cd .libs && rm -f mod_access.la && ln -s ../mod_access.la mod_access.la)
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
> 
> (thats all the relevant output I could find)
> I have the fastcgi dev kit installed. I tried the 1.3.8 version of
> lighttpd which compiles without a complaint, so this must be something
> 1.3.10 specific?
> 
> Thanks for being patient with "the new guy",
> Johan
> 

-- 
Johan Sørensen
Professional Futurist
www.johansorensen.com