error compiling nodejs v0.8

433 views
Skip to first unread message

rhasson

unread,
Jun 25, 2012, 6:48:55 PM6/25/12
to nod...@googlegroups.com
I downloaded the latest v.0.8 tar file and tried to compile it on my Fedora 14 and I got this error:

  LINK(target) /home/users/roy/node-v0.8.0/out/Release/mksnapshot
  LINK(target) /home/users/roy/node-v0.8.0/out/Release/mksnapshot: Finished
  ACTION v8_snapshot_run_mksnapshot /home/users/roy/node-v0.8.0/out/Release/obj.target/v8_snapshot/geni/snapshot.cc
/bin/sh: line 1: 27974 Segmentation fault      "/home/users/roy/node-v0.8.0/out/Release/mksnapshot" --log-snapshot-positions --logfile "/home/users/roy/node-v0.8.0/out/Release/obj.target/v8_snapshot/geni/snapshot.log" "/home/users/roy/node-v0.8.0/out/Release/obj.target/v8_snapshot/geni/snapshot.cc"
make[1]: *** [/home/users/roy/node-v0.8.0/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 139
make[1]: Leaving directory `/home/users/roy/node-v0.8.0/out'
make: *** [node] Error 2

Any ideas what could be causing this error?

Thanks,
Roy

Ben Noordhuis

unread,
Jun 25, 2012, 7:01:23 PM6/25/12
to nod...@googlegroups.com
It could be a number of things.

- Can you post the output of `uname -a` and `g++ -v`? It might be a
compiler bug, see e.g. [1].

- Does the debug build work? `make -C out BUILDTYPE=Debug`

- Does `./configure --without-snapshot` produce a working binary?

- What happens when you set v8_no_strict_aliasing% to 1 in
deps/v8/build/common.gypi?

[1] https://github.com/joyent/node/issues/2912

rhasson

unread,
Jun 25, 2012, 8:07:01 PM6/25/12
to nod...@googlegroups.com
roy@mainserver1 node-v0.8.0]$ uname -a
Linux mainserver1 2.6.35.4-rscloud #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux
[roy@mainserver1 node-v0.8.0]$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.5.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC)

So I ran it with --without-snapshot and got this:

make[1]: Leaving directory `/home/users/roy/node-v0.8.0/out'
ln -fs out/Release/node node
[roy@mainserver1 node-v0.8.0]$ sudo make install
make -C out BUILDTYPE=Release
make[1]: Entering directory `/home/users/roy/node-v0.8.0/out'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/users/roy/node-v0.8.0/out'
ln -fs out/Release/node node
out/Release/node tools/installer.js install 
make: *** [install] Segmentation fault
[roy@mainserver1 node-v0.8.0]$ 

[roy@mainserver1 node-v0.8.0]$ out/Release/node node
Segmentation fault
[roy@mainserver1 node-v0.8.0]$ 

After this failed, I did "make clean" and ran again like this:
[roy@mainserver1 node-v0.8.0]$ ./configure --prefix=/home/users/roy/share/node-v0.8 --without-snapshot
[roy@mainserver1 node-v0.8.0]$ make -C out BUILDTYPE=Debug

it complied fine with no errors and worked.
[roy@mainserver1 node-v0.8.0]$ out/Debug/node
> process.version
'v0.8.0'

now to the last suggestion you made:
I made the change to deps/v8/build/common.gypi
and run:
[roy@mainserver1 node-v0.8.0]$ ./configure --prefix=/home/users/roy/share/node-v0.8 --without-snapshot
[roy@mainserver1 node-v0.8.0]$ sudo make

[roy@mainserver1 node-v0.8.0]$ out/Release/node
> process.version
'v0.8.0'
>

sudo make install

[roy@mainserver1 node-v0.8.0]$ /home/users/roy/share/node-v0.8/bin/node
> process.version
'v0.8.0'

This seems to have solved the problem.  

Thanks,
Roy

On Monday, June 25, 2012 7:01:23 PM UTC-4, Ben Noordhuis wrote:

rhasson

unread,
Jun 29, 2012, 11:58:40 PM6/29/12
to nod...@googlegroups.com
Ben, 

I tried compiling 0.8.1 today and I was only able to successfuly compile a Debug build.  I tried a Release build using --without-snapshot and changing the bit in the v8/common.gypi as suggested previously and both times I get "segmentation fault" when I run node.

I prefer not to run a debug build on my production system.  Any ideas why this is happening?

Thanks,
Roy

On Thursday, June 28, 2012 12:38:09 PM UTC-4, James Thornton wrote:
I had the same issue with Node 0.8.0 on Fedora 14:

Linux life 2.6.35.14-106.fc14.x86_64 #1 SMP Wed Nov 23 13:07:52 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

...but was able to compile with...

$ make clean
$ ./configure 
$ make -C out BUILDTYPE=Debug

- James

Ben Noordhuis

unread,
Jun 30, 2012, 10:57:28 AM6/30/12
to nod...@googlegroups.com
On Sat, Jun 30, 2012 at 5:58 AM, rhasson <rha...@gmail.com> wrote:
> Ben,
>
> I tried compiling 0.8.1 today and I was only able to successfuly compile a
> Debug build.  I tried a Release build using --without-snapshot and changing
> the bit in the v8/common.gypi as suggested previously and both times I get
> "segmentation fault" when I run node.
>
> I prefer not to run a debug build on my production system.  Any ideas why
> this is happening?

The most likely culprit is a bug in gcc's optimizer that affects (at
least) 4.5. People have also reported problems with gcc 4.4 but I've
never been able to reproduce that myself.

Check your common.gypi - v8_no_strict_aliasing should be true while
strict_aliasing should be false (I've renamed the second one in the
master branch to node_no_strict_aliasing for the sake of consistency.)

If all else fails, upgrade to gcc 4.6 or 4.7 or compile with clang.

rhasson

unread,
Jun 30, 2012, 4:50:55 PM6/30/12
to nod...@googlegroups.com
it's not working with the changes to common.gypi.  I guess I'll have to upgrade GCC since I'm assuming I'll have this problem with future versions of Node too.

Thanks,
Roy

On Saturday, June 30, 2012 10:57:28 AM UTC-4, Ben Noordhuis wrote:
Reply all
Reply to author
Forward
0 new messages