Skip to content

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

Description

@kasicka

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

Activity

  1. added
    buildIssues and PRs related to Node.js builds or CI infrastructure.
    on May 12, 2016
  2. bnoordhuis commented on May 12, 2016

    @bnoordhuis
    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
    
  3. kasicka commented on May 16, 2016

    @kasicka
    Author

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

  4. bnoordhuis commented on May 19, 2016

    @bnoordhuis
    Member

    Filed #6874, thanks for following up.

  5. added a commit that references this issue on Jun 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssues and PRs related to Node.js builds or CI infrastructure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions