[llvm-commits] [zorg] r148954 - /zorg/trunk/zorg/buildbot/builders/DragonEggBuilder.py

Duncan Sands baldrick at free.fr
Wed Jan 25 04:50:12 PST 2012


Author: baldrick
Date: Wed Jan 25 06:50:12 2012
New Revision: 148954

URL: http://llvm.org/viewvc/llvm-project?rev=148954&view=rev
Log:
This builder is being run on a machine that doesn't have gcc-4.6 libraries
on it.  The result is that programs built with gcc-4.6 (which itself is built
during the bootstrap) fail to run because those libraries can't be located.
They exist of course: inside the just built gcc-4.6's install directory.  So
add the appropriate paths to LD_LIBRARY_PATH in the environment.

Modified:
    zorg/trunk/zorg/buildbot/builders/DragonEggBuilder.py

Modified: zorg/trunk/zorg/buildbot/builders/DragonEggBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/DragonEggBuilder.py?rev=148954&r1=148953&r2=148954&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/DragonEggBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/DragonEggBuilder.py Wed Jan 25 06:50:12 2012
@@ -13,6 +13,14 @@
     cc_settings += [WithProperties('CXX=' + gxx)]
   return cc_settings
 
+def extractSearchPaths(rc, stdout, stderr):
+  mapping = {}
+  for l in stdout.split('\n'):
+    vals = l.split(': =', 1)
+    if len(vals) == 2:
+      mapping['gcc_' + vals[0]] = vals[1]
+  return mapping
+
 def getDragonEggBootstrapFactory(triple, gcc_repository,
                                  extra_languages=[],
                                  extra_gcc_configure_args=[],
@@ -31,19 +39,19 @@
                                                command=['pwd'],
                                                property='builddir',
                                                description='set build dir',
-                                               workdir='.'))
+                                               workdir='.', env=env))
 
     # Checkout LLVM sources.
     f.addStep(SVN(name='svn-llvm',
                   mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/',
                   defaultBranch='trunk',
-                  workdir='llvm.src'))
+                  workdir='llvm.src', env=env))
 
     # Checkout DragonEgg sources.
     f.addStep(SVN(name='svn-dragonegg',
                   mode='update', baseURL='http://llvm.org/svn/llvm-project/dragonegg/',
                   defaultBranch='trunk',
-                  workdir='dragonegg.src'))
+                  workdir='dragonegg.src', env=env))
 
     # Checkout GCC.  This is usually a specific known good revision (supplied by
     # appending @revision to the URL).  The SVN step can't handle that.  As it
@@ -53,9 +61,10 @@
     f.addStep(ShellCommand(name='svn-gcc',
                            command=svn_co,
                            haltOnFailure=True,
-                           workdir='.'))
+                           workdir='.', env=env))
 
     # Do the boostrap.
+    cur_env = env
     prev_gcc = None     # C compiler built during the previous stage.
     prev_gxx = None     # C++ compiler built during the previous stage.
     prev_plugin = None  # Plugin built during the previous stage.
@@ -71,26 +80,26 @@
                                  command=['rm', '-rf', gcc_obj_dir],
                                  haltOnFailure = True,
                                  description=['rm build dir', 'gcc', stage],
-                                 workdir='.', env=env))
+                                 workdir='.', env=cur_env))
       f.addStep(Configure(name='configure.gcc.%s' % stage,
                           command=(['../gcc.src/configure',
                                     WithProperties('--prefix=%%(builddir)s/%s' % gcc_install_dir)] +
                                    gcc_configure_args + getCCSetting(prev_gcc, prev_gxx)),
                           haltOnFailure = True,
                           description=['configure', 'gcc', stage],
-                          workdir=gcc_obj_dir, env=env))
+                          workdir=gcc_obj_dir, env=cur_env))
       f.addStep(WarningCountingShellCommand(name = 'compile.gcc.%s' % stage,
                                             command = ['nice', '-n', '10',
                                                        'make', WithProperties('-j%s' % jobs)],
                                             haltOnFailure = True,
                                             description=['compile', 'gcc', stage],
-                                            workdir=gcc_obj_dir, env=env))
+                                            workdir=gcc_obj_dir, env=cur_env))
       f.addStep(WarningCountingShellCommand(name = 'install.gcc.%s' % stage,
                                             command = ['nice', '-n', '10',
                                                        'make', 'install'],
                                             haltOnFailure = True,
                                             description=['install', 'gcc', stage],
-                                            workdir=gcc_obj_dir, env=env))
+                                            workdir=gcc_obj_dir, env=cur_env))
 
       # From this point on build everything using the just built GCC.
       prev_gcc = '%(builddir)s/'+gcc_install_dir+'/bin/gcc'
@@ -99,11 +108,21 @@
         prev_gcc += ' -fplugin=' + prev_plugin
         prev_gxx += ' -fplugin=' + prev_plugin
 
