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

Status: open
Labels: buildsystem performance
Created: Wed Aug 07, 2013 09:58 AM UTC by Claude Heiland-Allen
Last Updated: Wed Aug 07, 2013 09:58 AM UTC
Owner: nobody

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 pd-dev@lists.iem.at is subscribed to https://sourceforge.net/p/pure-data/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/pure-data/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.