Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

node 0.6.7 and CentOS 5.x #2484

Closed
yeysus opened this issue Jan 8, 2012 · 11 comments
Closed

node 0.6.7 and CentOS 5.x #2484

yeysus opened this issue Jan 8, 2012 · 11 comments
Labels

Comments

@yeysus
Copy link

yeysus commented Jan 8, 2012

Hi. By definition, node 0.6.7 cannot be built on CentOS 5.x since node requires python >= 2.5.2, CentOS 5.x comes with Python 2.4.3. There may be (I think there are) other problems. CentOS 6.2 works. Is there a chance of adding an argument to configure like --with-python=/path/to/non-standard/python or other arguments, so it works with CentOS 5.x? Below the error message I receive after starting make, in a virgin CentOS 5.7, node 0.6.7. Thanks.

src/unix/core.c: In function uv__accept:
src/unix/core.c:739: error: SOCK_NONBLOCK undeclared (first use in this function)
src/unix/core.c:739: error: (Each undeclared identifier is reported only once
src/unix/core.c:739: error: for each function it appears in.)
src/unix/core.c:739: error: âSOCK_CLOEXECâ undeclared (first use in this function)
make[1]: *** [src/unix/core.o] Error 1
make[1]: Leaving directory /opt/node-v0.6.7/out/Release/deps/uv' Waf: Leaving directory/opt/node-v0.6.7/out'
Build failed: -> task failed (err #2):
{task: uv uv.h -> uv.a}
make: *** [program] Error 1

@yeysus
Copy link
Author

yeysus commented Jan 8, 2012

I could bring node 0.6.7 to compile and run nodejs.org's home page script with python 2.4.3 and CentOS 5.7. Tomorrow I will try other scripts I have written. Warning: Awful hack below, I am NOT a programmer.

It seems to be that the problem in compiling lies in calls to glibc. According to http://lists.ofono.org/pipermail/ofono/2009-August/000339.html, ..."SOCK_NONBLOCK and SOCK_CLOEXEC are only available on kernel >= 2.6.28 & glibc >= 2.9"...

  • Centos 5.7: Kernel: 2.6.18, glibc: 2.5
  • CentOS 6.2: Kernel: 2.6.32, glibc: 2.12
    And of course python 2.4.3 does not comply with node's requisite. I compared the offending code (see original post) between node.js 0.6.6 and 0.6.7 and there are no differences. For some reason, making node.js 0.6.7 goes now through functions of files that were not called in 0.6.6 (in /opt/node-v0.6.7/deps/uv/src/unix core.c, process.c and linux.c). I am assuming that, since these variables were not needed to compile 0.6.6 on the first place, they are also not needed in 0.6.7. This is a very wild guess, I know. So in 3 or 4 lines either I set SOCK_NONBLOCK, SOCK_CLOEXEC (and O_CLOEXEC in linux.c) to 0x0000 or I bypassed the call via commenting it. node.js 0.6.7 is up & running as far as I can tell. If everything works tomorrow as expected I will try to write a decent "patch & how-to" (if undef define VAR = 0x0000 whatever and log some warning) in case somebody is interested. Question: Can somebody involved in this part of the building code tell me if this makes sense at all? Maybe it is intended in 0.6.7, for whatever the reason, that node does not build against older kernel / glibc versions???

@bnoordhuis
Copy link
Member

Is there a chance of adding an argument to configure like --with-python=/path/to/non-standard/python or other arguments, so it works with CentOS 5.x?

I've committed a patch to that effect in 472a72d. export PYTHON=/path/to/python2 lets you override the python interpreter.

Below the error message I receive after starting make, in a virgin CentOS 5.7, node 0.6.7.

Can you try the patch below?

diff --git a/deps/uv/src/unix/internal.h b/deps/uv/src/unix/internal.h
index 1adb5f2..3ae5d05 100644
--- a/deps/uv/src/unix/internal.h
+++ b/deps/uv/src/unix/internal.h
@@ -59,6 +59,18 @@
 #  define HAVE_SYS_ACCEPT4 1
 # endif

+# ifndef O_CLOEXEC
+#  define O_CLOEXEC 02000000
+# endif
+
+# ifndef SOCK_CLOEXEC
+#  define SOCK_CLOEXEC O_CLOEXEC
+# endif
+
+# ifndef SOCK_NONBLOCK
+#  define SOCK_NONBLOCK O_NONBLOCK
+# endif
+
 # if HAVE_SYS_UTIMESAT
 inline static int sys_utimesat(int dirfd,
                                const char* path,

@yeysus
Copy link
Author

yeysus commented Jan 8, 2012

Hey, thanks for this!. I will be trying your patch in the next hours when I find a moment.

@yeysus
Copy link
Author

yeysus commented Jan 9, 2012

  1. I have not tried your python patch yet. Tomorrow night probably. The python 2.5.x+ requirement from node: Is this because of some deep library dependency somewhere? See below compiling & running with Python 2.4.3.
  2. The patch SOCK_OCLOCK from above works perfect in CentOS 5.7 and the code should not interfere with any other non-broken build. ./configure, make, make install no pro, I only tested afterwards the script on the home page of node.js with curl. Tomorrow night I will upgrade node (0.6.6 to 0.6.7) in another CentOS 5.7 machine where I run different small node scripts which depend on other node libraries (redis, cassandra, mysql, postgresql, mongodb). I will also check tomorrow that CentOS 6.2 is not broken (should not be). I will keep you posted.

@yeysus
Copy link
Author

yeysus commented Jan 9, 2012

Python again. For tomorrow: How do I test it? I don't mean using non-standard python path, or virtualenv. I mean, waf does not seem to be dependent on python 2.5.x (is it?), and I did a quick scan in the documentation from node but I could not find any relevant place where python 2.5.+ is needed. Is there some library or function, that can only be served by Python 2.5.+, so I can script against it? Maybe I am asking the obvious...

@bnoordhuis
Copy link
Member

I mean, waf does not seem to be dependent on python 2.5.x (is it?), and I did a quick scan in the documentation from node but I could not find any relevant place where python 2.5.+ is needed.

We're not actively <2.5 incompatible, it's that we don't guarantee that the build scripts work with older versions of python. There are only so many configurations you can reasonably test and python 2.5 to 2.7 covers about 97% of the market. That figure is made up but you get my point.

@yeysus
Copy link
Author

yeysus commented Jan 10, 2012

  1. Python Patch: Your comment above: Understood. Saleable. Patch: Not only export PYTHON=...; PYTHONHOME must be set to the home of PYTHON. Then it works (I only tested the standard CentOS 5.7 python, 2.4.3, and 2.7.2 as export PYTHON). make uninstall bombs later BTW, but I think it makes sense to leave make uninstall with the standard python of the OS. Just for fun, I tried Jython: it did not work.
  2. SOCK_OCLOCK Patch: Works in a virgin CentOS 5.7 and in a CentOS 5.7 that has seen many node versions and where it does not "make" it without the patch (retested in between installs). FYI only, npm modules that I also tested: cassandra, db-mysql, mongodb, hiredis, redis, pg. All OK. And of course CentOS 6.2 work out of the box.

Detail: You can imagine I installed and reinstalled and cleaned things up many times. npm (which now comes with node): 3 directories remain after node uninstall. Is this intentional? Shouldn't "make uninstall" "know" if npm was installed by itself and if, remove npm and its manually installed modules?

I am going to close this issue. Thank you very much bnoordhuis; I own you a beer. I hope both patches make it into node 0.6.8. If you need me to test something / whatever, let me know.

@yeysus yeysus closed this as completed Jan 10, 2012
@bnoordhuis
Copy link
Member

npm (which now comes with node): 3 directories remain after node uninstall. Is this intentional? Shouldn't "make uninstall" "know" if npm was installed by itself and if, remove npm and its manually installed modules?

@isaacs: Is that a bug or a safeguard?

I hope both patches make it into node 0.6.8.

Yep, they will.

@yeysus
Copy link
Author

yeysus commented Jan 12, 2012

Great, Thanks.

@SteffanCline
Copy link

I was able to finally get it to install by using the CentOS repo here:
http://nodejs.tchol.org/
I also used remi's repos to get cutting edge on some of the other things. After this, I got it to install fine on 5.5/7

@yeysus
Copy link
Author

yeysus commented Jan 20, 2012

@bnoordhuis: I can say that node.js 0.6.8 can be built from source and runs without any obvious problems with different modules under CentOS 5.7. Python 2.4.3 was used. Thanks for pushing the patch(es).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants