Opened 5 years ago

Closed 4 years ago

#59584 closed defect (fixed)

macports-clang versions <= 3.7 don't understand -stdlib=macports-libstdc++

Reported by: kencu (Ken) Owned by:
Priority: Normal Milestone:
Component: base Version: 2.6.2
Keywords: Cc: cooljeanius (Eric Gallager), dgelessus (dgelessus)
Port:

Description (last modified by kencu (Ken))

currently base will try to pass -stdlib=macports-libstdc++ to clang 3.4 or 3.7 under certain circumstances of blacklisting and whitelisting when the compiler c or c++ standards are set to >= 2011.

in portconfigure:get_min_clang the logic to select a proper clang doesn't take into account the fact that macports-clang versions <= 3.7 won't be able to understand -stdlib=macports-libstdc++.

macports-clang versions <= 3.7 can only be used for compiler.cxx_standard >= 2011 or compiler.c_standard >= 2011 if configure.cxx_stdlib=libc++.

Change History (16)

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

This shows up, for example, when trying to build icu on Intel versions of Tiger or Leopard configured to libstdc++. Base selects clang-3.4 as a compiler, and then tries to pass it -stdlib=macports-libstdc++ to satisfy the compiler.cxx_standard 2011 directive, and that fails.

comment:2 Changed 5 years ago by kencu (Ken)

Description: modified (diff)
Summary: macports-clang versions < 5.0 don't understand -stdlib=macports-libstdc++macports-clang versions <= 3.7 don't understand -stdlib=macports-libstdc++

comment:3 Changed 5 years ago by kencu (Ken)

FYI, there are working versions of clang-3.8 and above that do accept -stdlib=macports-libstdc++.

comment:4 Changed 5 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:5 Changed 5 years ago by dgelessus (dgelessus)

Cc: dgelessus added

comment:6 Changed 4 years ago by programmingkidx

Is there a way to install ICU on Mac OS 10.4? When I try to build it I see the error with "-stdlib=macports-libstdc++" using clang 3.4. When I try to install clang 3.9 it says to install clang 8.0. When I try to install clang 8.0 I see this error message: Error: libcxx is not supported on Tiger or earlier.

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

You will not get anywhere at present unless you use my TigerPorts repo.

$ port -v installed icu
The following ports are currently installed:
  icu @65.1_1 (active) platform='darwin 8' archs='i386' date='2020-03-15T10:18:41-0700'

Then you do clang-3.4 -> libcxx -> clang-3.7 -> clang-5.0 -> clang-7.0.

But it is not yet fully automated. I am gradually introducing the changes into MacPorts.

Version 0, edited 4 years ago by kencu (Ken) (next)

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

base is still broken in this regard, I notice.

comment:9 Changed 4 years ago by programmingkidx

Sure. What are the directions to use your repo?

comment:10 Changed 4 years ago by dgelessus (dgelessus)

Last time I tried I was able to build icu using GCC 7, using port install gcc7 (warning: this will take a while), then port install icu configure.compiler=macports-gcc-7. See also #59717.

But to install any of the newer Clang versions, you should really use @kencu's TigerPorts repo. In particular the cmake39 port will be helpful - recent Clang versions require CMake to build, and IIRC the standard cmake port doesn't build on Tiger without modifications. TigerPorts also has some custom changes to the later llvm-*/clang-* ports to make them work on Tiger.

comment:11 in reply to:  9 Changed 4 years ago by dgelessus (dgelessus)

Replying to programmingkidx:

Sure. What are the directions to use your repo?

First you need to clone the repo onto your machine, into a location that can be accessed by the macports user. I usually use a directory under /Users/Shared for this purpose, because readable and writable to all users. For example:

$ cd /Users/Shared
$ git clone https://github.com/kencu/TigerPorts.git
Cloning into 'TigerPorts' ...
... etc.
$ 

Then you need to add the path of the newly cloned directory into your MacPorts installation's sources.conf (by default located under /opt/local/etc/macports). This is described in detail in the MacPorts guide under Local Portfile Repositories. In short, you need to add the line file:///Users/Shared/TigerPorts to the sources.conf, *above* the default MacPorts URL (which starts with rsync://rsync.macports.org/).

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

FYI in TigerPorts I have been fussing a bit about which gcc7 version to use.

gcc7/libgcc7 7.5.0 is the current one in MacPorts, but it is ABI broken in places and causes segfaults on older systems that use it. To try to fix that, Marcus generated a wrapper for executables that show this error, but I use Tiger to make distributable applications like TenFourFox and I didn't want to use that wrapper all the time.

I have not yet fully decided what to do about that problem.

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:13 Changed 4 years ago by programmingkidx

Good news, I was able to build icu using gcc7. Thank you both for the help. Is there anything I could do to help with fixing the icu building problem?

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

It's a compiler selection problem in base, in the location as per the link above into portconfigure.tcl, with about a five minute fix.

If you want to try fixing the base problem (the clang selection needs to take into account whether you're building with libc++ or not -- currently supported macports-clangs < 5.0 don't support c++11 unless you're using libc++) then fork base, add the branch code right about where I indicated it goes, test it out until it works properly on all systems, and then PR it and hold your breath

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

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