From 38cd04828c738fbcc563ff0827c43aecf1df4892 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 5 Aug 2014 14:38:46 +0200 Subject: [PATCH] libpython: don't link to Python core library on Linux --- src/libpython/SConscript | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/libpython/SConscript b/src/libpython/SConscript index af7a3bd4..74444e7d 100644 --- a/src/libpython/SConscript +++ b/src/libpython/SConscript @@ -2,14 +2,20 @@ Import('env', 'sys', 'os', 'hasPython') for ver in hasPython: sver = ver.replace('.', '') + python_include = list(env['PYTHON'+sver+'INCLUDE']) if env.has_key('PYTHON'+sver+'INCLUDE') else [] + python_libdir = list(env['PYTHON'+sver+'LIBDIR']) if env.has_key('PYTHON'+sver+'LIBDIR') else [] + python_lib = list(env['PYTHON'+sver+'LIB']) if env.has_key('PYTHON'+sver+'LIB') else [] + + if 'linux' in sys.platform: + # On Linux, don't link to the core Python library. The associated symbols will be resolved + # when the plugin is imported into a running interpreter + python_lib = [ lib for lib in python_lib if not lib.startswith('python') ] pythonEnv = env.Clone() - if pythonEnv.has_key('PYTHON'+sver+'INCLUDE'): - pythonEnv.Prepend(CPPPATH=pythonEnv['PYTHON'+sver+'INCLUDE']) - if pythonEnv.has_key('PYTHON'+sver+'LIBDIR'): - pythonEnv.Prepend(LIBPATH=pythonEnv['PYTHON'+sver+'LIBDIR']) - if pythonEnv.has_key('PYTHON'+sver+'LIB'): - pythonEnv.Prepend(LIBS=pythonEnv['PYTHON'+sver+'LIB']) + pythonEnv.Prepend(CPPPATH=python_include) + pythonEnv.Prepend(LIBPATH=python_libdir) + pythonEnv.Prepend(LIBS=python_lib) + pythonEnv.Append(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_PYTHON']]) pythonEnv['SHLIBPREFIX']=''