Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node compile failure on Solaris 11.2 and gcc 4.8 (undefined std::isnan) #3179

Closed
cgalibern opened this issue Oct 5, 2015 · 19 comments
Closed
Labels
build Issues and PRs related to build files or the CI. smartos Issues and PRs related to the SmartOS platform.

Comments

@cgalibern
Copy link

./configure --dest-cpu=x64 --dest-os=solaris --prefix=/opt/node

make
make -C out BUILDTYPE=Release V=1
make[1]: Entering directory .../node.git/out' deps/v8/tools/gyp/v8_base.target.mk:432: warning: overriding recipe for targetsomewhere/node.git/out/Release/libv8_base.a'
deps/v8/tools/gyp/v8_base.host.mk:428: warning: ignoring old recipe for target somewhere/node.git/out/Release/libv8_base.a' deps/v8/tools/gyp/v8_libbase.target.mk:147: warning: overriding recipe for targetsomewhere/node.git/out/Release/libv8_libbase.a'
deps/v8/tools/gyp/v8_libbase.host.mk:143: warning: ignoring old recipe for target somewhere/node.git/out/Release/libv8_libbase.a' deps/v8/tools/gyp/v8_libplatform.target.mk:135: warning: overriding recipe for targetsomewhere/node.git/out/Release/libv8_libplatform.a'
deps/v8/tools/gyp/v8_libplatform.host.mk:131: warning: ignoring old recipe for target somewhere/node.git/out/Release/libv8_libplatform.a' deps/v8/tools/gyp/v8_nosnapshot.target.mk:139: warning: overriding recipe for targetsomewhere/node.git/out/Release/libv8_nosnapshot.a'
deps/v8/tools/gyp/v8_nosnapshot.host.mk:135: warning: ignoring old recipe for target somewhere/node.git/out/Release/libv8_nosnapshot.a' deps/v8/tools/gyp/v8_snapshot.target.mk:158: warning: overriding recipe for targetsomewhere/node.git/out/Release/libv8_snapshot.a'
deps/v8/tools/gyp/v8_snapshot.host.mk:158: warning: ignoring old recipe for target somewhere/node.git/out/Release/libv8_snapshot.a' g++ '-DV8_TARGET_ARCH_X64' '-D__C99FEATURES__=1' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8 -Wall -Wextra -Wno-unused-parameter -m64 -pthreads -fno-strict-aliasing -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF somewhere/node.git/out/Release/.deps/somewhere/node.git/out/Release/obj.target/v8_base/deps/v8/src/accessors.o.d.raw -c -o somewhere/node.git/out/Release/obj.target/v8_base/deps/v8/src/accessors.o ../deps/v8/src/accessors.cc In file included from ../deps/v8/src/objects-inl.h:18:0, from ../deps/v8/src/v8.h:39, from ../deps/v8/src/accessors.cc:5: ../deps/v8/src/conversions-inl.h: In function 'double v8::internal::DoubleToInteger(double)': ../deps/v8/src/conversions-inl.h:79:7: error: '__builtin_isnan' is not a member of 'std' if (std::isnan(x)) return 0; ^ ../deps/v8/src/conversions-inl.h:79:7: note: suggested alternative: <built-in>:0:0: note: '__builtin_isnan' In file included from /usr/include/math.h:13:0, from /usr/gcc/4.8/include/c++/4.8.2/cmath:44, from ../deps/v8/src/utils.h:11, from ../deps/v8/src/v8.h:34, from ../deps/v8/src/accessors.cc:5: ../deps/v8/src/conversions-inl.h:80:13: error: expected unqualified-id before '__extension__' if (!std::isfinite(x) || x == 0) return x; ^ ../deps/v8/src/conversions-inl.h:80:13: error: expected ')' before '__extension__' In file included from ../deps/v8/src/v8.h:39:0, from ../deps/v8/src/accessors.cc:5: ../deps/v8/src/objects-inl.h: In member function 'bool v8::internal::Object::IsNaN() const': ../deps/v8/src/objects-inl.h:1125:34: error: '__builtin_isnan' is not a member of 'std' return this->IsHeapNumber() && std::isnan(HeapNumber::cast(this)->value()); ^ ../deps/v8/src/objects-inl.h:1125:34: note: suggested alternative: <built-in>:0:0: note: '__builtin_isnan' ../deps/v8/src/objects-inl.h: In member function 'void v8::internal::FixedDoubleArray::set(int, double)': ../deps/v8/src/objects-inl.h:2312:7: error: '__builtin_isnan' is not a member of 'std' if (std::isnan(value)) { ^ ../deps/v8/src/objects-inl.h:2312:7: note: suggested alternative: <built-in>:0:0: note: '__builtin_isnan' make[1]: *** [somewhere/node.git/out/Release/obj.target/v8_base/deps/v8/src/accessors.o] Error 1 make[1]: Leaving directorysomewhere/node.git/out'
make: *** [node] Error 2

