Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Cannot build node.js on Solaris 10 - non-GNU ld not supported #5081

Closed
drook opened this issue Mar 19, 2013 · 2 comments
Closed

Cannot build node.js on Solaris 10 - non-GNU ld not supported #5081

drook opened this issue Mar 19, 2013 · 2 comments

Comments

@drook
Copy link

drook commented Mar 19, 2013

OS: Solaris 10 x86
GCC: # /usr/local/gcc/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.7.2/libexec/gcc/i386-pc-solaris2.10/4.7.2/lto-wrapper
Target: i386-pc-solaris2.10
Configured with: ../configure --prefix=/usr/local/gcc-4.7.2 --without-gnu-as --with-as=/usr/ccs/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-shared --enable-languages=c,c++ --with-gmp=/usr/local/gmp --with-gmp-lib=/usr/local/gmp/lib/32 --with-mpfr=/usr/local/mpfr --with-mpfr-lib=/usr/local/mpfr/lib/32 --with-mpc=/usr/local/mpc --with-mpc-lib=/usr/local/mpc/lib/32
Thread model: posix
gcc version 4.7.2 (GCC)

ENV:

CC=/usr/local/gcc/bin/gcc
CXX=/usr/local/gcc/bin/g++
LINK=/usr/local/gcc/bin/g++

export CC CXX LINK

./configure --prefix=/usr/local/node.js-0.10.0 --no-ifaddrs --dest-cpu=x64 --dest-os=solaris --without-dtrace

The compilation crashes:

./gyp-sun-tool flock /home/emz/node.js-clean/node-v0.10.0/out/Release/linker.lock g++ -rdynamic -m64 -pthreads -Wl,-z,allextract -o /home/emz/node.js-clean/node-v0.10.0/out/Release/mksnapshot -Wl,--start-group /home/emz/node.js-clean/node-v0.10.0/out/Release/obj.target/mksnapshot/deps/v8/src/mksnapshot.o /home/emz/node.js-clean/node-v0.10.0/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a /home/emz/node.js-clean/node-v0.10.0/out/Release/obj.target/deps/v8/tools/gyp/libv8_nosnapshot.a -Wl,--end-group -lsocket -lnsl
g++: unrecognized option -rdynamic' /usr/ccs/bin/ld: illegal option -- start-group /usr/ccs/bin/ld: illegal option -- end-group usage: ld [-6:abc:d:e:f:h:il:mo:p:rstu:z:B:CD:F:GI:L:M:N:P:Q:R:S:VY:?] file(s) [-64] enforce a 64-bit link-edit [-a] create an absolute file [-b] do not do special PIC relocations in a.out [-B direct | nodirect] establish direct bindings, or inhibit direct binding to, the object being created [-B dynamic | static] search for shared libraries|archives [-B eliminate] eliminate unqualified global symbols from the symbol table [-B group] relocate object from within group [-B local] reduce unqualified global symbols to local [-B reduce] process symbol reductions [-B symbolic] bind external references to definitions when creating shared objects [-c name] record configuration filename'
[-C] demangle C++ symbol name diagnostics
[-d y | n] operate in dynamic|static mode
[-D token,...] print diagnostic messages
[-e epsym] use epsym' as entry point address [-f name] specify library for which this file is an auxiliary filter [-F name] specify library for which this file is a filter [-G] create a shared object [-h name] usename' as internal shared object identifier
[-i] ignore LD_LIBRARY_PATH setting
[-I name] use name' as path of interpreter [-l x] search for libx.so or libx.a [-L path] search for libraries in directorypath'
[-m] print memory map
[-M mapfile] use processing directives contained in mapfile' [-N string] create a dynamic dependency forstring'
[-o outfile] name the output file outfile' [-p auditlib] identify audit library to accompany this object [-P auditlib] identify audit library for processing the dependencies of this object [-Q y | n] do|do not place version information in output file [-r] create a relocatable object [-R path] specify a library search path to be used at run time [-s] strip any symbol and debugging information [-S supportlib] specify a link-edit support library [-t] do not warn of multiply-defined symbols that have different sizes or alignments [-u symname] create an undefined symbolsymname'
[-V] print version information
[-Y P,dirlist] use dirlist' as a default path when searching for libraries [-z absexec] when building an executable absolute symbols referenced in dynamic objects are promoted to the executable [-z allextract | defaultextract | weakextract] extract all member files, only members that resolve undefined tor tentative symbols, or allow extraction of archive members to resolvetweak references from archive files [-z altexec64] execute the 64-bit link-editor [-z combreloc] combine multiple relocation sections [-z defs] disallow undefined symbol references [-z direct | nodirect] enable|disable direct binding to shared object dependencies [-z endfiltee] marks a filtee such that it will terminate a filters search [-z finiarray=function] name of function to be appended to the .finiarray [-z groupperm | nogroupperm] enable|disable setting of group permissions on dynamic dependencies [-z help ] print this usage message [-z ignore | record] ignore|record unused dynamic dependencies [-z initarray=function] name of function to be appended to the .initarray [-z initfirst] mark object to indicate that its .init section should be executed before the .init section of any other objects [-z interpose] dynamic object is to be aninterposer' on direct
bindings
[-z lazyload | nolazyload]
enable|disable delayed loading of shared object
dependencies
[-z ld32=arg1,arg2,...]
define arguments applicable to the 32-bit class of ld(1)
[-z ld64=arg1,arg2,...]
define arguments applicable to the 64-bit class of ld(1)
[-z loadfltr] mark filter as requiring immediate loading of its
filtees at runtime
[-z muldefs] allow multiply-defined symbols
[-z nocompstrtab]
disable compression of string tables
[-z nodefs] allow undefined symbol references
[-z nodefaultlib]
mark object to ignore any default library search path
[-z nodelete] mark object as non-deletable
[-z nodlopen] mark object as non-dlopen()'able
[-z nodump] mark object as non-dldump()'able
[-z now] mark object as requiring non-lazy binding
[-z nopartial] expand any partially initialized symbols
[-z noversion] don't record any version sections
[-z origin] mark object as requiring $ORIGIN processing
[-z preinitarray=function]
name of function to be appended to the .preinitarray
[-z redlocsym] reduce local syms in .symtab to a minimum
[-z rescan] rescan archive list until no further member
extraction occurs
[-z text] disallow output relocations against text
[-z textoff] allow output relocations against text
[-z textwarn] warn if there are relocations against text
[-z verbose] generate warnings for suspicious processings
collect2: ld returned 1 exit status

