From nobody@FreeBSD.org  Tue Jun 14 14:16:41 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8A9C6106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 14 Jun 2011 14:16:41 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 7A8AC8FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 14 Jun 2011 14:16:41 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p5EEGfI9007544
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 14 Jun 2011 14:16:41 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p5EEGfbJ007543;
	Tue, 14 Jun 2011 14:16:41 GMT
	(envelope-from nobody)
Message-Id: <201106141416.p5EEGfbJ007543@red.freebsd.org>
Date: Tue, 14 Jun 2011 14:16:41 GMT
From: Brett Kiefer <brett@fogcreek.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Ports node.js fails build of native modules with Undefined Symbol
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         157875
>Category:       ports
>Synopsis:       www/node: node.js fails build of native modules with Undefined Symbol
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    vanilla
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 14 14:20:15 UTC 2011
>Closed-Date:    Mon Jun 20 07:18:07 UTC 2011
>Last-Modified:  Mon Jun 20 07:20:12 UTC 2011
>Originator:     Brett Kiefer
>Release:        8.2
>Organization:
Fog Creek Software
>Environment:
FreeBSD trellis-build.hq.fogcreek.com 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
When building native npm packages with a node.js built from /usr/ports/www/node, and a v8 built from /usr/ports/lang/v8, running gives a an Undefined symbol "_ZN2v811HandleScopeC1Ev".
>How-To-Repeat:
This is an example using the 'hiredis' package, but any npm module that builds a native package should have the same effect (I get the same thing with 'node-mongodb-native' and 'forever').

Install node from /usr/ports/www/node.

Then:
$ cd ~
$ curl http://npmjs.org/install.sh | sudo sh
$ npm install hiredis
$ node reader.js
/libexec/ld-elf.so.1: /usr/home/brett/node_modules/hiredis/build/default/hiredis.node: Undefined symbol "_ZN2v811HandleScopeC1Ev"

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-ports-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Jun 14 14:27:39 UTC 2011 
Responsible-Changed-Why:  
ports PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157875 

From: Brett Kiefer <brett@fogcreek.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: misc/157875: Ports node.js fails build of native modules with
 Undefined Symbol
Date: Tue, 14 Jun 2011 11:04:59 -0400

 This issue was created for one of the packages, but it looks like it's
 a general linkage problem:
 https://github.com/christkv/node-mongodb-native/issues/235
 
 On Tue, Jun 14, 2011 at 10:20 AM,  <FreeBSD-gnats-submit@freebsd.org> wrote=
 :
 > Thank you very much for your problem report.
 > It has the internal identification `misc/157875'.
 > The individual assigned to look at your
 > report is: freebsd-bugs.
 >
 > You can access the state of your problem report at any time
 > via this link:
 >
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=3D157875
 >
 >>Category: =A0 =A0 =A0 misc
 >>Responsible: =A0 =A0freebsd-bugs
 >>Synopsis: =A0 =A0 =A0 Ports node.js fails build of native modules with Un=
 defined Symbol
 >>Arrival-Date: =A0 Tue Jun 14 14:20:15 UTC 2011
 >

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--
Responsible-Changed-From-To: freebsd-ports-bugs->vanilla 
Responsible-Changed-By: vanilla 
Responsible-Changed-When: Wed Jun 15 07:17:46 UTC 2011 
Responsible-Changed-Why:  
I will handle this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157875 

From: Brett Kiefer <brett@fogcreek.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: misc/157875: Ports node.js fails build of native modules with
 Undefined Symbol
Date: Wed, 15 Jun 2011 13:59:44 -0400

 lcampbell's patch works for me. Thanks!
 
 On Tue, Jun 14, 2011 at 11:04 AM, Brett Kiefer <brett@fogcreek.com> wrote:
 > This issue was created for one of the packages, but it looks like it's
 > a general linkage problem:
 > https://github.com/christkv/node-mongodb-native/issues/235
 >
 > On Tue, Jun 14, 2011 at 10:20 AM, =A0<FreeBSD-gnats-submit@freebsd.org> w=
 rote:
 >> Thank you very much for your problem report.
 >> It has the internal identification `misc/157875'.
 >> The individual assigned to look at your
 >> report is: freebsd-bugs.
 >>
 >> You can access the state of your problem report at any time
 >> via this link:
 >>
 >> http://www.freebsd.org/cgi/query-pr.cgi?pr=3D157875
 >>
 >>>Category: =A0 =A0 =A0 misc
 >>>Responsible: =A0 =A0freebsd-bugs
 >>>Synopsis: =A0 =A0 =A0 Ports node.js fails build of native modules with U=
 ndefined Symbol
 >>>Arrival-Date: =A0 Tue Jun 14 14:20:15 UTC 2011
 >>
 >
State-Changed-From-To: open->closed 
State-Changed-By: vanilla 
State-Changed-When: Mon Jun 20 07:18:05 UTC 2011 
State-Changed-Why:  
Committed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157875 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/157875: commit references a PR
Date: Mon, 20 Jun 2011 07:16:45 +0000 (UTC)

 vanilla     2011-06-20 07:16:31 UTC
 
   FreeBSD ports repository
 
   Modified files:
     lang/v8              Makefile distinfo pkg-plist 
     lang/v8/files        patch-SConstruct 
   Log:
   1: Upgrade to 3.4.4
   2: install shared library by default.
   3: resolv undefined symbol.
   
   PR:             ports/157875
   Submitted by:   Brett Kiefer <brett at fogcreek.com>, L Campbell <lcampbell at ironclad.mobi> [3]
   
   Revision  Changes    Path
   1.6       +12 -7     ports/lang/v8/Makefile
   1.4       +2 -2      ports/lang/v8/distinfo
   1.2       +8 -4      ports/lang/v8/files/patch-SConstruct
   1.3       +4 -0      ports/lang/v8/pkg-plist
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
