Bug 206422 - www/node: Fails to compile - Check failed: cpu.has_sse2().
Summary: www/node: Fails to compile - Check failed: cpu.has_sse2().
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Some People
Assignee: Kubilay Kocak
URL: https://groups.google.com/forum/#!top...
Keywords:
: 210753 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-01-20 10:22 UTC by Alberto Mensi
Modified: 2016-07-05 09:37 UTC (History)
6 users (show)

See Also:
bugzilla: maintainer-feedback? (linpct)
koobs: maintainer-feedback+
koobs: merge-quarterly?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alberto Mensi 2016-01-20 10:22:23 UTC
Environment:
FreeBSD 10.1-RELEASE-p16 executed on an AMD Duron CPU / VIA motherboard

Trying to compile the above said port, compilation aborts with the following output:

===>  Building for node-5.4.1
gmake[2]: Entering directory '/usr/ports/www/node/work/node-v5.4.1'
gmake -C out BUILDTYPE=Release V=1
gmake[3]: Entering directory '/usr/ports/www/node/work/node-v5.4.1/out'
  LD_LIBRARY_PATH=/usr/ports/www/node/work/node-v5.4.1/out/Release/lib.host:/usr/ports/www/node/work/node-v5.4.1/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /usr/ports/www/node/work/node-v5.4.1/out/Release/obj.target/v8_snapshot/geni; "/usr/ports/www/node/work/node-v5.4.1/out/Release/mksnapshot" --log-snapshot-positions --logfile "/usr/ports/www/node/work/node-v5.4.1/out/Release/obj.target/v8_snapshot/geni/snapshot.log" "/usr/ports/www/node/work/node-v5.4.1/out/Release/obj.target/v8_snapshot/geni/snapshot.cc" ""


#
# Fatal error in ../deps/v8/src/ia32/assembler-ia32.cc, line 109
# Check failed: cpu.has_sse2().
#

==== C stack trace ===============================

(empty)
deps/v8/tools/gyp/v8_snapshot.target.mk:13: recipe for target '/usr/ports/www/node/work/node-v5.4.1/out/Release/obj.target/v8_snapshot/geni/snapshot.cc' failed
gmake[3]: *** [/usr/ports/www/node/work/node-v5.4.1/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Abort trap (core dumped)
gmake[3]: Leaving directory '/usr/ports/www/node/work/node-v5.4.1/out'
Makefile:45: recipe for target 'node' failed
gmake[2]: *** [node] Error 2
gmake[2]: Leaving directory '/usr/ports/www/node/work/node-v5.4.1'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/node
*** Error code 1

Stop.
make: stopped in /usr/ports/www/node


Even setting MAKE_JOBS_UNSAFE=yes doesn't solve and installing the package directly (node-5.4.1), a core dump is reported; the node port seems broken at the moment.
Comment 1 w.schwarzenfeld 2016-01-20 10:50:11 UTC
Maybe, CFLAGS+=-mno-sse2 helps?
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-20 11:27:35 UTC
This sounds like a combination of a few things:

1) An upstream issue failing to do something due to the non-presence of SSE2 instructions. If these instructions arent compulsory, the build should not, and the issue should be reported upstream:

2) Any CPU specific instructions should a) not be enabled by default and put behind a --enable-optimized flag or similar, OR b) easily disable'able with a build flag. Again an upstream issue, which we 'could' patch locally in the meantime.

3) The port/package should not be build with CPU specific instructions, resulting in failure on systems with CPU's that don't contain those instructions.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-20 11:27:51 UTC
Does this also fail for the www/node4 port?
Comment 4 w.schwarzenfeld 2016-01-20 11:46:25 UTC
./configure --helps shows
--dest-cpu=DEST_CPU   CPU architecture to build for (arm, arm64, ia32, mips,
                        mipsel, ppc, ppc64, x32, x64, x86)
Comment 5 Alberto Mensi 2016-01-20 12:00:46 UTC
(In reply to Kubilay Kocak from comment #3)

I'll try and let you know later (it'll take some hours to compile).