First of all, as you can see, the CXX env variable isn't honored (and g++ 3.4.3 is invoked instead 4.7.2).
Second, the correct linking should look like:

./gyp-sun-tool flock /home/emz/node.js-clean/node-v0.10.0/out/Release/linker.lock g++ -rdynamic -m64 -pthreads -Wl,-z,allextract -o /home/emz/node.js-clean/node-v0.10.0/out/Release/mksnapshot -Wl,-z,rescan /home/emz/node.js-clean/node-v0.10.0/out/Release/obj.target/mksnapshot/deps/v8/src/mksnapshot.o /home/emz/node.js-clean/node-v0.10.0/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a /home/emz/node.js-clean/node-v0.10.0/out/Release/obj.target/deps/v8/tools/gyp/libv8_nosnapshot.a -Wl,-lsocket -lnsl

Third, the -lrt library is missing.
With all of that, node.js can be built and ran on Solaris 10 (this is first of two crashes, but the same thing applies to the second one).

I saw a closed #2123 , the patch doesn't help any more - it complains about ar invocation (I guess first argument is missing).

So, this is still the issue. Since Solaris 10 will remain active as a platform for some time, it would be really nice to build node.js on it without problems.

@bnoordhuis
Copy link
Member

The fact that solaris ld is used is not something either node or gyp can fix, I think - I'm reasonably sure it's hard-coded into the g++ binary. That said, if you build with make LINK=/path/to/gnu-toolchain-g++ it should work (same for CXX).

Why is librt needed? Is it because V8 calls sched_yield() in a couple of places? I can't take patches for that but if you submit it to (and get it landed in) upstream V8, I'll be happy to cherry-pick it.

@drook
Copy link
Author

drook commented Mar 19, 2013

Nah, librt is needed because of the various sem_*() stuff, that's why linking fails without it.
Solaris ld is used because I compiled gcc 4.7.2 mentioning that I want to use it. By the way I thought that since it's the official linker for this platform, I have to use it, but seems like I was wrong.
Thanks.

@drook drook closed this as completed Mar 19, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants