building from source with libc++

Clemens Lang cal at macports.org
Thu Apr 20 21:06:49 UTC 2017


Hi,

On Wed, Apr 19, 2017 at 03:13:37PM +0200, Mojca Miklavec wrote:
> I just had some back-and-forth conversation about problems related to
> config.guess [1] (link is not too relevant). They sent me this link
> which might be more relevant: [2], arguing that one should probably
> use:
>     CC="clang -arch i386"
> rather than
>     CC=clang
>     CFLAGS="-arch i386"
>     LDFLAGS="-arch i386"
> 
> And some conversation with xwWidgets developers [3] which also
> suggested me to use:
>     CXX="clang -stdlib=libc++"
> rather than fighting with:
>     CXXFLAGS="-stdlib=libc++"
>     LDFLAGS="-stdlib=libc++"

While I agree in general, I think CMake will not accept flags as
argument for -DCMAKE_C_COMPILER and -DCMAKE_CXX_COMPILER, which makes
the separation necessary in any case, unless you want to wrap it in a
script.

> The thing is that a lot of these failures happen when developers don't
> put too much attention into consistently respecting all flags. Some
> don't respect the compiler, but that's easier to spot, easier to argue
> about and much easier to test on any given 10.12 box. Testing for
> correct stdlib flags is left to weirdos still running the ancient
> boxes and includes a lot of effort in making sure that upstream fixes
> the problems. But no matter how much effort goes into this, there will
> still be a huge number of packages forgetting to add all the CXXFLAGS
> to their autoconf setup or to their manually crafted makefiles.

Homebrew has the option to wrap their compiler in a script for this
reason. They even sanitize the options passed to that compiler to match
the ones they expect.

If you have time, give it a shot and see what breaks (and what doesn't).

-- 
Clemens


More information about the macports-dev mailing list