[PyQt] Using QMAKE_LINK_SHLIB instead of QMAKE_LINK to link shared libs

Albert Chin pykde at mlists.thewrittenword.com
Wed Dec 23 20:49:43 GMT 2009


So, I've built sip-4.9.3 on AIX 5.3 with the attached patch. I also have
specs/aix-g++ modified with:
  QMAKE_LINK              = g++
  QMAKE_LINK_SHLIB        = ld_so_aix

sipconfig.py has:
    'LINK':       'g++',
    'LINK_SHLIB': '/opt/TWWfsw/python25/lib/python2.5/config/ld_so_aix',

When building PyQt-4.6.2, I get link failures because LINK=g++, not the
overridden value from my patch. How do I force LINK to something
different for shared libs than programs?

-- 
albert chin (china at thewrittenword.com)
-------------- next part --------------
Index: siputils.py
===================================================================
--- siputils.py.orig	2009-12-23 20:40:58.430924601 +0000
+++ siputils.py	2009-12-23 20:41:25.533646186 +0000
@@ -172,6 +172,16 @@
         if value:
             self._macro.append(value)
 
+    def prepend(self, value):
+        """Prepend each element of a value to the macro.
+
+        value is the list of elements to prepend.
+        """
+        value_rev = value
+        value_rev.reverse()
+        for el in value_rev:
+            self._macro.insert(0, el)
+
     def extend(self, value):
         """Append each element of a value to the macro.
 
@@ -1410,12 +1420,18 @@
                     # g++ is used for linking.
                     # For SIP v4 and g++:
                     # 1.) Import the python symbols
-                    aix_lflags = ['-Wl,-bI:%s/python.exp' % self.config.py_lib_dir]
+                    aix_lflags = ['$(CXX)',
+                                  '-Wl,-bI:%s/python.exp' % self.config.py_lib_dir]
 
                     if self._limit_exports:
                         aix_lflags.append('-Wl,-bnoexpall')
                         aix_lflags.append('-Wl,-bnoentry')
                         aix_lflags.append('-Wl,-bE:%s.exp' % self._target)
+
+                    self.LFLAGS.prepend(aix_lflags)
+
+                    # Force the shared linker
+                    self.LINK.set('%s/ld_so_aix' % self.config.py_lib_dir)
                 else:
                     # IBM VisualAge C++ is used for linking.
                     # For SIP v4 and xlC:
@@ -1429,7 +1445,7 @@
                         aix_lflags.append('-bnoentry')
                         aix_lflags.append('-bE:%s.exp' % self._target)
 
-                self.LFLAGS.extend(aix_lflags)
+                    self.LFLAGS.extend(aix_lflags)
             else:
                 if self._limit_exports:
                     if sys.platform[:5] == 'linux':


More information about the PyQt mailing list