Opened 10 years ago

Closed 10 years ago

#44367 closed defect (fixed)

arb @6.0: failed to detect COMPILER_NAME (got 'unknown', expected 'clang' or 'gcc'). Stop.

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: mattcottrell
Priority: Normal Milestone:
Component: ports Version: 2.3.1
Keywords: haspatch maintainer Cc:
Port: arb

Description

arb 6.0 failed to build on the Snow Leopard (10.6) buildslave (using Xcode's gcc 4.2):

--->  Building arb
DEBUG: Executing org.macports.build (arb)
DEBUG: Environment: 
ARBHOME='/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378'
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/.CC_PRINT_OPTIONS'
CPATH='/opt/local/include'
LIBRARY_PATH='/opt/local/lib'
MACOSX_DEPLOYMENT_TARGET='10.6'
PATH='/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378/bin:/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin'
PREFIX='/opt/local'
DEBUG: Assembled command: 'cd "/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378" && /usr/bin/make -j8 -w all CXX=/usr/bin/g++-4.2 CC=/usr/bin/gcc-4.2'
DEBUG: Executing command line:  cd "/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378" && /usr/bin/make -j8 -w all CXX=/usr/bin/g++-4.2 CC=/usr/bin/gcc-4.2 
Problems detecting compiler type:
dumpedVersion='4.2.1
'
detailedVersion='i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 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.

'
make: Entering directory `/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378'
Makefile:116: *** failed to detect COMPILER_NAME (got 'unknown', expected 'clang' or 'gcc').  Stop.
make: Leaving directory `/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378'
Command failed:  cd "/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378" && /usr/bin/make -j8 -w all CXX=/usr/bin/g++-4.2 CC=/usr/bin/gcc-4.2 
Exit code: 2
Error: org.macports.build for port arb returned: command execution failed
DEBUG: Error code: CHILDSTATUS 83776 2
DEBUG: Backtrace: command execution failed
    while executing
"system -nice 0 $fullcmdstring"
    ("eval" body line 1)
    invoked from within
"eval system $notty $nice \$fullcmdstring"
    invoked from within
"command_exec build"
    (procedure "portbuild::build_main" line 8)
    invoked from within
"portbuild::build_main org.macports.build"
    ("eval" body line 1)
    invoked from within
"eval $procedure $targetname"
Warning: targets not executed for arb: org.macports.activate org.macports.build org.macports.destroot org.macports.install
Please see the log file for port arb for details:
    /opt/local/var/macports/logs/_opt_mports_dports_science_arb/arb/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port arb failed

And on the Mountain Lion (10.8) buildbot (using Xcode's clang):

--->  Building arb
DEBUG: Executing org.macports.build (arb)
DEBUG: Environment: 
ARBHOME='/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378'
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/.CC_PRINT_OPTIONS'
CPATH='/opt/local/include'
LIBRARY_PATH='/opt/local/lib'
MACOSX_DEPLOYMENT_TARGET='10.8'
PATH='/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378/bin:/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin'
PREFIX='/opt/local'
DEBUG: Assembled command: 'cd "/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378" && /usr/bin/make -j8 -w all CXX=/usr/bin/clang++ CC=/usr/bin/clang'
DEBUG: Executing command line:  cd "/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378" && /usr/bin/make -j8 -w all CXX=/usr/bin/clang++ CC=/usr/bin/clang 
Problems detecting compiler type:
dumpedVersion='4.2.1
'
detailedVersion='Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
'
make: Entering directory `/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378'
Makefile:116: *** failed to detect COMPILER_NAME (got 'unknown', expected 'clang' or 'gcc').  Stop.
make: Leaving directory `/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378'
Command failed:  cd "/opt/local/var/macports/build/_opt_mports_dports_science_arb/arb/work/arbsrc_12378" && /usr/bin/make -j8 -w all CXX=/usr/bin/clang++ CC=/usr/bin/clang 
Exit code: 2
Error: org.macports.build for port arb returned: command execution failed
DEBUG: Error code: CHILDSTATUS 27300 2
DEBUG: Backtrace: command execution failed
    while executing
"system -nice 0 $fullcmdstring"
    ("eval" body line 1)
    invoked from within
"eval system $notty $nice \$fullcmdstring"
    invoked from within
"command_exec build"
    (procedure "portbuild::build_main" line 8)
    invoked from within
"portbuild::build_main org.macports.build"
    ("eval" body line 1)
    invoked from within
"eval $procedure $targetname"
Warning: targets not executed for arb: org.macports.activate org.macports.build org.macports.destroot org.macports.install
Please see the log file for port arb for details:
    /opt/local/var/macports/logs/_opt_mports_dports_science_arb/arb/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port arb failed

It succeeded on the Mavericks (10.9) buildslave (using Xcode clang).

Attachments (4)

arb-PATCH-arb_compiler_version.pl.diff (827 bytes) - added by mattcottrell 10 years ago.
Patch to resolve brittleness of arb_compiler_version.pl
patch-ARB-arb_compiler_version.pl.diff (11.5 KB) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.
Portfile-arb-compiler-version-check.diff (582 bytes) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.
patch-Makefile.diff (1.0 KB) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 10 years ago by mattcottrell

Strange, arb 6 builds for me on Mountain Lion (10.8.4).

comment:2 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

What version of Xcode and clang do you have on your Mountain Lion machine? The buildbot is using "Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)" which according to XcodeVersionInfo is from Xcode 4.5.1 or 4.5.2.

comment:3 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

The problem seems to be this line of SOURCE_TOOLS/arb_compiler_version.pl:

      if ($detailedVersion =~ /apple.*llvm.*clang/oi) { $detectedCompiler = 'clang'; }

It assumes clang --version will contain output matching /apple.*llvm.*clang/oi but it was only in Xcode 4.6 that Apple changed the output from "Apple clang" to "Apple LLVM" so the above line will fail on earlier versions of clang from Xcode versions 3.2.3 through 4.5.x inclusive.

This entire method of attempting to detect clang is really bad, though. A better way would be to just check the return value of:

$CC -dM -E -x c /dev/null | grep -q __clang__

0 means it's clang, 1 means it isn't.

comment:4 in reply to:  2 Changed 10 years ago by mattcottrell

Replying to ryandesign@…:

What version of Xcode and clang do you have on your Mountain Lion machine? The buildbot is using "Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)" which according to XcodeVersionInfo is from Xcode 4.5.1 or 4.5.2.

Looks like I am using Xcode 5.0 on my Mountain Lion Machine

cottrell% xcodebuild -version
Xcode 5.0
Build version 5A1413

comment:5 in reply to:  3 Changed 10 years ago by mattcottrell

Replying to ryandesign@…:

The problem seems to be this line of SOURCE_TOOLS/arb_compiler_version.pl:

      if ($detailedVersion =~ /apple.*llvm.*clang/oi) { $detectedCompiler = 'clang'; }

It assumes clang --version will contain output matching /apple.*llvm.*clang/oi but it was only in Xcode 4.6 that Apple changed the output from "Apple clang" to "Apple LLVM" so the above line will fail on earlier versions of clang from Xcode versions 3.2.3 through 4.5.x inclusive.

This entire method of attempting to detect clang is really bad, though. A better way would be to just check the return value of:

$CC -dM -E -x c /dev/null | grep -q __clang__

0 means it's clang, 1 means it isn't.

Thanks, I'll bring this up with the upstream developers of arb.

Changed 10 years ago by mattcottrell

Patch to resolve brittleness of arb_compiler_version.pl

comment:6 Changed 10 years ago by mattcottrell

I do not have a machine with the OS X version and Xcode that was causing this build failure on the buildslave. Could someone else test the patch (arb-PATCH-arb_compiler_version.pl.diff​) that I uploaded? It uses the approach suggested by Ryan.

$CC -dM -E -x c /dev/null | grep -q __clang__

Thanks

comment:7 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch maintainer added
Resolution: fixed
Status: newclosed

Committed in r123099.

comment:8 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: closedreopened

The attachment, which got committed above, only added the above detection to the existing script, thus fixing some older versions of clang, but it did not remove the other now-unnecessary checks from the script, nor fix the detection of the version of gcc present on Snow Leopard. The attached revised patch, based on my testing, correctly detects all versions of gcc and clang and should be used instead.

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

comment:9 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

This patch causes clang versions to be detected correctly, instead of always being detected as the GCC compatibility version "4.2.1" as before. This therefore causes the build to now fail with clang, as in:

Compiler version check:
  - Your compiler is 'clang' version '3.4.2'
    This version is not in the list of supported clang-versions:
    * 4.2.1
  - You may either ..
    - add your version to ALLOWED_clang_VERSIONS in the Makefile and try it out or
    - switch to one of the allowed versions (see arb_README_gcc.txt for installing
      a different version of gcc)

Trying to whitelist each working compiler version seems like a never-ending exercise in futility. How about just assuming that all versions of clang will work, until you find one that actually doesn't work. Also, it's silly to advise the user how to install "a different version of gcc" when the user's compiler is clang not gcc.

comment:10 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Correcting the compiler version detection has exposed further bugs in how the Makefile handles compiler versions. For example, if the first digit of the compiler version is not "4", it assumes the compiler must have the capabilities of gcc 4.8 or greater. This is obviously wrong; one only needs to consider what would happen when using gcc 3.3 for example. And now that clang versions are being detected correctly, they now hit this problem as well, since clang versions are currently at 3.x.

The attached Makefile patch should fix this, and with the patch from #44545, arb now builds for me on Snow Leopard. May I commit these changes?

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: patch-Makefile.diff added

comment:11 Changed 10 years ago by mattcottrell

Yes, Ryan. Please commit these changes. Thanks for untangling this mess for me.

comment:12 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.