[MacPorts] #67307: glib2 compilation issues with clang
MacPorts
noreply at macports.org
Tue May 2 15:21:41 UTC 2023
#67307: glib2 compilation issues with clang
-----------------------+----------------------
Reporter: rmottola | Owner: mascguy
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords: leopard
Port: glib2 |
-----------------------+----------------------
Comment (by kencu):
Replying to [comment:11 rmottola]:
>
> I added
>
>
> {{{
> configure.cxxflags-append -std=c++11
> }}}
>
> but it still doesn't work.
With gcc5+ as the compiler, it should work. gcc5+ defaults to c++11 as the
standard, and automatically uses it's newer libstdc++.dylib and newer
headers.
With clang as the compiler, you will have to force non-defaults. You would
have to add the {{{-std=c++11}}} to the cxxflags as you did, but then you
also need to force clang to use a newer standard library.
The usual one on macOS is libc++, so you would make this happen on the
cxxflags and ldflags {{{-stdlib=libc++}}} for most MacPorts builds. This
is what we default to and test on 10.6+.
For our "bastardized" builds on 10.4 and 10.5, we have the hack that lets
clang use libgcc's headers and libraries. So you have to make this happen
with the cxxflags (and ldflags) {{{-stdlib=macports-libstdc++}}}. Usually
that is done by base, by setting this in the Portfile:
{{{
compiler.cxx_standard 2011
}}}
but then you will have to inspect the build lines to make sure that you
are not setting the stdlib twice (that may not work out if they are
different) and that the stdlib setting is also showing up in the ldflags
(otherwise the link will fail).
--
Ticket URL: <https://trac.macports.org/ticket/67307#comment:15>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list