Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: resolve issue with relative paths during linking #284

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/InputFormatReference.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ lists associated with the following keys, are treated as pathnames:
* include\_dirs
* inputs
* libraries
* library\_dirs
* outputs
* sources
* mac\_bundle\_resources
Expand Down Expand Up @@ -231,7 +232,8 @@ Source dictionary from `../build/common.gypi`:
```
{
'include_dirs': ['include'], # Treated as relative to ../build
'libraries': ['-lz'], # Not treated as a pathname, begins with a dash
'library_dirs': ['lib'], # Treated as relative to ../build
'libraries': ['-lz'], # Not treated as a pathname, begins with a dash
'defines': ['NDEBUG'], # defines does not contain pathnames
}
```
Expand All @@ -250,6 +252,7 @@ Merged dictionary:
{
'sources': ['string_util.cc'],
'include_dirs': ['../build/include'],
'library_dirs': ['../build/lib'],
'libraries': ['-lz'],
'defines': ['NDEBUG'],
}
Expand Down
3 changes: 2 additions & 1 deletion pylib/gyp/generator/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,8 @@ def WriteTarget(
# into the link command, so we need lots of escaping.
ldflags.append(r"-Wl,-rpath=\$$ORIGIN/")
ldflags.append(r"-Wl,-rpath-link=\$(builddir)/")
library_dirs = config.get("library_dirs", [])
if library_dirs := config.get("library_dirs", []):
library_dirs = [Sourceify(self.Absolutify(i)) for i in library_dirs]
ldflags += [("-L%s" % library_dir) for library_dir in library_dirs]
self.WriteList(ldflags, "LDFLAGS_%s" % configname)
if self.flavor == "mac":
Expand Down
Loading