building from source with libc++
Mojca Miklavec
mojca at macports.org
Wed Apr 19 13:13:37 UTC 2017
Posting this to the developer list, it probably got too off-topic for
the user list.
On 19 April 2017 at 02:29, Ken Cunningham wrote:
>
> After coming across this issue one too many times for my own liking, and
> changing several dozen ports as you have done, I finally just patched clang
> to make it default to add -stdlib=lilbc++ by default on all systems, which
> solves this issue once and forever.
>
> I do find this helps a lot with the stdlib hiccups on older systems, and i
> plan to continue to use it, but I understand concerns about changing default
> behaviour of compilers. Jeremy has previously indicated privately to me
> that he wasn't too keen on the idea due to possible unexpected consequences
> of changing default behaviour, and this is a respectable point coming from
> the honcho himself.
>
> As a counter argument, changing one compiler default to what is the current
> expected behaviour seems a lot easier than updating an uncertain number out
> of 21,000 ports, some of which (WxWidgets, for example) turn out to be
> rather messy to fix properly.
Something else just crossed my mind (though this is something for the
developer mailing list rather than for the user list).
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++"
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.
Changing this would be a very very very serious change, one that might
break a number of packages, but maybe MacPorts should actually set
CXX="{compiler} -stdlib={stdlib}"
in the environmental variables. Then it would most likely work better
in many ports that currently fail.
(We might be able to afford making this change just for
libc++-pre-10.9 setups. Still, it might get tricky.)
Mojca
[1] http://lists.gnu.org/archive/html/config-patches/2017-04/msg00012.html
http://lists.gnu.org/archive/html/config-patches/2017-04/msg00003.html
[2] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Preset-Output-Variables.html
[3] https://groups.google.com/d/msg/wx-dev/fIYBMsEKIqo/TtfiEOimCAAJ
More information about the macports-dev
mailing list