@@ -131,6 +131,13 @@ class UnixCCompiler(CCompiler):
131
131
if sys .platform [:6 ] == "darwin" :
132
132
executables ['ranlib' ] = ["ranlib" ]
133
133
134
+ # Nuitka: Make sure to use the original settings
135
+ executables ["compiler" ] = sysconfig .get_config_var ("CC" )
136
+ executables ["compiler_so" ] = sysconfig .get_config_var ("CC" )
137
+ executables ["compiler_cxx" ] = sysconfig .get_config_var ("CXX" )
138
+ executables ["linker_so" ] = sysconfig .get_config_var ("CC" )
139
+ executables ["linker_exe" ] = sysconfig .get_config_var ("CC" )
140
+
134
141
# Needed for the filename generation methods provided by the base
135
142
# class, CCompiler. NB. whoever instantiates/uses a particular
136
143
# UnixCCompiler instance should set 'shared_lib_ext' -- we set a
@@ -240,6 +247,7 @@ def link(
240
247
extra_postargs = None ,
241
248
build_temp = None ,
242
249
target_lang = None ,
250
+ extra_midargs = None ,
243
251
):
244
252
objects , output_dir = self ._fix_object_args (objects , output_dir )
245
253
fixed_args = self ._fix_lib_args (libraries , library_dirs , runtime_library_dirs )
@@ -252,11 +260,14 @@ def link(
252
260
output_filename = os .path .join (output_dir , output_filename )
253
261
254
262
if self ._need_link (objects , output_filename ):
255
- ld_args = objects + self .objects + lib_opts + [ '-o' , output_filename ]
263
+ ld_args = objects + self .objects
256
264
if debug :
257
265
ld_args [:0 ] = ['-g' ]
266
+ if extra_midargs :
267
+ ld_args += extra_midargs
258
268
if extra_preargs :
259
269
ld_args [:0 ] = extra_preargs
270
+ ld_args += lib_opts + ['-o' , output_filename ]
260
271
if extra_postargs :
261
272
ld_args .extend (extra_postargs )
262
273
self .mkpath (os .path .dirname (output_filename ))
@@ -265,6 +276,8 @@ def link(
265
276
# building an executable or linker_so (with shared options)
266
277
# when building a shared library.
267
278
building_exe = target_desc == CCompiler .EXECUTABLE
279
+ if not building_exe :
280
+ raise NotImplemented ("No shared libs in Nuitka-Python" )
268
281
linker = (
269
282
self .linker_exe
270
283
if building_exe
@@ -387,10 +400,10 @@ def find_library_file(self, dirs, lib, debug=False):
387
400
assume that *all* Unix C compilers do,
388
401
ignoring even GCC's "-static" option.
389
402
"""
390
- lib_names = (
403
+ lib_names = [ lib ] + [
391
404
self .library_filename (lib , lib_type = type )
392
405
for type in 'dylib xcode_stub shared static' .split ()
393
- )
406
+ ]
394
407
395
408
roots = map (self ._library_root , dirs )
396
409
0 commit comments