Date: Wed, 15 Jun 2011 03:00:27 GMT From: L Campbell <lcampbell@ironclad.mobi> To: freebsd-ports-bugs@FreeBSD.org Subject: Re: ports/157875: www/node: node.js fails build of native modules with Undefined Symbol Message-ID: <201106150300.p5F30RoO051235@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/157875; it has been noted by GNATS. From: L Campbell <lcampbell@ironclad.mobi> To: bug-followup@FreeBSD.org, brett@fogcreek.com, vanilla@freebsd.org Cc: Subject: Re: ports/157875: www/node: node.js fails build of native modules with Undefined Symbol Date: Tue, 14 Jun 2011 21:24:08 -0500 --001517592d5aea960e04a5b6d8b7 Content-Type: text/plain; charset=ISO-8859-1 The issue is that the binary built by lang/v8 is compiled with -fvisibility=hidden during compilation. This directive tells GCC to exclude all symbols from the resultant object file except those which are explicitly annotated otherwise; unfortunately, some of the hidden symbols used in every node addon (things like v8::HandleScope, which is going to always be the first function called in any properly-written addon) are hidden by the directive. When you attempt to `require` a node addon (which is just a shared object file), the dynamic linker can't figure out how to link it in because all the necessary symbols aren't exposed. Reading through www/node/work/*/wscript revealed this in the bits where it compiles the version of V8 it comes bundled with, and I just happened to stumble across it while trying to debug this today: 535 # NOTE: We want to compile V8 to export its symbols. I.E. Do not want 536 # -fvisibility=hidden. When using dlopen() it seems that the loaded DSO 537 # cannot see symbols in the executable which are hidden, even if the 538 # executable is statically linked together... Anyway, attached is a patch to lang/v8/Makefile which sets the scons argument to remove the -fvisibility=hidden directive. If you apply the patch, recompile lang/v8, then recompile www/node, addons should work again (shouldn't need to recompile the addons). :D --001517592d5aea960e04a5b6d8b7 Content-Type: text/plain; charset=US-ASCII; name="lang-v8-Makefile.txt" Content-Disposition: attachment; filename="lang-v8-Makefile.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_goxnp5uk0 LS0tIE1ha2VmaWxlLm9yaWcJMjAxMS0wNi0xNCAyMToxNDozNi4wMDAwMDAwMDAgLTA1MDAKKysr IE1ha2VmaWxlCTIwMTEtMDYtMTQgMjE6MDc6MDUuMDAwMDAwMDAwIC0wNTAwCkBAIC0zOSw2ICsz OSw4IEBACiBTQ09OU19BUkdTKz0Jc25hcHNob3Q9b24KIC5lbmRpZgogCitTQ09OU19BUkdTKz0J dmlzaWJpbGl0eT1kZWZhdWx0CisKIC5pZiBkZWZpbmVkKFdJVEhfU0hBUkVEKQogVVNFX0xEQ09O RklHPQl5ZXMKIFBMSVNUX1NVQis9CVY4U0hBUkVEPSIiCg== --001517592d5aea960e04a5b6d8b7--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106150300.p5F30RoO051235>