POV-Ray : Newsgroups : povray.unix : building POV-Ray with clang instead of gcc Server Time
29 Mar 2024 12:03:02 EDT (-0400)
  building POV-Ray with clang instead of gcc (Message 1 to 6 of 6)  
From: clipka
Subject: building POV-Ray with clang instead of gcc
Date: 7 Sep 2018 12:40:45
Message: <5b92aa0d@news.povray.org>
Random fact I just figured out, in case anyone else might be wondering
how to do this:

If both clang and gcc are installed on a machine, the POV-Ray build
process defaults to using gcc; to force the use of clang instead, use:

    ./configure CXX="clang++" ...


Post a reply to this message

From: jr
Subject: Re: building POV-Ray with clang instead of gcc
Date: 7 Sep 2018 16:20:03
Message: <web.5b92dcb1bf3d23ee1500b2fd0@news.povray.org>
hi,

clipka <ano### [at] anonymousorg> wrote:
> Random fact I just figured out, in case anyone else might be wondering
> how to do this:
>
> If both clang and gcc are installed on a machine, the POV-Ray build
> process defaults to using gcc; to force the use of clang instead, use:
>
>     ./configure CXX="clang++" ...

ok, that's the how.  now to the why.  is there any benefit in preferring one of
those over the other?


regards, jr.


Post a reply to this message

From: clipka
Subject: Re: building POV-Ray with clang instead of gcc
Date: 7 Sep 2018 21:19:16
Message: <5b932394$1@news.povray.org>
Am 07.09.2018 um 22:16 schrieb jr:
> hi,
> 
> clipka <ano### [at] anonymousorg> wrote:
>> Random fact I just figured out, in case anyone else might be wondering
>> how to do this:
>>
>> If both clang and gcc are installed on a machine, the POV-Ray build
>> process defaults to using gcc; to force the use of clang instead, use:
>>
>>     ./configure CXX="clang++" ...
> 
> ok, that's the how.  now to the why.  is there any benefit in preferring one of
> those over the other?

To me, definitely: building with clang allows me to test whether the
source code I'm writing will... well, build with clang ;) - /before/
uploading it to the GitHub repository and making a fool of myself. I
find few things more embarassing than pushing a commit to the repo that
is supposed to silence some warnings of the clang compiler, only to
learn from the automated build tests that I've just broken the clang
build entirely ;)

Why support clang in the first place? Well, that's what some people
happen to be using. On Mac, for instance, clang seems to be the default
C++ compiler.

Also, clang tends to spit out different warnings than gcc, some of which
may hint at flaws in the code.


Performance-wise it doesn't seem to pay off to switch to clang; I'm
seeing ~85s (gcc) vs. 90s (clang) wall clock time for the benchmark. But
that may change with future versions.


Post a reply to this message

From: jr
Subject: Re: building POV-Ray with clang instead of gcc
Date: 8 Sep 2018 07:45:00
Message: <web.5b93b563bf3d23eeb0d4fc1e0@news.povray.org>
hi,

clipka <ano### [at] anonymousorg> wrote:
> >> If both clang and gcc are installed on a machine, the POV-Ray build
> >> process defaults to using gcc; to force the use of clang instead, use:
> > ok, that's the how.  now to the why.  is there any benefit in preferring one of
> > those over the other?
>
> To me, definitely: building with clang allows me to test whether the
> source code I'm writing will... well, build with clang ;) - /before/
> uploading it to the GitHub repository and making a fool of myself.

:-)  I could (and should) learn from that.

> I find few things more embarassing than pushing a commit to the repo that
> is supposed to silence some warnings of the clang compiler, only to
> learn from the automated build tests that I've just broken the clang
> build entirely ;)
> ...
> Also, clang tends to spit out different warnings than gcc, some of which
> may hint at flaws in the code.

that, in itself, is a good reason.

do you use different Makefiles to accommodate the different command-lines?  what
is "best working practice"?

> Performance-wise it doesn't seem to pay off to switch to clang; I'm
> seeing ~85s (gcc) vs. 90s (clang) wall clock time for the benchmark. But
> that may change with future versions.

merci bien.


regards, jr.


Post a reply to this message

From: clipka
Subject: Re: building POV-Ray with clang instead of gcc
Date: 9 Sep 2018 11:15:03
Message: <5b9538f7$1@news.povray.org>
Am 08.09.2018 um 13:41 schrieb jr:

> do you use different Makefiles to accommodate the different command-lines?  what
> is "best working practice"?

Technically, yes, the Makefiles will be different - as they are
generated by the `./configure` step, and will include the name of the
C++ compiler to invoke.

POV-Ray uses an autotools (autoconf / automake) based build process, to
get maximum flexibility in terms of target platforms, compilers used,
and what-have-you.


Post a reply to this message

From: ingo
Subject: Re: building POV-Ray with clang instead of gcc
Date: 28 Sep 2018 12:40:01
Message: <XnsA96BBDE375FE2seed7@news.povray.org>
in news:5b932394$1@news.povray.org clipka wrote:

> On Mac, for instance, clang seems to be the default
> C++ compiler

Also on FreeBSD it's default,

Ingo


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.