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

Unable to build node against system libraries with python 2.6 #6711

Closed
kasicka opened this issue May 12, 2016 · 3 comments
Closed

Unable to build node against system libraries with python 2.6 #6711

kasicka opened this issue May 12, 2016 · 3 comments
Labels
build Issues and PRs related to build files or the CI.

Comments

@kasicka
Copy link

kasicka commented May 12, 2016

Version: 4.4.2
OS: CentOS6 / RHEL6

When I try to run
./configure --shared-openssl --shared-http-parser --shared-libuv --shared-zlib
it fails with
Traceback (most recent call last):
File "./configure", line 1112, in
configure_library('zlib', output)
File "./configure", line 758, in configure_library
(pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib)
File "./configure", line 399, in pkg_config
val = subprocess.check_output([pkg_config, args, flag, pkg])
AttributeError: 'module' object has no attribute 'check_output'

I understand you're probably not going to fix this, but maybe there should be a note in docs that it is not possible to use these options with python 2.6

@bnoordhuis bnoordhuis added the build Issues and PRs related to build files or the CI. label May 12, 2016
@bnoordhuis
Copy link
Member

It looks pretty straightforward to fix. Can you try this patch?

diff --git a/configure b/configure
index 983ae07..92ca239 100755
--- a/configure
+++ b/configure
@@ -1,4 +1,6 @@
 #!/usr/bin/env python
+
+import errno
 import optparse
 import os
 import pprint
@@ -435,19 +437,16 @@ def b(value):

 def pkg_config(pkg):
   pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
-  args = '--silence-errors'
+  args = ['--silence-errors']
   retval = ()
   for flag in ['--libs-only-l', '--cflags-only-I', '--libs-only-L']:
     try:
-      val = subprocess.check_output([pkg_config, args, flag, pkg])
-      # check_output returns bytes
-      val = val.encode().strip().rstrip('\n')
-    except subprocess.CalledProcessError:
-      # most likely missing a .pc-file
-      val = None
-    except OSError:
-      # no pkg-config/pkgconf installed
-      return (None, None, None)
+      proc = subprocess.Popen(shlex.split(pkg_config) + args + [flag, pkg],
+                              stdout=subprocess.PIPE)
+      val = proc.communicate()[0].strip().rstrip('\n')
+    except OSError, e:
+      if e.errno != errno.ENOENT: raise e  # Unexpected error.
+      return (None, None, None)  # No pkg-config/pkgconf installed.
     retval += (val,)
   return retval

thefourtheye added a commit to thefourtheye/io.js that referenced this issue May 12, 2016
Python 2.6 does not have `subprocess.check_output`, as it was
introduced only in Python 2.7. This patch uses `subprocess.Popen` to
get the data written to stdout by the `pkg-config` program.

Fixes: nodejs#6711
@kasicka
Copy link
Author

kasicka commented May 16, 2016

Yep, works fine, thank you and sorry for late response.

@bnoordhuis
Copy link
Member

Filed #6874, thanks for following up.

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue May 20, 2016
Commit 2b1c01c ("build: refactor pkg-config for shared libraries")
from May 2015 introduced python 2.7-specific code.

It mainly affects people building on old RHEL platforms where the system
python is 2.6.  Seemingly a dying breed because the issue went unnoticed
(or at least unreported) for a whole year.

Fixes: nodejs#6711
PR-URL: nodejs#6874
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Fishrock123 pushed a commit that referenced this issue May 23, 2016
Commit 2b1c01c ("build: refactor pkg-config for shared libraries")
from May 2015 introduced python 2.7-specific code.

It mainly affects people building on old RHEL platforms where the system
python is 2.6.  Seemingly a dying breed because the issue went unnoticed
(or at least unreported) for a whole year.

Fixes: #6711
PR-URL: #6874
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
rvagg pushed a commit that referenced this issue Jun 2, 2016
Commit 2b1c01c ("build: refactor pkg-config for shared libraries")
from May 2015 introduced python 2.7-specific code.

It mainly affects people building on old RHEL platforms where the system
python is 2.6.  Seemingly a dying breed because the issue went unnoticed
(or at least unreported) for a whole year.

Fixes: #6711
PR-URL: #6874
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 11, 2016
Commit 2b1c01c ("build: refactor pkg-config for shared libraries")
from May 2015 introduced python 2.7-specific code.

It mainly affects people building on old RHEL platforms where the system
python is 2.6.  Seemingly a dying breed because the issue went unnoticed
(or at least unreported) for a whole year.

Fixes: #6711
PR-URL: #6874
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 11, 2016
Commit 2b1c01c ("build: refactor pkg-config for shared libraries")
from May 2015 introduced python 2.7-specific code.

It mainly affects people building on old RHEL platforms where the system
python is 2.6.  Seemingly a dying breed because the issue went unnoticed
(or at least unreported) for a whole year.

Fixes: #6711
PR-URL: #6874
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
Commit 2b1c01c ("build: refactor pkg-config for shared libraries")
from May 2015 introduced python 2.7-specific code.

It mainly affects people building on old RHEL platforms where the system
python is 2.6.  Seemingly a dying breed because the issue went unnoticed
(or at least unreported) for a whole year.

Fixes: #6711
PR-URL: #6874
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
Commit 2b1c01c ("build: refactor pkg-config for shared libraries")
from May 2015 introduced python 2.7-specific code.

It mainly affects people building on old RHEL platforms where the system
python is 2.6.  Seemingly a dying breed because the issue went unnoticed
(or at least unreported) for a whole year.

Fixes: #6711
PR-URL: #6874
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 14, 2016
Commit 2b1c01c ("build: refactor pkg-config for shared libraries")
from May 2015 introduced python 2.7-specific code.

It mainly affects people building on old RHEL platforms where the system
python is 2.6.  Seemingly a dying breed because the issue went unnoticed
(or at least unreported) for a whole year.

Fixes: #6711
PR-URL: #6874
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 14, 2016
Commit 2b1c01c ("build: refactor pkg-config for shared libraries")
from May 2015 introduced python 2.7-specific code.

It mainly affects people building on old RHEL platforms where the system
python is 2.6.  Seemingly a dying breed because the issue went unnoticed
(or at least unreported) for a whole year.

Fixes: #6711
PR-URL: #6874
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
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.
Projects
None yet
Development

No branches or pull requests

2 participants