Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

./configure report 'Unknown compiler' error #3601

Closed
fgalan opened this Issue · 6 comments

3 participants

@fgalan

Hi,

Working on v0.8 branch, running ./configure I get the following message:

Exception: Unknown compiler. Please open an issue at https://github.com/joyent/node/issues and include the output of `cc --version`

So I'm opening this issue. This is the output of cc --version

[root@centollo node]# cc --version
cc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
Copyright (C) 2010 Free Software Foundation, Inc.
Esto es software libre; vea el código para las condiciones de copia.  NO hay
garantía; ni siquiera para MERCANTIBILIDAD o IDONEIDAD PARA UN PROPÓSITO EN
PARTICULAR

Note that it's different from the output of gcc -v, that I'm pasting below just in case it is needed:

[root@centollo node]# gcc -v
Usando especificaciones internas.
Objetivo: x86_64-redhat-linux
Configurado con: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Modelo de hilos: posix
gcc versión 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) 

Thanks!

Best regards,


Fermín

@bnoordhuis

Why can't anything be easy, eh? Can you try this patch?

diff --git a/configure b/configure
index 7bf4536..810d423 100755
--- a/configure
+++ b/configure
@@ -265,19 +265,11 @@ def target_arch():

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

-  if 'clang' in version_line:
-    version, is_clang = version_line.split()[2], True
-  elif 'gcc' in version_line:
-    version, is_clang = version_line.split()[-1], False
-  else:
-    raise Exception(
-      'Unknown compiler. Please open an issue at ' +
-      'https://github.com/joyent/node/issues and ' +
-      'include the output of `%s --version`' % CC)
+  proc = subprocess.Popen(CC.split() + ['-dumpversion'], stdout=subprocess.PIPE)
+  version = tuple(map(int, proc.communicate()[0].split('.')))

-  version = tuple(map(int, version.split('.')))
   return (version, is_clang)

@fgalan

Hi,

With the patch, ./configure doesn't show the error message, but it seems that generates a wrong a config.gypi, as the strict_aliasing is false when it should be true (see #3538).

Trace included below (the git diff is just a sanity check to show that the patch has been applyed):

[root@centollo node]# git diff
diff --git a/configure b/configure
index 7bf4536..810d423 100755
--- a/configure
+++ b/configure
@@ -265,19 +265,11 @@ def target_arch():

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

-  if 'clang' in version_line:
-    version, is_clang = version_line.split()[2], True
-  elif 'gcc' in version_line:
-    version, is_clang = version_line.split()[-1], False
-  else:
-    raise Exception(
-      'Unknown compiler. Please open an issue at ' +
-      'https://github.com/joyent/node/issues and ' +
-      'include the output of `%s --version`' % CC)
+  proc = subprocess.Popen(CC.split() + ['-dumpversion'], stdout=subprocess.PIPE)
+  version = tuple(map(int, proc.communicate()[0].split('.')))

-  version = tuple(map(int, version.split('.')))
   return (version, is_clang)

[root@centollo node]# ./configure 
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'host_arch': 'x64',
                 'node_install_npm': 'true',
                 'node_install_waf': 'true',
                 'node_prefix': '',
                 'node_shared_openssl': 'false',
                 'node_shared_v8': 'false',
                 'node_shared_zlib': 'false',
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_openssl': 'true',
                 'strict_aliasing': 'false',
                 'target_arch': 'x64',
                 'v8_no_strict_aliasing': 'false',
                 'v8_use_snapshot': 'true'}}
creating  ./config.gypi
creating  ./config.mk

Thanks!

Best regards,


Fermín

@bnoordhuis

Thanks. Can you try this (additional) patch? I'm afraid that anything before 4.6.0 is a lost cause...

diff --git a/configure b/configure
index 7bf4536..05a26d8 100755
--- a/configure
+++ b/configure
@@ -295,12 +295,9 @@ def configure_node(o):
   # turn off strict aliasing if gcc < 4.6.0 unless it's llvm-gcc
   # see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45883
   # see http://code.google.com/p/v8/issues/detail?id=884
-  o['variables']['strict_aliasing'] = b(is_clang or cc_version >= (4,6,0))
-
-  # disable strict aliasing in V8 if we're compiling with gcc 4.5.x,
-  # it makes V8 crash in various ways
-  o['variables']['v8_no_strict_aliasing'] = b(
-    not is_clang and (4,5,0) <= cc_version < (4,6,0))
+  strict_aliasing = is_clang or cc_version >= (4,6,0)
+  o['variables']['strict_aliasing'] = b(strict_aliasing)
+  o['variables']['v8_no_strict_aliasing'] = b(not strict_aliasing)

   # clang has always supported -fvisibility=hidden, right?
   if not is_clang and cc_version < (4,0,0):
@rvagg

Both patches applied fix this problem for me--on Ubuntu 12.04 with cc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 with current source from v0.8 branch.

@bnoordhuis bnoordhuis closed this issue from a commit
@bnoordhuis bnoordhuis build: detect cc version with -dumpversion
The heuristic introduced in f78ce08 ("build: handle output of localized gcc or
clang") does not handle "branded" versions of gcc, i.e. a gcc whose output has
been customized by the distro vendor.

Fixes #3601.
a0add91
@bnoordhuis bnoordhuis closed this in a0add91
@bnoordhuis

Thanks for testing, @rvagg. Landed in a0add91 and b731c96.

@TooTallNate TooTallNate referenced this issue from a commit in TooTallNate/node
@bnoordhuis bnoordhuis build: disable -fstrict-aliasing for any gcc < 4.6.0
It has been conclusively demonstrated that the -fstrict-aliasing bugs in gcc's
optimizer are not limited to the 4.5.x releases only.

Fixes #3601 among others.
b731c96
@fgalan

@bnoordhuis I hadn't chance to test the last patch you post, sorry (I started my vacations just after my last post) but I've checked that the problem has been solved in 0.8.3, so everithing is ok :). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.