[Mesa-dev] [PATCH] scons: Fix build when rtti is disabled

Jose Fonseca jfonseca at vmware.com
Thu Oct 17 00:20:08 CEST 2013


I think this patch does what you need, but with much less unintended side-effects:

$ git diff
diff --git a/scons/llvm.py b/scons/llvm.py
index c1c3736..8388d8e 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -190,6 +190,11 @@ def generate(env):
                 pass
             env.MergeFlags(cppflags)
 
+            # Match llvm --fno-rtti flag
+            cxxflags = env.backtick('llvm-config --cxxflags').split()
+            if '-fno-rtti' in cxxflags:
+                env.Append(CXXFLAGS = ['-fno-rtti'])
+
             components = ['engine', 'bitwriter', 'x86asmprinter']
 
             if llvm_version >= distutils.version.LooseVersion('3.1'):

Can you confirm it works for you?

Jose

----- Original Message -----
> I'm going to have to revert this as this patches has a few problems:
> 
> - it breaks windows builds becuase env[LLVM_CXXFLAGS] is never set there
> - it is merging not only rtti, but the whole cxxflags (defines etc) which has
> proven to be a source of troubles (breaks debugging etc.)
> 
> Jose
> 
> ----- Original Message -----
> > * The rtti fix actually dug up a bug in the scons build scripts.
> > * Autotools took the LLVM cpp and cxx flags, while scons only took
> >   the cpp flags.
> > * This grabs the cxx flags and applies them where needed.
> > * I'm going to run over this and clean things up further, however
> >   this fixes the build where scons is used and rtti is disabled.
> > * The only linux platform I can find with LLVM no-rtti is Ubuntu.
> > * Resolved bug #70471
> > 
> > Tested-by: Vinson Lee <vlee at freedesktop.org>
> > ---
> >  scons/llvm.py                           | 3 +++
> >  src/gallium/auxiliary/SConscript        | 2 ++
> >  src/gallium/drivers/llvmpipe/SConscript | 9 +++++----
> >  3 files changed, 10 insertions(+), 4 deletions(-)
> > 
> > diff --git a/scons/llvm.py b/scons/llvm.py
> > index c1c3736..34b5891 100644
> > --- a/scons/llvm.py
> > +++ b/scons/llvm.py
> > @@ -190,6 +190,9 @@ def generate(env):
> >                  pass
> >              env.MergeFlags(cppflags)
> >  
> > +            cxxflags = env.backtick('llvm-config --cxxflags').rstrip()
> > +            env.Append(LLVM_CXXFLAGS = cxxflags)
> > +
> >              components = ['engine', 'bitwriter', 'x86asmprinter']
> >  
> >              if llvm_version >= distutils.version.LooseVersion('3.1'):
> > diff --git a/src/gallium/auxiliary/SConscript
> > b/src/gallium/auxiliary/SConscript
> > index 31dfed3..3ac3112 100644
> > --- a/src/gallium/auxiliary/SConscript
> > +++ b/src/gallium/auxiliary/SConscript
> > @@ -46,6 +46,8 @@ source = env.ParseSourceList('Makefile.sources', [
> >  ])
> >  
> >  if env['llvm']:
> > +    env.Append(CXXFLAGS = env['LLVM_CXXFLAGS'])
> > +
> >      source += env.ParseSourceList('Makefile.sources', [
> >          'GALLIVM_SOURCES',
> >          'GALLIVM_CPP_SOURCES'
> > diff --git a/src/gallium/drivers/llvmpipe/SConscript
> > b/src/gallium/drivers/llvmpipe/SConscript
> > index 20500fd..71faee2 100644
> > --- a/src/gallium/drivers/llvmpipe/SConscript
> > +++ b/src/gallium/drivers/llvmpipe/SConscript
> > @@ -10,12 +10,13 @@ if not env['llvm']:
> >  env = env.Clone()
> >  
> >  llvmpipe = env.ConvenienceLibrary(
> > -	target = 'llvmpipe',
> > -	source = env.ParseSourceList('Makefile.sources', 'C_SOURCES')
> > -	)
> > +    target = 'llvmpipe',
> > +    source = env.ParseSourceList('Makefile.sources', 'C_SOURCES')
> > +)
> >  
> > -env.Alias('llvmpipe', llvmpipe)
> > +env.Append(CXXFLAGS = env['LLVM_CXXFLAGS'])
> >  
> > +env.Alias('llvmpipe', llvmpipe)
> >  
> >  if not env['embedded']:
> >      env = env.Clone()
> > --
> > 1.8.4
> > 
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> > 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list