-# FIXME: The built libstdc++ and libgcc may be more recent than the system versions.
-# FIXME: Set the library path so that programs compiled with the just built GCC will
-# FIXME: start successfully, rather than failing due to shared library dependencies.
-# FIXME: export LD_LIBRARY_PATH=`$CC -print-search-dirs | grep "^libraries:" | \
-# FIXME:   sed "s/^libraries: *=//"`:$LD_LIBRARY_PATH
+      # The built libstdc++ and libgcc may well be more recent than the system
+      # versions.  Set the library path so that programs compiled with the just
+      # built GCC will start successfully, rather than failing due to missing
+      # shared library dependencies.
+      f.addStep(buildbot.steps.shell.SetProperty(name = 'gcc.search.paths.%s' % stage,
+                                                 command=[WithProperties(prev_gcc),
+                                                          '-print-search-dirs'],
+                                                 extract_fn=extractSearchPaths,
+                                                 description=['gcc', 'search paths',
+                                                              stage], env=cur_env))
+      cur_env = cur_env.copy();
+      if 'LD_LIBRARY_PATH' in env:
+        cur_env['LD_LIBRARY_PATH'] = WithProperties('%(gcc_libraries)s'+':'+env['LD_LIBRARY_PATH'])
+      else:
+        cur_env['LD_LIBRARY_PATH'] = WithProperties('%(gcc_libraries)s')
 
       # Build LLVM with the just built GCC and install it.
       llvm_obj_dir = 'llvm.obj.%s' % stage
@@ -115,26 +134,26 @@
                                  command=['rm', '-rf', llvm_obj_dir],
                                  haltOnFailure = True,
                                  description=['rm build dir', 'llvm', stage],
-                                 workdir='.', env=env))
+                                 workdir='.', env=cur_env))
       f.addStep(Configure(name='configure.llvm.%s' % stage,
                           command=(['../llvm.src/configure',
                                     WithProperties('--prefix=%%(builddir)s/%s' % llvm_install_dir)] +
                                     llvm_configure_args + getCCSetting(prev_gcc, prev_gxx)),
                           haltOnFailure = True,
                           description=['configure', 'llvm', stage],
-                          workdir=llvm_obj_dir, env=env))
+                          workdir=llvm_obj_dir, env=cur_env))
       f.addStep(WarningCountingShellCommand(name = 'compile.llvm.%s' % stage,
                                             command = ['nice', '-n', '10',
                                                        'make', WithProperties('-j%s' % jobs)],
                                             haltOnFailure = True,
                                             description=['compile', 'llvm', stage],
-                                            workdir=llvm_obj_dir, env=env))
+                                            workdir=llvm_obj_dir, env=cur_env))
       f.addStep(WarningCountingShellCommand(name = 'install.llvm.%s' % stage,
                                             command = ['nice', '-n', '10',
                                                        'make', 'install'],
                                             haltOnFailure = True,
                                             description=['install', 'llvm', stage],
-                                            workdir=llvm_obj_dir, env=env))
+                                            workdir=llvm_obj_dir, env=cur_env))
 
       # Build dragonegg with the just built LLVM and GCC.
       dragonegg_pre_obj_dir = 'dragonegg.obj.pre.%s' % stage
@@ -143,7 +162,7 @@
                                  command=['rm', '-rf', dragonegg_pre_obj_dir],
                                  haltOnFailure = True,
                                  description=['rm build dir', 'dragonegg pre', stage],
-                                 workdir='.', env=env))
+                                 workdir='.', env=cur_env))
       f.addStep(WarningCountingShellCommand(
               name = 'compile.dragonegg.pre.%s' % stage,
               command = ['nice', '-n', '10',
@@ -155,7 +174,7 @@
                          ] + getCCSetting(prev_gcc, prev_gxx),
               haltOnFailure = True,
               description=['compile', 'dragonegg pre', stage],
-              workdir=dragonegg_pre_obj_dir, env=env))
+              workdir=dragonegg_pre_obj_dir, env=cur_env))
       prev_gcc = '%(builddir)s/'+gcc_install_dir+'/bin/gcc -fplugin=%(builddir)s/'+dragonegg_pre_obj_dir+'/dragonegg.so'
       prev_gxx = '%(builddir)s/'+gcc_install_dir+'/bin/g++ -fplugin=%(builddir)s/'+dragonegg_pre_obj_dir+'/dragonegg.so'
 
@@ -166,7 +185,7 @@
                                  command=['rm', '-rf', dragonegg_obj_dir],
                                  haltOnFailure = True,
                                  description=['rm build dir', 'dragonegg', stage],
-                                 workdir='.', env=env))
+                                 workdir='.', env=cur_env))
       f.addStep(WarningCountingShellCommand(
               name = 'compile.dragonegg.%s' % stage,
               command = ['nice', '-n', '10',
@@ -179,7 +198,7 @@
                          ] + getCCSetting(prev_gcc, prev_gxx),
               haltOnFailure = True,
               description=['compile', 'dragonegg', stage],
-              workdir=dragonegg_obj_dir, env=env))
+              workdir=dragonegg_obj_dir, env=cur_env))
 
       # Ensure that the following stages use the just built plugin.
       prev_plugin = '%(builddir)s/'+dragonegg_obj_dir+'/dragonegg.so'
@@ -195,6 +214,6 @@
                                     'done'],
                            haltOnFailure = True,
                            description=['compare', 'stages', '2', 'and', '3'],
-                           workdir='dragonegg.obj.stage3', env=env))
+                           workdir='dragonegg.obj.stage3', env=cur_env))
 
     return f





More information about the llvm-commits mailing list