Compilation problem in FreeBSD

Guido Falsi via dev-tech-js-engine <[email protected]> Mon, 21 Dec 2020 10:10:22 +0100
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
Hello,

I'm experiencing a strange error while trying to compile spidermonkey 
78.6 on FreeBSD.

For context I'm trying to compile ti as it is embedded in the 0ad game [1].

I get a strange error when linking:

ld: error: undefined symbol: environ
 >>> referenced by std.cys9k1p5-cgu.3
 >>> 
std-b1fe7d92379783a9.std.cys9k1p5-cgu.3.rcgu.o:(std::sys::unix::os::env::hc73a4c63183c9943) 
in archive 
/wrkdirs/usr/ports/games/0ad/work/0ad-d39df1c/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/x86_64-unknown-freebsd/debug/libjsrust.a

In FreeBSD the environ symbol is a static global, and is not defined in 
libc. I understand it's defined in the crt.o object which is linked 
automatically to executables, but, since in this case we are building a 
library, is not included.

I know very little about rust but the problem seems to be that 
libjsrust.a references environ and causes the problem. Can you give me 
some help or a pointer where the issue could be? Grepping for "environ" 
did not help much unluckily.

Thanks in advance!


[1] https://github.com/0ad/0ad/tree/master/libraries/source/spidermonkey
-- 
Guido Falsi <[email protected]>