#1100 CFLAGS=-O6 breaks CC=clang

v0.44
closed-fixed
5
2014-12-24
2013-08-07
No

Versions

Pd-0.45.0 ("test") compiled 10:29:40 Aug  7 2013   (git from today)
gcc (Debian 4.7.2-5) 4.7.2
Debian clang version 3.0-6.2 (tags/RELEASE_30/final) (based on LLVM 3.0)
Linux cappuccino 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux

Reproduction

./autogen.sh
CC=clang ./configure ...

What Happens

configure: error: C compiler cannot create executables
See `config.log' for more details

The log contains:

configure:3810: checking whether the C compiler works
configure:3832: clang  -O6 -funroll-loops -fomit-frame-pointer   conftest.c  >&5
error: invalid value '6' in '-O6'

What I Expected

Pd's build system to autodetect which -O# levels are supported by the chosen compiler, or at least use a more reasonable default.

What Happened After I Fixed It

Pd's load meter reported that one patch of mine used 10% CPU when Pd was compiled with clang's -O3. In comparison, Pd compiled with gcc's -O6 used 25% CPU. I did disable CPU frequency scaling on all cores for this test.

Simple Bugfix Patch

diff --git a/configure.ac b/configure.ac
index 5bd21cc..255ad42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ case $host in
        if test "x${ANDROID}" = "xno"; then
         LINUX=yes
         portaudio=yes
-        CFLAGS="$CFLAGS -O6 -funroll-loops -fomit-frame-pointer"
+        CFLAGS="$CFLAGS -O3 -funroll-loops -fomit-frame-pointer"
        fi
        EXTERNAL_CFLAGS="-fPIC"
        EXTERNAL_LDFLAGS="-Wl,--export-dynamic -shared -fPIC"

A better patch would set CFLAGS after detecting which compiler is being used.

Related

Bugs: #1100

Discussion

  • Miller Puckette

    Miller Puckette - 2013-08-07
    • status: open --> pending
    • assigned_to: Miller Puckette
     
  • Miller Puckette

    Miller Puckette - 2013-08-07

    Changed -O6 to -O3 in makefile.gnu, makefile.mac, and configure.in

     
  • Claude Heiland-Allen

    thanks for the fix, now works fine out of the box on GNU/Linux/Debian/Wheezy

    git checkout master
    git pull
    ./autogen.sh
    CC=clang ./configure --enable-jack --prefix=...
    make -j 6
    make install
    

    but it seems my wild performance claims were erroneous, I haven't been able to reproduce them - probably I didn't disable cpu frequency scaling correctly after all...

     
  • Miller Puckette

    Miller Puckette - 2013-08-08

    Yeah... I dnd't see too much improvement either... EXCEPT that somehow the
    Pd executable it made was about 65% the size of the gcc-built one. That
    can't be bad :)

    M

    On Thu, Aug 08, 2013 at 04:13:49PM +0000, Claude Heiland-Allen wrote:

    thanks for the fix, now works fine out of the box on GNU/Linux/Debian/Wheezy

    git checkout master
    git pull
    ./autogen.sh
    CC=clang ./configure --enable-jack --prefix=...
    make -j 6
    make install
    

    but it seems my wild performance claims were erroneous, I haven't been able to reproduce them - probably I didn't disable cpu frequency scaling correctly after all...


    [bugs:#1100] CFLAGS=-O6 breaks CC=clang

    Status: pending
    Labels: buildsystem performance
    Created: Wed Aug 07, 2013 09:58 AM UTC by Claude Heiland-Allen
    Last Updated: Wed Aug 07, 2013 08:52 PM UTC
    Owner: Miller Puckette

    Versions

    Pd-0.45.0 ("test") compiled 10:29:40 Aug  7 2013   (git from today)
    gcc (Debian 4.7.2-5) 4.7.2
    Debian clang version 3.0-6.2 (tags/RELEASE_30/final) (based on LLVM 3.0)
    Linux cappuccino 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux
    

    Reproduction

    ./autogen.sh
    CC=clang ./configure ...
    

    What Happens

    configure: error: C compiler cannot create executables
    See `config.log' for more details
    

    The log contains:

    configure:3810: checking whether the C compiler works
    configure:3832: clang  -O6 -funroll-loops -fomit-frame-pointer   conftest.c  >&5
    error: invalid value '6' in '-O6'
    

    What I Expected

    Pd's build system to autodetect which -O# levels are supported by the chosen compiler, or at least use a more reasonable default.

    What Happened After I Fixed It

    Pd's load meter reported that one patch of mine used 10% CPU when Pd was compiled with clang's -O3. In comparison, Pd compiled with gcc's -O6 used 25% CPU. I did disable CPU frequency scaling on all cores for this test.

    Simple Bugfix Patch

    diff --git a/configure.ac b/configure.ac
    index 5bd21cc..255ad42 100644
    --- a/configure.ac
    +++ b/configure.ac
    @@ -45,7 +45,7 @@ case $host in
            if test "x${ANDROID}" = "xno"; then
             LINUX=yes
             portaudio=yes
    -        CFLAGS="$CFLAGS -O6 -funroll-loops -fomit-frame-pointer"
    +        CFLAGS="$CFLAGS -O3 -funroll-loops -fomit-frame-pointer"
            fi
            EXTERNAL_CFLAGS="-fPIC"
            EXTERNAL_LDFLAGS="-Wl,--export-dynamic -shared -fPIC"
    

    A better patch would set CFLAGS after detecting which compiler is being used.


    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/pure-data/bugs/1100/

    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

     

    Related

    Bugs: #1100

  • IOhannes m zmölnig

    • status: pending --> closed-fixed
     


Anonymous

Cancel  Add attachments