Skip to content

Commit 3d9ad82

Browse files
danbevMylesBorins
authored andcommitted
gyp: 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 12191f6 commit 3d9ad82

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
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-2
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ def ConvertVSMacros(self, s, base_to_build=None, config=None):
273273
def AdjustLibraries(self, libraries):
274274
"""Strip -l from library if it's specified with that."""
275275
libs = [lib[2:] if lib.startswith('-l') else lib for lib in libraries]
276-
return [lib + '.lib' if not lib.lower().endswith('.lib') else lib
277-
for lib in libs]
276+
return [lib + '.lib' if not lib.lower().endswith('.lib') \
277+
and not lib.lower().endswith('.obj') else lib for lib in libs]
278278

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

0 commit comments

Comments
 (0)