For now, let me say that installing the node-4.2.4 package and executing node, an 'Illegal instruction (core dumped)' is displayed as with the package of node-5.4.1.
Comment 6 Alberto Mensi 2016-01-20 12:05:33 UTC
(In reply to Kubilay Kocak from comment #2)

I understand your concern, I hope this helps debugging:

CPU: AMD Duron(tm) processor (1002.29-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0x670  Family = 0x6  Model = 0x7  Stepping = 0
  Features=0x383f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PA
T,PSE36,MMX,FXSR,SSE>
  AMD Features=0xc0440800<SYSCALL,<b18>,MMX+,3DNow!+,3DNow!>
Comment 7 Alberto Mensi 2016-01-20 17:11:19 UTC
(In reply to w.schwarzenfeld from comment #1)

I'll try modifying compiling options with node5 as you suggested as soon as the current compilation of node4 ends.

Still, this is useful just to exclude a specific CPU feature dependency, that - in case it exists - should anyway be detected and eliminated later.
Comment 8 Alberto Mensi 2016-01-20 21:25:41 UTC
(In reply to Kubilay Kocak from comment #3)

Node4 compilation has just ended, with the same fatal error in the same module (assembler-ia32.cc) of node5; here is the output:

===>  Building for node4-4.2.4
gmake[2]: Entering directory '/usr/ports/www/node4/work/node-v4.2.4'
gmake -C out BUILDTYPE=Release V=1
gmake[3]: Entering directory '/usr/ports/www/node4/work/node-v4.2.4/out'
  LD_LIBRARY_PATH=/usr/ports/www/node4/work/node-v4.2.4/out/Release/lib.host:/usr/ports/www/node4/work/node-v4.2.4/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /usr/ports/www/node4/work/node-v4.2.4/out/Release/obj.target/v8_snapshot/geni; "/usr/ports/www/node4/work/node-v4.2.4/out/Release/mksnapshot" --log-snapshot-positions --logfile "/usr/ports/www/node4/work/node-v4.2.4/out/Release/obj.target/v8_snapshot/geni/snapshot.log" "/usr/ports/www/node4/work/node-v4.2.4/out/Release/obj.target/v8_snapshot/geni/snapshot.cc" ""


#
# Fatal error in ../deps/v8/src/ia32/assembler-ia32.cc, line 109
# Check failed: cpu.has_sse2().
#

==== C stack trace ===============================

(empty)
deps/v8/tools/gyp/v8_snapshot.target.mk:13: recipe for target '/usr/ports/www/node4/work/node-v4.2.4/out/Release/obj.target/v8_snapshot/geni/snapshot.cc' failed
gmake[3]: *** [/usr/ports/www/node4/work/node-v4.2.4/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Abort trap (core dumped)
gmake[3]: Leaving directory '/usr/ports/www/node4/work/node-v4.2.4/out'
Makefile:45: recipe for target 'node' failed
gmake[2]: *** [node] Error 2
gmake[2]: Leaving directory '/usr/ports/www/node4/work/node-v4.2.4'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/node4
*** Error code 1

Stop.
make: stopped in /usr/ports/www/node4
Comment 9 Alberto Mensi 2016-01-20 21:46:44 UTC
(In reply to Alberto Mensi from comment #7)

I've just added CFLAGS+=-mno-sse2 to /etc/make.conf and resumed node4 compilation; it has gone on for some time, then stopped again with the following error, plainly reported sse2 not supported:

===>  Building for node4-4.2.4
gmake[2]: Entering directory '/usr/ports/www/node4/work/node-v4.2.4'
gmake -C out BUILDTYPE=Release V=1
gmake[3]: Entering directory '/usr/ports/www/node4/work/node-v4.2.4/out'
  c++ '-DV8_TARGET_ARCH_IA32' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8  -pthread -Wall -Wextra -Wno-unused-parameter -m32 -msse2 -mfpmath=sse -mmmx -fno-strict-aliasing -I/usr/local/include -m32 -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /usr/ports/www/node4/work/node-v4.2.4/out/Release/.deps//usr/ports/www/node4/work/node-v4.2.4/out/Release/obj.target/v8_base/deps/v8/src/accessors.o.d.raw -O2 -pipe -mno-sse2 -Wno-unused-private-field -Wno-nested-anon-types -Wno-unused-function -Wno-unused-const-variable -fstack-protector -fno-strict-aliasing  -c -o /usr/ports/www/node4/work/node-v4.2.4/out/Release/obj.target/v8_base/deps/v8/src/accessors.o ../deps/v8/src/accessors.cc
error: the 'sse' unit is not supported with this instruction set
deps/v8/tools/gyp/v8_base.target.mk:401: recipe for target '/usr/ports/www/node4/work/node-v4.2.4/out/Release/obj.target/v8_base/deps/v8/src/accessors.o' failed
gmake[3]: *** [/usr/ports/www/node4/work/node-v4.2.4/out/Release/obj.target/v8_base/deps/v8/src/accessors.o] Error 1
gmake[3]: Leaving directory '/usr/ports/www/node4/work/node-v4.2.4/out'
Makefile:45: recipe for target 'node' failed
gmake[2]: *** [node] Error 2
gmake[2]: Leaving directory '/usr/ports/www/node4/work/node-v4.2.4'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/node4
*** Error code 1

Stop.
make: stopped in /usr/ports/www/node4

Again, this is the output of the resumed compilation of node5, aborting in the same way and in the same module of node4, for the same cause:

===>  Building for node-5.4.1
gmake[2]: Entering directory '/usr/ports/www/node/work/node-v5.4.1'
gmake -C out BUILDTYPE=Release V=1
gmake[3]: Entering directory '/usr/ports/www/node/work/node-v5.4.1/out'
  c++ '-DV8_TARGET_ARCH_IA32' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8  -pthread -Wall -Wextra -Wno-unused-parameter -m32 -msse2 -mfpmath=sse -mmmx -fno-strict-aliasing -I/usr/local/include -m32 -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /usr/ports/www/node/work/node-v5.4.1/out/Release/.deps//usr/ports/www/node/work/node-v5.4.1/out/Release/obj.target/v8_base/deps/v8/src/accessors.o.d.raw  -O2 -pipe -mno-sse2 -Wno-unused-private-field -Wno-nested-anon-types -Wno-unused-function -Wno-unused-const-variable -fstack-protector -fno-strict-aliasing  -c -o /usr/ports/www/node/work/node-v5.4.1/out/Release/obj.target/v8_base/deps/v8/src/accessors.o ../deps/v8/src/accessors.cc
error: the 'sse' unit is not supported with this instruction set
deps/v8/tools/gyp/v8_base.target.mk:417: recipe for target '/usr/ports/www/node/work/node-v5.4.1/out/Release/obj.target/v8_base/deps/v8/src/accessors.o' failed
gmake[3]: *** [/usr/ports/www/node/work/node-v5.4.1/out/Release/obj.target/v8_base/deps/v8/src/accessors.o] Error 1
gmake[3]: Leaving directory '/usr/ports/www/node/work/node-v5.4.1/out'
Makefile:45: recipe for target 'node' failed
gmake[2]: *** [node] Error 2
gmake[2]: Leaving directory '/usr/ports/www/node/work/node-v5.4.1'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/node
*** Error code 1

Stop.
make: stopped in /usr/ports/www/node
Comment 10 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-21 04:31:50 UTC
@Alberto, 

For large bodies of text like log output, etc, please use attachments instead of comments, as it allows people to follow the conversation more easily

I suspect there might be a way to disable these optimizations on a better than individual CFLAGS overriding basis
Comment 11 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-21 04:37:47 UTC
Apprently v8 dropped support for CPU's with no SSE2/CMOV support. Thanks Brendan Molloy for the find.
Comment 12 VK freebsd_triage 2016-07-05 08:36:47 UTC
*** Bug 210753 has been marked as a duplicate of this bug. ***
Comment 13 VK freebsd_triage 2016-07-05 08:46:30 UTC
Does this mean it's a feature, not a bug? :)  Close?

Also, as the maintainer changed in the meanwhile, adding current maintainer feedback request.
Comment 14 Bradley T. Hughes freebsd_committer freebsd_triage 2016-07-05 09:12:26 UTC
I am not sure I would call it a "feature", but it certainly isn't a bug. It was a conscious decision by the V8 team. I don't think there is any other option than to close this PR.