scons: Include flags required to link statically with Python
authorAndreas Sandberg <andreas@sandberg.pp.se>
Mon, 18 Mar 2013 09:22:21 +0000 (10:22 +0100)
committerAndreas Sandberg <andreas@sandberg.pp.se>
Mon, 18 Mar 2013 09:22:21 +0000 (10:22 +0100)
Python requires the flags in LINKFORSHARED to be added the linker
flags when linking with a statically with Python. Failing to do so can
lead to errors from the Python's dynamic module loader at start up.

--HG--
extra : rebase_source : e7a8daf72f4ede7ee5a4a5398a0b12e978a919b9

SConstruct

index a5a5986601cee3ccc1ca7786250f55d436c78e27..15e49fba42f6679e58474abed4b3be425c5d1225 100755 (executable)
@@ -839,6 +839,11 @@ py_lib_path = [ py_getvar('LIBDIR') ]
 # shared library in prefix/lib/.
 if not py_getvar('Py_ENABLE_SHARED'):
     py_lib_path.append(py_getvar('LIBPL'))
+    # Python requires the flags in LINKFORSHARED to be added the
+    # linker flags when linking with a statically with Python. Failing
+    # to do so can lead to errors from the Python's dynamic module
+    # loader at start up.
+    main.Append(LINKFLAGS=[py_getvar('LINKFORSHARED').split()])
 
 py_libs = []
 for lib in py_getvar('LIBS').split() + py_getvar('SYSLIBS').split():