hyperboria / bugs

Peer-to-peer IPv6 networking, secure and near-zero-conf.
153 stars 17 forks source link

Can't build libuv on gcc 7 because it's not 7.something #162

Open interfect opened 7 years ago

interfect commented 7 years ago

My build throws the following error building libuv:

Compiling Test jsbuild/tests/secretbox8_xsalsa20poly1305
Compiling Test jsbuild/tests/stream
Compiling Test jsbuild/tests/stream3
Compiling Test jsbuild/tests/stream2
Compiling Test jsbuild/tests/stream4
Waiting for [3] processes
Waiting for [2] processes
Waiting for [1] processes
done
testing python python
sys.version_info(major=2, minor=7, micro=13, releaselevel='final', serial=0)

Build Libuv
Traceback (most recent call last):
  File "./gyp_uv.py", line 81, in <module>
    (major, minor), is_clang = compiler_version()
ValueError: need more than 1 value to unpack
make: *** out: No such file or directory.  Stop.

It then continues on and dies because libuv didn't build.

It's because Ubuntu 17.10 (which I am cool enough to be running in August) ships GCC 7, which has a version (from gcc -dumpversion) of just 7 (and not 7.0). gyp_uv.py assums that the gcc -dumpversion output will always contain a .:

def compiler_version():
  proc = subprocess.Popen(CC.split() + ['--version'], stdout=subprocess.PIPE)
  is_clang = 'clang' in proc.communicate()[0].split('\n')[0]
  proc = subprocess.Popen(CC.split() + ['-dumpversion'], stdout=subprocess.PIPE)
  version = proc.communicate()[0].split('.')
  version = map(int, version[:2])
  version = tuple(version)
  return (version, is_clang)

version gets unpacked into a 2-element tuple later, but GCC 7 makes version only have one item.

zotdv commented 6 years ago

dumpversion in GCC 7.2.0 also returns 7 instead of 7.2

me@VirtualBox:~/cjdns$ gcc --version
gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0
Copyright (C) 2017 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.

me@VirtualBox:~/cjdns$ gcc -dumpversion
7

So shoud you get major & minor version from --version but not -dumpversion ?