Same issue as nodejs/node-v0.x-archive#9351

@jbergstroem jbergstroem added the build Issues and PRs related to build files or the CI. label Oct 5, 2015
@jbergstroem
Copy link
Member

@nodejs/platform-solaris: Ping. Does anyone have solaris 11.2 to test the patch on?

@jbergstroem
Copy link
Member

@cgalibern this is against latest git nodejs HEAD?

@cgalibern
Copy link
Author

yes, after: git clone https://github.com/nodejs/node.git

git branch -v

  • master 2e6ece4 node: add -c|--check CLI arg to syntax check script

@jbergstroem
Copy link
Member

So, adding this define doesn't at least break our current smartos builds. Test suite runs fine. If you say it fixes your issue, I'm ok with merging. Anyone else in @nodejs/platform-solaris object?

Edit: I'll create a PR if so.

@misterdjules
Copy link

I'm wondering if using -std=gnu++11 would also fix the problem? The interaction between std::isnan and other math macros/functions from the C99 standard and the respective similar functions from the C++0x/11 and later standards can be very confusing on some platforms. I don't have access to a Solaris system right now so I can't test it myself.

Otherwise, I don't have a problem with defining _GLIBCXX_USE_C99_MATH on Solaris. The error itself is in V8's source, and I'm wondering if it would be worth it to submit a patch upstream.

Also, do we have Solaris (not SmartOS) Jenkins agents on which to run builds and tests?

@cgalibern
Copy link
Author

I will try to compile using -std=gnu++11 tomorrow.

@jbergstroem
Copy link
Member

@misterdjules no, we don't - but it'd be great if we did.

@jbergstroem
Copy link
Member

@cgalibern ping! any feedback?

@cgalibern
Copy link
Author

