Skip to content

Commit

Permalink
gyp: fix ninja build failure (GYP patch)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
danbev authored and MylesBorins committed Sep 12, 2017
1 parent 12191f6 commit 3d9ad82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tools/gyp/pylib/gyp/generator/ninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -2148,13 +2148,13 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
restat=True,
command=mtime_preserving_solink_base % {'suffix': '@$link_file_list'},
rspfile='$link_file_list',
rspfile_content='-Wl,--start-group $in -Wl,--end-group $solibs $libs',
rspfile_content='-Wl,--start-group $in $solibs $libs -Wl,--end-group',
pool='link_pool')
master_ninja.rule(
'link',
description='LINK $out',
command=('$ld $ldflags -o $out '
'-Wl,--start-group $in -Wl,--end-group $solibs $libs'),
'-Wl,--start-group $in $solibs $libs -Wl,--end-group'),
pool='link_pool')
elif flavor == 'win':
master_ninja.rule(
Expand Down
4 changes: 2 additions & 2 deletions tools/gyp/pylib/gyp/msvs_emulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ def ConvertVSMacros(self, s, base_to_build=None, config=None):
def AdjustLibraries(self, libraries):
"""Strip -l from library if it's specified with that."""
libs = [lib[2:] if lib.startswith('-l') else lib for lib in libraries]
return [lib + '.lib' if not lib.lower().endswith('.lib') else lib
for lib in libs]
return [lib + '.lib' if not lib.lower().endswith('.lib') \
and not lib.lower().endswith('.obj') else lib for lib in libs]

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

0 comments on commit 3d9ad82

Please sign in to comment.