Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#57412 closed defect (fixed)

clang ports: add runtime dependency on cctools

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: Schamschula (Marius Schamschula), jeremyhu (Jeremy Huddleston Sequoia), MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), mojca (Mojca Miklavec), lemzwerg (Werner Lemberg)
Port: clang-3.9, clang-4.0, clang-5.0, clang-6.0, clang-7.0, clang-devel

Description

aria2 fails to build on 10.6, because it requires C++11, and although it uses the cxx11 1.1 portgroup, which uses a newer clang, it still uses the old Xcode ranlib which doesn't understand the files produced by that new clang:

/bin/sh ../libtool  --tag=CC   --mode=link /opt/local/bin/clang-mp-5.0 -Wall -pipe -Os -arch x86_64 -no-undefined -version-info 0:1:0 -L/opt/local/lib -Wl,-headerpad_max_install_names -lintl -arch x86_64 -o libwslay.la   wslay_frame.lo wslay_event.lo wslay_queue.lo wslay_net.lo  
libtool: warning: '-version-info/-version-number' is ignored for convenience libraries
libtool: link: ar cru .libs/libwslay.a .libs/wslay_frame.o .libs/wslay_event.o .libs/wslay_queue.o .libs/wslay_net.o 
/usr/bin/ranlib: object: .libs/libwslay.a(wslay_frame.o) malformed object (unknown load command 2)
ar: internal ranlib command failed

Perhaps the portgroup should have a dependency on cctools, which provides a newer ranlib.

Change History (19)

comment:1 Changed 6 years ago by kencu (Ken)

Agree, it's a concert of build system supports, not just the compiler.

Probably also ld64, if that's not automatic.

Some ports may still need to be tweaked by passing in the newer build system locations, as they default to the system ones, but this would help most of them.

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

Cc: jeremyhu added

clang-5.0, for example, already has a runtime dependency on ld64, but not on cctools. Maybe the clang ports are the correct place for the cctools dependency to go. Jeremy, what do you think?

comment:3 Changed 6 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: MarcusCalhoun-Lopez added

comment:4 Changed 6 years ago by kencu (Ken)

is everyone OK if we just make port:cctools a clang runtime dep for every system? It would just be much simpler that way in the clang-3.9+ portfiles, I can't see how it would cause any harm, and it will save us running into this issue again soon with 10.7 or 10.8, at the lack of some specificity.

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

Port: clang-5.0 clang-6.0 clang-7.0 clang-devel added
Summary: cxx11 1.1 portgroup: add dependency on cctoolsclang ports: add runtime dependency on cctools

Which compilers would we need to add it to? Do we need to watch out for a possible circular dependency?

comment:6 Changed 6 years ago by cjones051073 (Chris Jones)

cctools only declares dependencies on various llvm versions, not on the clang compilers derived from them. Should be tested but I think if you then only add cctools dependencies in clang, and not llvm, you should avoid circular dependencies...

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

in my usage, clang-3.9+ producd the newer objects that require cctools.

that leaves clang 3.4, 3.7, and all yhe xcode clangs for bootstrapping.

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

Ok. I was worried for a minute about the fact that cctools has llvm variants, but that's just llvm, not clang, and only clang needs the cctools dependency, so we should be fine.

clang-3.9 and later already include the following block:

if {[string match macports-clang-* ${configure.compiler}]} {
    depends_build-append port:cctools
    depends_skip_archcheck-append cctools
}

I guess we should change that to depends_lib and revbump.

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

Port: clang-3.9 clang-4.0 added

Wait, no, that block is in the global part of the portfile that affects all subports. We don't want to change that.

clang-3.9 and later also already have this block in the clang subport:

    # Older Xcode's lipo doesn't support x86_64h slices
    # https://trac.macports.org/ticket/53159#ticket
    if {[vercmp $xcodeversion "6.0.0"] < 0} {
        depends_build-append port:cctools
        depends_skip_archcheck-append cctools
    }

I guess that's where we should change depends_build to depends_lib and revbump.

comment:10 Changed 6 years ago by kencu (Ken)

I was thinking of adding it here:

 elseif {${subport} eq "clang-${llvm_version}"} {
    homepage            http://clang.llvm.org/
    description         C, C++, Objective C and Objective C++ compiler
    long_description    Clang is an "LLVM native" C/C++/Objective-C compiler, \
                        which aims to deliver amazingly fast compiles (e.g. \
                        about 3x faster than GCC when compiling Objective-C \
                        code in a debug configuration), extremely useful error \
                        and warning messages and to provide a platform for \
                        building great source level tools. The included Clang \
                        Static Analyzer is a tool that automatically finds bugs in \
                        your code, and is a great example of the sort of tool \
                        that can be built using the Clang frontend as a \
                        library to parse C/C++ code.

    depends_lib         port:libxml2 port:libomp port:llvm-${llvm_version} port:python27
    depends_run         port:clang_select port:ld64
    depends_skip_archcheck-append ld64

adding it to the depends_run section, and probably also to the depends_skip_archcheck section

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

From what I can tell, Xcode ranlib on Lion and newer is new enough. So I would probably only add the cctools lib dependency when [vercmp $xcodeversion 4] < 0.

comment:12 Changed 6 years ago by mojca (Mojca Miklavec)

Cc: mojca added

comment:13 Changed 6 years ago by lemzwerg (Werner Lemberg)

Cc: lemzwerg added

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

At present, the cctools on 10.7+ can handle things.

Personally, as above 57412#comment:4 I'd add the dependency to all os versions, like we do with ld64, and cover all the future troubles we are soon likely to see related to this, but adding cctools to <= 10.6 solves today's issue.

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

Oh, one thing -- this 10.6.8 machine I have runs Xcode 4.2 as well as the older version, and Xcode 4.2 fails to load the newer objects as well. So the cutoff for a functional cctools is presently above Xcode 4.2, but below 10.7's (which is 4.5 I think).

comment:16 Changed 6 years ago by kencu (Ken)

looking at this ticket 53159 that was referenced in a block above, it looks like we should require cctools on Mountain Lion as well. So I guess you're right, we should just change depends_build to depends_lib as you mentioned 57412#comment:9 or we'll just be back here in no time to do it.

comment:17 Changed 6 years ago by kencu (Ken)

See <https://github.com/macports/macports-ports/pull/2900> for a PR that should represent this.

comment:18 Changed 6 years ago by kencu (Ken)

Owner: set to kencu
Resolution: fixed
Status: newclosed

In b3299729b0c810ec5047b5a45318b03e68445d78/macports-ports (master):

clang-3.9+ : make cctools a lib dependency

so cctools is available both at build and at runtime
on all systems less than Xcode 6.0.0
closes: #57412

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

In 71771542b317c0f76516c09c212644b4cfe60ef1/macports-ports (master):

wine*: Don't prevent using clang-5.0 anymore

See: #57412

Note: See TracTickets for help on using tickets.