Missing _environ while compiling 6.8.1 on Leopard

Joel Reymont joelr1 at gmail.com
Fri Nov 9 17:23:58 EST 2007

X has nothing to do with this.

Run this test:

junior:ghc-6.8.1 joelr$ nm compiler/stage2/ghc-6.8.1|grep _environ
008f7e10 T ___hscore_environ
00a40004 D _environ

The symbol is there (D). Now run the same on /usr/local/lib/ghc-6.8.1/ 
ghc-6.8.1, assuming you installed into /usr/local. The symbol will  
_not_ be there.

What's going on? Take a look:

junior:ghc-6.8.1 joelr$ strip compiler/stage1/ghc-6.8.1
junior:ghc-6.8.1 joelr$ nm compiler/stage1/ghc-6.8.1|grep _environ
junior:ghc-6.8.1 joelr$

Now you see it and now you don't.

install-sh has a '-s' option that runs strip on the installed  
binaries. To work around the problem either copy the binaries from  
stage2 manually or find the Makefile that runs install-sh -s and  
remove the strip option.

On Nov 9, 2007, at 9:24 PM, Deborah Goldsmith wrote:

> I'm seeing this, too. An fgrep of /usr/include for environ picked up  
> this:
> /usr/include/X11/Xw32defs.h:#define environ     _environ
> Is there any reason this X11 header would get included? That would  
> mess up this in HsBase.h:
> /* ToDo: write a feature test that doesn't assume 'environ' to
> *    be in scope at link-time. */
> extern char** environ;
> INLINE char **__hscore_environ() { return environ; }


More information about the Glasgow-haskell-users mailing list