File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020import string , re , os
2121from types import *
2222from copy import copy
23+ from distutils import sysconfig
2324from distutils .dep_util import newer
2425from distutils .ccompiler import \
2526 CCompiler , gen_preprocess_options , gen_lib_options
@@ -249,7 +250,23 @@ def library_dir_option (self, dir):
249250 return "-L" + dir
250251
251252 def runtime_library_dir_option (self , dir ):
252- return "-R" + dir
253+ # XXX Hackish, at the very least. See Python bug #445902:
254+ # http://sourceforge.net/tracker/index.php
255+ # ?func=detail&aid=445902&group_id=5470&atid=105470
256+ # Linkers on different platforms need different options to
257+ # specify that directories need to be added to the list of
258+ # directories searched for dependencies when a dynamic library
259+ # is sought. GCC has to be told to pass the -R option through
260+ # to the linker, whereas other compilers just know this.
261+ # Other compilers may need something slightly different. At
262+ # this time, there's no way to determine this information from
263+ # the configuration data stored in the Python installation, so
264+ # we use this hack.
265+ compiler = os .path .basename (sysconfig .get_config_var ("CC" ))
266+ if compiler == "gcc" or compiler == "g++" :
267+ return "-Wl,-R" + dir
268+ else :
269+ return "-R" + dir
253270
254271 def library_option (self , lib ):
255272 return "-l" + lib
You can’t perform that action at this time.
0 commit comments