Opened 7 years ago

Closed 7 years ago

#54985 closed defect (fixed)

clang-3.9 @3.9.1_6 wrappers broken at least with Snow Leopard/Xcode 3.2.6

Reported by: rlhamil Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version: 2.4.1
Keywords: Cc: larryv (Lawrence Velázquez), MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), ballapete (Peter "Pete" Dyballa), gnw3, jeremyhu (Jeremy Huddleston Sequoia)
Port: clang-3.9

Description (last modified by ryandesign (Ryan Carsten Schmidt))

The wrappers with the clang-3.9 port that look like

#!/bin/bash

if [ -x /usr/bin/xcrun ] ; then
   exec /usr/bin/xcrun /opt/local/libexec/llvm-3.9/bin/clang "${@}"
else
   exec /opt/local/libexec/llvm-3.9/bin/clang "${@}"
fi

(all the /opt/local/bin/*-3.9 wrappers are of that form)

have a problem on Snow Leopard, at least with Xcode 3.2.6:

myeye:tmp root# clang-mp-3.9 hello.c -o hello
xcodebuild: error: invalid tool name - '/opt/local/libexec/llvm-3.9/bin/clang' contains '/' characters
/Developer-3.2.6/usr/bin/xcodebuild fails with 256 - Unknown error: 256

myeye:tmp root# xcode-select -print-path
/Developer-3.2.6

Clearly, at least that version of xcrun doesn't cope with a full pathname of the executable to be found; and it presumably wouldn't find something in /opt/local/libexec anyway; so why use it?

This further breaks anything that uses clang-3.9 to build it.

Change History (23)

comment:1 Changed 7 years ago by rlhamil

Cc: rlhamil added

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

Cc: larryv MarcusCalhoun-Lopez added; rlhamil removed
Description: modified (diff)
Owner: set to jeremyhu
Status: newassigned

comment:3 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Ugg. OIder xcrun don't like that it seems... Perhaps we should just install the old stubs on Snow Leopard. I'll check my older VMs to see when that support landed.

comment:4 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Cc: ballapete added

comment:5 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

I get when trying to upgrade py27-cython:

xcodebuild: error: '/opt/local/libexec/llvm-3.9/bin/clang' not found.
/Developer/usr/bin/xcodebuild fails with 17664 - Unknown error: 17664
error: command '/opt/local/bin/clang-mp-3.9' failed with exit status 69
xcode-select -print-path
/Developer

comment:6 Changed 7 years ago by gnw3

Cc: gnw3 added

comment:7 Changed 7 years ago by kencu (Ken)

This <https://github.com/kencu/macports-ports/commit/b671ba1875a6e1f28c074407105aeca1bb9d5303> should fix this. Just have to test it out on a few more systems.

comment:8 in reply to:  7 Changed 7 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Replying to kencu:

This <https://github.com/kencu/macports-ports/commit/b671ba1875a6e1f28c074407105aeca1bb9d5303> should fix this. Just have to test it out on a few more systems.

In your commit, may I humbly suggest that instead of testing OS version, we test Xcode version.
Something like this: ${os.major} < 11--->[vercmp ${xcodeversion} 4] < 0.
I am not 100% sure when xcrun started allowing absolute pathnames, but if it happened before Xcode 4.2.1, then llvm-bin-sl might not be needed even on Snow Leopard.

comment:9 Changed 7 years ago by kencu (Ken)

Thanks for the input!

On my systems here:

on 10.6.8 with Xcode 3.2.6, xcrun /Developer/usr/bin/clang returns

xcodebuild: error: invalid tool name - '/Developer/usr/bin/clang' contains '/' characters

on 10.6.8 with Xcode 4.2, xcrun /Developer/usr/bin/clang returns

xcodebuild: error: '/Developer/usr/bin/clang' not found.
/Developer/usr/bin/xcodebuild fails with 17664 - Unknown error: 17664

So it looks like either possible Xcode version for 10.6 errors out. Given that, I guess the system test would give the same outcome as a [vercmp ${xcodeversion} 4.3] < 0 test, so it's kinda moot. You're the spearhead on these clang ports so I'll change it if you prefer.

On 10.7, xcrun will accept a full path name without issues.

comment:10 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Agreed, it should be based on Xcode version.

Are you sure that 4.3 is the dividing line? If not, I suggest being more conservative with either 5.0 or 6.0 depending on what you tested on Lion.

One more note. We'll need to revbump llvm and lldb as well as clang.

Last edited 7 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (diff)

comment:11 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Owner: changed from jeremyhu to kencu

comment:12 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

ken, over to you to take this to the goal. Feel free to send a pull request or show me another patch if you want more feedback, but I trust you to act on the feedback above without a followup review if you're comfortable with it.

comment:13 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Cc: jeremyhu added

comment:14 Changed 7 years ago by kencu (Ken)

Resolution: duplicate
Status: assignedclosed

superseded by 54996

comment:15 Changed 7 years ago by kencu (Ken)

The xcode version I tested on 10.7 that worked was 4.6.3.

comment:16 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Ok, then I suggest using ${xcodeversion} 4.6] < 0

comment:17 Changed 7 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: duplicatefixed

In cdfad47ea5652f36e11ff13a332f318fd9eeb8a8/macports-ports:

llvm-*: fix binary wrappers on older systems

Fixes #54985
Fixes #55008

comment:18 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Resolution: fixed
Status: closedreopened

How can I fix a package without a functioning compiler on which the possibly functioning compiler depends?

When I invoke port upgrade outdated port tries to build py27-cython because clang-3.9 depends on it. Without functioning compiler py27-cython cannot be build.

What is the proper way to transform the dilemma into a monolemma?

comment:19 Changed 7 years ago by kencu (Ken)

yeah. try forcing your build with clang-3.7 or clang-3.8, if you've still got one of them installed.

or edit the existing broken clang wrapper by hand for this one build, if you know what I mean by that.

most won't see this as they use the buildbot version.

comment:20 Changed 7 years ago by gnw3

Peter: the troublemaker is /usr/bin/xcrun. Just send him on a short vacation (sudo mv /usr/bin/xcrun /usr/bin/xcrun_on_vacation) unitl you get the updates installed. This worked for me while waiting for the proper fix.

comment:21 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

I decided to *just* install py27-cython with GCC 6. But port does not know when to stop and continues to install more and more packages with GCC 6 (nghttp2, llvm-3.9, libgcc, …).

Good software is so rare. But it's worth its price.

comment:22 Changed 7 years ago by kencu (Ken)

Oh oh. gcc6 on your LibcxxOnOlderSystems setup will link all your c++ ports against the wrong standard library. That is a no-no, I'm afraid.

If you can, you should roll back anything gcc6 just updated, uninstall the gcc6-built stuff, and build it with clang-3.7 or clang-3.8, or fix the wrapper on clang-3.9, or hide xcrun as gnw3 said -- any one of those options will work correctly.

comment:23 Changed 7 years ago by kencu (Ken)

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