Re: building from source with libc++

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: building from source with libc++

Mojca Miklavec-2
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: building from source with libc++

Clemens Lang-2
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

-std=c++11 for gnuplot +qt5 (was Re: building from source with libc++)

Andrew L. Moore
In reply to this post by Mojca Miklavec-2
Sorry to land in the middle this discussion with some dumb questions...

  I'm on macOS 10.12.4 (Sierra)/Xcode 8.3.2, but was reviewing LibcxxOnOlderSystems
after having to add `configure.cxxflags-append -std=c++11’  in gnuplot Portfile for variant qt5.

Is my understanding correct that, on Sierra, Apple clang++ isn’t using c++11 by default?
Is there, or should there be, a LibcxxOnNewerSystems page that advises making
`-std=c++11' the default?

From cxx11-1.x.tcl, it would seem that  there are hurdles to this on newer systems?
And yet, to link against qt5, it’s required?

Again, looking at qt5-1.0.tcl, I don’t see `-std=c++11’ used at.  So is what I’m doing working
for the wrong reason, perhaps?

Lots more head-scratching along these lines…  Any pointers would be appreciated!
-AM


On Apr 19, 2017, at 9:13 AM, Mojca Miklavec <[hidden email]> wrote:

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: -std=c++11 for gnuplot +qt5 (was Re: building from source with libc++)

Mojca Miklavec-2
On 20 April 2017 at 23:12, Andrew L. Moore wrote:
> Sorry to land in the middle this discussion with some dumb questions...
>
>   I'm on macOS 10.12.4 (Sierra)/Xcode 8.3.2, but was reviewing
> LibcxxOnOlderSystems
> after having to add `configure.cxxflags-append -std=c++11’  in gnuplot
> Portfile for variant qt5.
>
> Is my understanding correct that, on Sierra, Apple clang++ isn’t using c++11
> by default?

I've never heard of it not using it.

Even if you run "clang -stdlib=libc++" on 10.7 with a super ancient
compiler, you get (some of) C++11 by default.

The only exception is this one:
- https://trac.macports.org/ticket/53634
but that one has nothing to do with the stock compiler.

> Lots more head-scratching along these lines…  Any pointers would be
> appreciated!

Sorry, I'm clueless.

Mojca
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: building from source with libc++

Mojca Miklavec-2
In reply to this post by Clemens Lang-2
On 20 April 2017 at 23:06, Clemens Lang wrote:

> On Wed, Apr 19, 2017 at 03:13:37PM +0200, Mojca Miklavec wrote:
>>
>> 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).

Good idea.

You mean putting compiler to a script or using something like
CC="clang -arch i386" (and fix it for CMake)?

Not right now (some higher priority things at the moment), but I'll
probably ask for a bit of help in case I get stuck with Tcl and then
test.

Mojca

PS: It would probably make sense to find a slightly faster machine and
fire up a number of builds using our buildbot setup :), on a local
master & slave of course.
Loading...