-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
[v8.x] node_crypto: Use <cmath> definitions of isnan and isinf #19196
Conversation
Unless you specify C++11, std::isnan and std::isinf are not guaranteed to be available. Instead, just use the math.h functions for now.
I’m not sure I understand … building Node.js does require C++11 or above, so that’s something we shouldn’t have to worry about, right? |
With GCC 5.5.0 I see
I checked whether nodejs requires C++11 in its configuration, and I must say I have a hard time finding where in the build system this is enforced for GCC. That's why I chose the other solution to begin with. |
On master Line 296 in cb5f9a6
but this change (#17489) was deemed semver-major and not backported, so e.g. v9.x still uses Line 296 in 4e9ac10
|
I'll leave it up to you whether to choose the compiler flag change or this one. |
The lines in question for |
So, I assume that means this PR could be re-targeted against v9.x and we could land it on v8.x + v6.x, and be done with it? That would sound perfectly fine to me. |
I would certainly favour not changing the compiler flag for LTS. |
Ah, sorry, I checked and this doesn't actually appear in the v9.x source code. So this is fine & should totally land on v8.x! @jer-gentoo If you want, could you update the commit message to start with |
I backported this to v8 in this PR: #18327 |
Given that the fix has already been backported to v8.x-staging, I think this can be closed. Thanks anyway @jer-gentoo ! |
My understanding of the history was that #18327 caused the issue in the first place since we don't require C++11 on 8.0. |
@gibfahn : You misinterpreted @yhwang's comment, which didn't intend to mean the issue was already fixed. As @richardlau explained quite well, #18327 unintentionally caused the issue. This PR fixes the issue. Please reopen. |
@jer-gentoo one question: since my PR is landed to v8.x-staging already. In your PR, you also have the same change. I guess the change here in your PR won't go to v8.x-staging. What you plan to do next? [Edit] Sorry that I just realize that your change revert #18327. However, the root cause is actually the using of |
more information about the Check this code in deps/v8:
Currently, for |
A lot of this is greek to me since most of my C/C++ is older Windows based... however we have been encountering this with node@8.10.0 using the current build instructions here : $ g++ --version
g++ (Linaro GCC 5.4-2017.05) 5.4.1 20170404 (ROSA) and $ g++ --version
g++ (Debian 4.9.2-10+deb8u1) 4.9.2 In summary, which is sort of what I'm looking for... Will the next node update release resolve this? (seems that way from what I'm reading but since I didn't even know that there were different C++ versions in GNU I'm still the noob here :) Thanks for your patience. P.S. node@8.9.4 compiles okay... but not node@8.10.0 |
It's still unclear. Initially it seemed that this patch would fix it, but AIUI @yhwang is saying that V8 itself has this issue, so we won't be able to fix it (the answer would be to use a different version of gcc). However @yhwang said that gcc 5.4 was okay, but you're having an issue with 5.4.1 and 4.9.2? Could you post the build failure output? |
Yes. 5.4.1 is my dev station here. 4.9.2 is our production environment. I'll rerun it on production but that will take a few hours as our VPS isn't nearly as quick as my dev station especially since we're online. :)
It's exactly the same as @jer-gentoo comment above at #19196 (comment) with trailing lines of this: make[1]: *** [node.target.mk:202: ~/repo/git/node.js/nodejs/node2/out/Release/obj.target/node/src/node_crypto.o] Error 1
rm 29706770d08d6f8d67360fd4f1377c53f58eb206.intermediate
make: *** [Makefile:88: node] Error 2 ... this is how I found this issue was searching on |
I honestly no longer see how this went so wrong. This PR fixes an actual issue in the LTS branch when using toolchains that do not implement C++11. An important security release is due this week, so it's probably a good thing to get this in now so as to not proliferate the build problem. Some people appear to get very confused over later comments to this PR, causing uncertainty to others which then led more people to believe the issue had already been fixed elsewhere, which may or may not be the case for the master branch but certainly is not for this PR, as it targets the v8.x branch. I was requested early on to (somehow, you know, git-fu) change the commit's metadata and while I haven't respectfully declined to do so, I want to do so now just the clear the air in that regard. |
You hit that right on for me... this is why I am here... and I appreciate your clear comments. I've sent a message/ticket out to our VPS to see if the system can be updated from "Jesse" to "Stretch" but it may (if it's possible) cause more issues than retrying nvm and hoping for the best (we had nvm installed last month but I still prefer to compile in case there is a cross-distro issue). My distro can be twiddled with but our production has to be handled with extreme care since we're live. Adding "Jessie"'s unstable repo doesn't seem like a good thing to see if g++ is newer. |
Not anymore with 4.9.2 although I do get this message in WARNING: C++ compiler too old, need g++ 4.9.4 or clang++ 3.4.2 (CXX=g++) ... but it does compile and is running so far. Still going to look into migration to Debian 9 ("Stretch") if possible even though it appears to be relatively "new" in the chronological timeline. Being more inexperienced with the *nix side of C++ it's going to be a major set back until I can figure out what repercussions straying from my distro's g++ is going to be... e.g. dependency h*ll is my first thought, many possible broken packages is another, and snap-shotting dev station during the process... perhaps I'll just do a VM of another distro *shrugs*. This path forward seems rather hacky though and it will slow things down between dev testing and production... it would be nice to have this resolved in node here with this PR. |
@jer-gentoo can you give me a way to reproduce this (preferably via vagrant). I've tried: vagrant init ubuntu/xenial64
# I had to increase the RAM and CPUs of the machine by adding this to the Vagrantfile:
# config.vm.provider "virtualbox" do |vb|
# vb.memory = "4096"
# vb.cpus = "2"
# end
vagrant up
vagrant ssh
# Inside the vagrant VM:
sudo apt-get update
sudo apt-get install -y gcc-5 g++-5 build-essential python
git clone https://github.com/nodejs/node --branch v8.x
cd node
./configure && make -j4 This is using gcc-5.4, and it passes: vagrant@ubuntu-xenial:/vagrant/node$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)
vagrant@ubuntu-xenial:/vagrant/node$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) Given that @yhwang is saying that this patch doesn't actually fix the compile issues with gcc-5.5, I'd like to be able to reproduce the issue on v8.x and confirm that this patch fixes things. |
modify patch. nodejs/node#19196 made not to use libressl headers fix to include path not to use "host/include" Signed-off-by: Hirokazu MORIKAWA <[email protected]>
modify patch. nodejs/node#19196 made not to use libressl headers fix to include path not to use "host/include" Signed-off-by: Hirokazu MORIKAWA <[email protected]>
Looks like this is all red. Can someone who knows about the PR take a look |
New CI to see what the failures actually are: https://ci.nodejs.org/job/node-test-pull-request/15468/ |
Is it failing at line 1023 of https://ci.nodejs.org/job/node-test-commit-aix/nodes=aix61-ppc64/15786/ ?? e.g. it's really difficult to tell where since I'm not used to this prettified HTML output but it looks like it's trying to test that before 1024. As far as Linux goes here in the CI linkage of https://ci.nodejs.org/job/node-test-commit-linux/nodes=debian8-64/18953/ this returns a 404 for me. e.g. my guess is it's mis-linked, or somehow other broken. Plus some jobs aren't completed yet over there so console output is a bit vague. |
Here we go... seems that it timedout See https://ci.nodejs.org/job/node-test-commit-aix/nodes=aix61-ppc64/15786/testReport/junit/%28root%29/test/parallel_test_benchmark_path/ . Probably just needs to be rerun. |
Back-porting 7124b46 to v8.x would fix this because it simply gets rid of the isnan and isinf calls. |
@bnoordhuis that commit is semver major is it not? |
ping @bnoordhuis |
trying to kick off another CI to verify the change: https://ci.nodejs.org/job/node-test-commit/20154/ |
seems CI failed on two test cases:
for the first one, we have an issue to track it now: #21188 overall, I think the CI is good for this PR. Because this just changes one line of code to include the |
If it makes any difference node@10.x isn't immune from the I've also been distro upgraded on dev station, since this issue began, to: $ g++ --version
g++ (Linaro GCC 5.5-2017.10) 5.5.0 20171010 (ROSA) |
Unless you specify C++11, std::isnan and std::isinf are not guaranteed to be available. Instead, just use the math.h functions for now. PR-URL: #19196 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Yihong Wang <[email protected]> Reviewed-By: James M Snell <[email protected]>
landed in d8cf13a |
Unless you specify C++11, std::isnan and std::isinf are not guaranteed to be available. Instead, just use the math.h functions for now. PR-URL: #19196 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Yihong Wang <[email protected]> Reviewed-By: James M Snell <[email protected]>
Unless you specify C++11, std::isnan and std::isinf are not guaranteed to be available. Instead, just use the math.h functions for now. PR-URL: #19196 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Yihong Wang <[email protected]> Reviewed-By: James M Snell <[email protected]>
Unless you specify C++11, std::isnan and std::isinf are not guaranteed to be available. Instead, just use the math.h functions for now. PR-URL: #19196 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Yihong Wang <[email protected]> Reviewed-By: James M Snell <[email protected]>
Unless you specify C++11, std::isnan and std::isinf are not guaranteed to be available. Instead, just use the math.h functions for now. PR-URL: #19196 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Yihong Wang <[email protected]> Reviewed-By: James M Snell <[email protected]>
modify patch. nodejs/node#19196 made not to use libressl headers fix to include path not to use "host/include" Signed-off-by: Hirokazu MORIKAWA <[email protected]> (cherry picked from commit 818770d)
modify patch. nodejs/node#19196 made not to use libressl headers fix to include path not to use "host/include" Signed-off-by: Hirokazu MORIKAWA <[email protected]>
Unless you specify C++11,
std::isnan
andstd::isinf
are not guaranteed to be available. Instead, explicitly use thecmath
functions.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes