[Fluxus] Make fluxus build system respect CXXFLAGS and friends?

Karl Svec karlsvec at gmail.com
Fri Jul 9 13:38:24 PDT 2010


On Jul 9, 2010, at 12:29 PM, gabor papp wrote:

> hi Karl,
>
>> It would be nice if the fluxus build system were made aware of CXX,
>> CXXFLAGS, LDFLAGS and so forth, rather than hard-coding the build
> the last time i checked it, i encountered a problem in osx. as far  
> as i
> remember the environment variables are not inherited when you are
> running sudo. because of this, scons recompiles the whole project on
> install with the default flags. instead the CFLAGS and LDFLAGS options
> were added, so you can pass your environment variables in the scons
> command line. i think this is not a problem on linux. but let me  
> know if
> i'm wrong, or you have a better suggestion.
>

Gabor,

I should have taken a closer look at the SConstruct file. I was  
expecting the autoconf-style CXXFLAGS environment variable to be used,  
but fluxus uses CCFLAGS.

However, after specifying some of my own CCFLAGS on the command line,  
scons (I have version 1.3.0) was failing. config.log had g++ commands  
that looked something like this:

g++ <some flags> " -DFLUXUS_MAJOR_VERSION=0" " - 
DFLUXUS_MINOR_VERSION=17" ...

Scons was throwing in quotation marks that didn't belong, causing g++  
to complain.

Some changes to the SConscript file(s) were necessary to get things  
working right (on Mac OS X 10.5.8 PowerPC):

