Skip to content

Commit 9fd22bc

Browse files
danbevrefack
authored andcommitted
build: fix ninja build failure (GYP patch)
Currently the files specified in libraries in node.gyp `cctest` target are getting a '.lib' extension on windows when generated with ninja. This commit adds a check to see if a file has a '.obj' extension and in that case no '.lib' extension will be added. Also, the LIBS specified in the 'libraries' section are not being included in the --start-group --end-group section which means that these libraries will not be searched causing issue with linkers where the order matters. PR-URL: #12484 Fixes: #12448 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent bb88cae commit 9fd22bc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

tools/gyp/pylib/gyp/generator/ninja.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2148,13 +2148,13 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
21482148
restat=True,
21492149
command=mtime_preserving_solink_base % {'suffix': '@$link_file_list'},
21502150
rspfile='$link_file_list',
2151-
rspfile_content='-Wl,--start-group $in -Wl,--end-group $solibs $libs',
2151+
rspfile_content='-Wl,--start-group $in $solibs $libs -Wl,--end-group',
21522152
pool='link_pool')
21532153
master_ninja.rule(
21542154
'link',
21552155
description='LINK $out',
21562156
command=('$ld $ldflags -o $out '
2157-
'-Wl,--start-group $in -Wl,--end-group $solibs $libs'),
2157+
'-Wl,--start-group $in $solibs $libs -Wl,--end-group'),
21582158
pool='link_pool')
21592159
elif flavor == 'win':
21602160
master_ninja.rule(

tools/gyp/pylib/gyp/msvs_emulation.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ def ConvertVSMacros(self, s, base_to_build=None, config=None):
269269
def AdjustLibraries(self, libraries):
270270
"""Strip -l from library if it's specified with that."""
271271
libs = [lib[2:] if lib.startswith('-l') else lib for lib in libraries]
272-
return [lib + '.lib' if not lib.endswith('.lib') else lib for lib in libs]
272+
return [lib + '.lib' if not lib.endswith('.lib') \
273+
and not lib.endswith('.obj') else lib for lib in libs]
273274

274275
def _GetAndMunge(self, field, path, default, prefix, append, map):
275276
"""Retrieve a value from |field| at |path| or return |default|. If

0 commit comments

Comments
 (0)