Hi,
I have tried:

  • add -std=gnu++11 => failed
    example: g++ '-DV8_TARGET_ARCH_X64' '-D__C99FEATURES__=1' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8 -Wall -Wextra -Wno-unused-parameter -m64 -pthreads -fno-strict-aliasing -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -std=gnu++11 -MMD -MF
    =>
    In file included from ../deps/v8/src/objects-inl.h:18:0, from ../deps/v8/src/v8.h:39, from ../deps/v8/src/accessors.cc:5: ../deps/v8/src/conversions-inl.h: In function 'double v8::internal::DoubleToInteger(double)': ../deps/v8/src/conversions-inl.h:79:7: error: '__builtin_isnan' is not a member of 'std' if (std::isnan(x)) return 0; ^ ../deps/v8/src/conversions-inl.h:79:7: note: suggested alternative: <built-in>:0:0: note: '__builtin_isnan' In file included from /usr/include/math.h:13:0, from /usr/gcc/4.8/include/c++/4.8.2/cmath:44, from ../deps/v8/src/utils.h:11, from ../deps/v8/src/v8.h:34, from ../deps/v8/src/accessors.cc:5: ../deps/v8/src/conversions-inl.h:80:13: error: expected unqualified-id before '__extension__' if (!std::isfinite(x) || x == 0) return x; ^ ../deps/v8/src/conversions-inl.h:80:13: error: expected ')' before '__extension__' In file included from ../deps/v8/src/v8.h:39:0, from ../deps/v8/src/accessors.cc:5: ../deps/v8/src/objects-inl.h: In member function 'bool v8::internal::Object::IsNaN() const': ../deps/v8/src/objects-inl.h:1125:34: error: '__builtin_isnan' is not a member of 'std' return this->IsHeapNumber() && std::isnan(HeapNumber::cast(this)->value()); ^ ../deps/v8/src/objects-inl.h:1125:34: note: suggested alternative: <built-in>:0:0: note: '__builtin_isnan' ../deps/v8/src/objects-inl.h: In member function 'void v8::internal::FixedDoubleArray::set(int, double)': ../deps/v8/src/objects-inl.h:2312:7: error: '__builtin_isnan' is not a member of 'std' if (std::isnan(value)) { ^ ../deps/v8/src/objects-inl.h:2312:7: note: suggested alternative: <built-in>:0:0: note: '__builtin_isnan'
  • replace -std=gnu++0x by std=gnu++11 => failed
    example: g++ '-DV8_TARGET_ARCH_X64' '-D__C99FEATURES__=1' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8 -Wall -Wextra -Wno-unused-parameter -m64 -pthreads -fno-strict-aliasing -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++11 -MMD -MF
    => In file included from ../deps/v8/src/objects-inl.h:18:0, from ../deps/v8/src/v8.h:39, from ../deps/v8/src/accessors.cc:5: ../deps/v8/src/conversions-inl.h: In function 'double v8::internal::DoubleToInteger(double)': ../deps/v8/src/conversions-inl.h:79:7: error: '__builtin_isnan' is not a member of 'std' if (std::isnan(x)) return 0; ^ ../deps/v8/src/conversions-inl.h:79:7: note: suggested alternative: <built-in>:0:0: note: '__builtin_isnan' In file included from /usr/include/math.h:13:0, from /usr/gcc/4.8/include/c++/4.8.2/cmath:44, from ../deps/v8/src/utils.h:11, from ../deps/v8/src/v8.h:34, from ../deps/v8/src/accessors.cc:5: ../deps/v8/src/conversions-inl.h:80:13: error: expected unqualified-id before '__extension__' if (!std::isfinite(x) || x == 0) return x; ^ ../deps/v8/src/conversions-inl.h:80:13: error: expected ')' before '__extension__' In file included from ../deps/v8/src/v8.h:39:0, from ../deps/v8/src/accessors.cc:5: ../deps/v8/src/objects-inl.h: In member function 'bool v8::internal::Object::IsNaN() const': ../deps/v8/src/objects-inl.h:1125:34: error: '__builtin_isnan' is not a member of 'std' return this->IsHeapNumber() && std::isnan(HeapNumber::cast(this)->value()); ^ ../deps/v8/src/objects-inl.h:1125:34: note: suggested alternative: <built-in>:0:0: note: '__builtin_isnan' ../deps/v8/src/objects-inl.h: In member function 'void v8::internal::FixedDoubleArray::set(int, double)': ../deps/v8/src/objects-inl.h:2312:7: error: '__builtin_isnan' is not a member of 'std' if (std::isnan(value)) { ^ ../deps/v8/src/objects-inl.h:2312:7: note: suggested alternative: <built-in>:0:0: note: '__builtin_isnan'
  • with -D_GLIBCXX_USE_C99_MATH => compile correctly
    => g++ '-D_GLIBCXX_USE_C99_MATH' '-DV8_TARGET_ARCH_X64' '-D__C99FEATURES__=1' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8 -Wall -Wextra -Wno-unused-parameter -m64 -pthreads -fno-strict-aliasing -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF .../out/Release/.deps/.../out/Release/obj.target/v8_base/deps/v8/src/accessors.o.d.raw -c -o .../out/Release/obj.target/v8_base/deps/v8/src/accessors.o ../deps/v8/src/accessors.cc

@misterdjules
Copy link

Without access to the same platform I don't have anything against defining _GLIBCXX_USE_C99_MATH, although I'd like to understand a bit more details about the problem.

I would also suggest to upstream the change to V8 instead of making the change in node's common.gypi. @cgalibern @jbergstroem Is that something that you guys can do? If not, I can help you do that, but I'd need access to a Solaris machine to test the changes.

@alexijs
Copy link

alexijs commented Oct 16, 2015

I installed a plain vanilla Solaris 11.2 instance and compiled node v4.2.1 there successfully.

Oracle Corporation SunOS 5.11 11.2 June 2014
root@solaris:# which gcc
no gcc in /usr/bin /usr/sbin

root@solaris:
# pkg install pkg:/developer/gcc-4/[email protected]
root@solaris:~# pkg install pkg:/developer/gcc-4/[email protected]

root@solaris:# which cc
no cc in /usr/bin /usr/sbin
root@solaris:
# ln -s /usr/bin/gcc /usr/bin/cc
root@solaris:~# cc --version
cc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\

root@solaris:# export PATH=$PATH:/usr/gnu/bin
root@solaris:
# curl https://nodejs.org/dist/v4.2.1/node-v4.2.1.tar.gz > node.tgz
root@solaris:# tar xf node.tgz
root@solaris:
# cd node-4.2.1

root@solaris:/opt/node-4.2.1~# ./configure --dest-cpu=x64 --dest-os=solaris --prefix=/opt/node
root@solaris:/opt/node-4.2.1~# vi common.gypi
/**
[ 'OS=="solaris"', {
'defines': ['_GLIBCXX_USE_C99_MATH'],
'cflags': [ '-pthreads' ],
'ldflags': [ '-pthreads' ],
'cflags!': [ '-pthread' ],
'ldflags!': [ '-pthread' ],
}]
**/
root@solaris:/opt/node-4.2.1~# gmake -j 6
output truncated
touch /opt/node-v4.2.1/out/Release/obj.target/node_dtrace_ustack.stamp
gmake[1]: Leaving directory `/opt/node-v4.2.1/out'
ln -fs out/Release/node node


Thanks to @drook and @cgalibern for their previous findings that helped me to accomplish this.

@brendanashworth brendanashworth added the smartos Issues and PRs related to the SmartOS platform. label Oct 16, 2015
@GeorgeBailey
Copy link

@alexijs, I've confirmed this does build and properly runs our node.js-based services on Solaris 11.2.

These are the only issues I had - both were easily resolved.

  • ECONNREFUSED connecting to localhost mysql. (same thing as when I upgraded to v0.12 of Peter Tribble's build for Solaris 10). Looks like mysql server was not listening on IPv6. Resolved by removing the ::1 localhost from /etc/hosts.

    This was not necessary for v0.10 so I guess it was using IPv4 by default back then.

  • Had to install npm - as it was apparently not bundled.

@alexijs
Copy link

alexijs commented Oct 16, 2015

@GeorgeBailey:

  1. ECONNREFUSED MySQL might be easily fixed in app by specifying 127.0.0.1 instead of localhost. That would default it to ipv4. I use numtel:mysql package for node. If you use different connector it may not work...
  2. My bad, I forgot about NPM (Im still setting up the production for node though, and havent set it up completely)... I felt that Im missing something...Thank you!! :)

@JDougherty
Copy link

Thanks for the instructions, I was able to compile Node 4.2.2 from source on Solaris 11.3. Like mentioned above, this doesn't include npm and I'm new to node so I'm not quite sure what I need to do to get that installed given that I now have a functioning node binary. Can anyone help me out? Thanks again!

[Edit]
Additionally, if I can help out by providing access to Solaris machines, please reach out to me.

[2nd edit]
Once the first gmake command is finished, running gmake install creates a bin/ directory which contains both node and npm, so I think I'm all good. Thanks!

@Trott
Copy link
Member

Trott commented Jun 7, 2016

Once the first gmake command is finished, running gmake install creates a bin/ directory which contains both node and npm, so I think I'm all good. Thanks!

This seems resolved to me so I'm going to close it. Feel free to re-open or comment if I'm wrong about closing it.

@Trott Trott closed this as completed Jun 7, 2016
@cgalibern
Copy link
Author

@Trott is it possible to also provide Solaris node versions into https://nodejs.org/en/download/ ?
If yes why not use node-vx.x.x-solaris-x64.tar.gz to avoid conflict with other sunos versions ?
many thanks

@bnoordhuis
Copy link
Member

@cgalibern See #7115 for some discussion on that.

@janorn
Copy link

janorn commented Oct 6, 2016

I am missing this patch in the repo.

--- node-v4.6.0/common.gypi     2016-08-16 17:09:35.000000000 +0200
+++ node-v4.6.0-fix/common.gypi     2016-10-05 15:59:16.252603181 +0200
@@ -273,6 +273,7 @@
             'ldflags': [ '-m64' ],
           }],
           [ 'OS=="solaris"', {
+            'defines': ['_GLIBCXX_USE_C99_MATH'],
             'cflags': [ '-pthreads' ],
             'ldflags': [ '-pthreads' ],
             'cflags!': [ '-pthread' ],

@janorn
Copy link

janorn commented Oct 6, 2016

Without the patch it won't build on Solaris 11 with gcc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. smartos Issues and PRs related to the SmartOS platform.
Projects
None yet
Development

No branches or pull requests

10 participants