<snip>
diff --git a/SConstruct b/SConstruct
index 2542323..9ec0150 100644
--- a/SConstruct
+++ b/SConstruct
@@ -76,7 +76,7 @@ IncludePaths = [

  paranoid = ' -W -Wcast-qual -Wwrite-strings -Wcast-align -Wpointer- 
arith -Wconversion -Wredundant-decls -Wunreachable-code -Winline - 
Wlarger-than-256'

-env = Environment(CCFLAGS = '-ggdb -pipe -Wall -O3 -ffast-math -Wno- 
unused -fPIC',
+env = Environment(CCFLAGS = ['-ggdb', '-pipe', '-Wall', '-O3', '- 
ffast-math', '-Wno-unused', '-fPIC'],
                    VERSION_NUM = FluxusVersion)
  env.MergeFlags(ARGUMENTS.get('CCFLAGS', ''))
  env.MergeFlags(ARGUMENTS.get('LDFLAGS', ''))
@@ -91,40 +91,40 @@ if env['PLATFORM'] == 'darwin':

  env.Append(CPPPATH = IncludePaths)
  env.Append(LIBPATH = LibPaths)
-env.Append(CCFLAGS=' -DFLUXUS_MAJOR_VERSION='+MajorVersion)
-env.Append(CCFLAGS=' -DFLUXUS_MINOR_VERSION='+MinorVersion)
-env.Append(CCFLAGS=" -DRACKET_COLLECTS_LOCATION="+"\"\\ 
\""+RacketCollectsLocation+"\"\\\"")
-env.Append(CCFLAGS=" -DFLUXUS_COLLECTS_LOCATION="+"\"\\ 
\""+FluxusCollectsLocation+"\"\\\"")
-env.Append(CCFLAGS=" -DDATA_LOCATION="+"\"\\\""+DataLocation+"\"\\\"")
+env.Append(CCFLAGS=['-DFLUXUS_MAJOR_VERSION='+MajorVersion])
+env.Append(CCFLAGS=['-DFLUXUS_MINOR_VERSION='+MinorVersion])
+env.Append(CCFLAGS=["-DRACKET_COLLECTS_LOCATION="+"\"\\ 
\""+RacketCollectsLocation+"\"\\\""])
+env.Append(CCFLAGS=["-DFLUXUS_COLLECTS_LOCATION="+"\"\\ 
\""+FluxusCollectsLocation+"\"\\\""])
+env.Append(CCFLAGS=["-DDATA_LOCATION="+"\"\\\""+DataLocation+"\"\\\""])

  if ARGUMENTS.get("GLSL","1")=="1":
-        env.Append(CCFLAGS=' -DGLSL')
+        env.Append(CCFLAGS=['-DGLSL'])

  if ARGUMENTS.get("STEREODEFAULT","0")=="1":
-        env.Append(CCFLAGS=' -DSTEREODEFAULT')
+        env.Append(CCFLAGS=['-DSTEREODEFAULT'])

  if ARGUMENTS.get("ACCUM_BUFFER","0")=="1":
-        env.Append(CCFLAGS=' -DACCUM_BUFFER')
+        env.Append(CCFLAGS=['-DACCUM_BUFFER'])

  if ARGUMENTS.get("MULTISAMPLE","0")=="1":
-        env.Append(CCFLAGS=' -DMULTISAMPLE')
+        env.Append(CCFLAGS=['-DMULTISAMPLE'])

  if ARGUMENTS.get("MULTITEXTURE","1")=="0":
-        env.Append(CCFLAGS=' -DDISABLE_MULTITEXTURE')
+        env.Append(CCFLAGS=['-DDISABLE_MULTITEXTURE'])

  if ARGUMENTS.get("RELATIVE_COLLECTS","0")=="1":
-	env.Append(CCFLAGS=' -DRELATIVE_COLLECTS')
+	env.Append(CCFLAGS=['-DRELATIVE_COLLECTS'])

  static_modules=0
  if ARGUMENTS.get("STATIC_MODULES","0")=="1":
  	static_modules=1
-	env.Append(CCFLAGS=' -DSTATIC_LINK')
+	env.Append(CCFLAGS=['-DSTATIC_LINK'])

  static_everything=0
  if ARGUMENTS.get("STATIC_EVERYTHING","0")=="1":
  	static_everything=1
  	static_modules=1
-	env.Append(CCFLAGS=' -DSTATIC_LINK')
+	env.Append(CCFLAGS=['-DSTATIC_LINK'])

  static_ode=int(ARGUMENTS.get("STATIC_ODE","0"))

@@ -137,14 +137,14 @@ if env['PLATFORM'] == 'win32':
  	MZDYN = RacketLib + "/gcc/mzdyn.o"

  	if ARGUMENTS.get("3M","1")=="1":
-		env.Append(CCFLAGS=' -DMZ_PRECISE_GC')
+		env.Append(CCFLAGS=['-DMZ_PRECISE_GC'])
  		MZDYN = RacketLib + "/gcc/mzdyn3m.o"
  else:
  	# need to do this to get scons to link plt's mzdyn.o
  	MZDYN = RacketLib + "/mzdyn.o"
  	
  	if ARGUMENTS.get("3M","1")=="1":
-		env.Append(CCFLAGS=' -DMZ_PRECISE_GC')
+		env.Append(CCFLAGS=['-DMZ_PRECISE_GC'])
  		MZDYN = RacketLib + "/mzdyn3m.o"

   
################################################################################
@@ -195,10 +195,10 @@ elif env['PLATFORM'] == 'darwin':
  		if not GetOption('app'):
  			LibList += [["jack", "jack/jack.h"]]
  		env.Append(FRAMEWORKPATH = [RacketLib])
-		env.Append(CCFLAGS = ' -DOS_X') # required by PLT 4.2.5
+		env.Append(CCFLAGS = ['-DOS_X']) # required by PLT 4.2.5

  		if GetOption('app'):
-			env.Append(CCFLAGS = ' -D__APPLE_APP__ -DRELATIVE_COLLECTS')
+			env.Append(CCFLAGS = ['-D__APPLE_APP__ -DRELATIVE_COLLECTS'])
  			# FIXME: check if Jackmp is available when making an app
  			env.Append(FRAMEWORKS = Split("GLUT OpenGL CoreAudio  
CoreFoundation Racket Jackmp"))
  		else:
@@ -233,12 +233,12 @@ if not GetOption('clean'):
                          Exit(1)

          if not conf.CheckFunc("dInitODE2"):
-            env.Append(CCFLAGS=' -DGOODE_OLDE_ODE')
+            env.Append(CCFLAGS=['-DGOODE_OLDE_ODE'])

          # the liblo version 0.25 does not include the declaration of  
lo_arg_size anymore
          # This will be re-included in future version
          if not conf.CheckFunc("lo_arg_size_check", "#include <lo/ 
lo.h>\n#define lo_arg_size_check() lo_arg_size(LO_INT32, NULL)", "C++"):
-            env.Append(CCFLAGS=' -DNO_LO_ARG_SIZE_DECL')
+            env.Append(CCFLAGS=['-DNO_LO_ARG_SIZE_DECL'])

          env = conf.Finish()
          # ... but we shouldn't forget to add them to LIBS manually
</snip>

<snip>
diff --git a/modules/fluxus-midi/SConscript b/modules/fluxus-midi/ 
SConscript
index f833489..b8bb1f5 100644
--- a/modules/fluxus-midi/SConscript
+++ b/modules/fluxus-midi/SConscript
@@ -22,10 +22,10 @@ Source = ["src/FluxusMIDI.cpp",
  if env['PLATFORM'] == 'posix':
  	Libs =  ['pthread', 'asound']
  	Frameworks = []
-	env.Append(CCFLAGS = ' -D__LINUX_ALSASEQ__')
+	env.Append(CCFLAGS = ['-D__LINUX_ALSASEQ__'])
  elif env['PLATFORM'] == 'darwin':
  	Libs = []
-	env.Append(CCFLAGS = ' -D__MACOSX_CORE__')
+	env.Append(CCFLAGS = ['-D__MACOSX_CORE__'])
  	Frameworks = ['CoreMIDI', 'CoreAudio', 'CoreFoundation', 'Racket']

  if static_modules:
</snip>

As you can see, the solution was to enclose the strings being passed  
to env.Append in square brackets, making them lists. I suspect that  
the use of leading spaces within the offending strings was causing  
scons to place quotes around them. I think these diffs cover the  
entire usage of CCFLAGS within fluxus.

As an aside, I'm installing fluxus into a prefix inside my home  
directory, to the sudo thing is a non-issue.

Thanks,

Karl

> best,
> gabor




More information about the Fluxus mailing list