-
Notifications
You must be signed in to change notification settings - Fork 821
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(runtime-c-api) Set the install name of the dylib to @rpath
.
#474
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```sh $ objdump -macho -dylib-id libwasmer_runtime_c_api.dylib libwasmer_runtime_c_api.dylib: /Users/distiller/project/target/release/deps/libwasmer_runtime_c_api.dylib ``` we observe that the dylib ID (aka install name) is set to `/Users/distiller/project/target/release/deps/libwasmer_runtime_c_api.dylib`, which is valid only in the context of CircleCI. This patch changes the dylib ID to `@rpath/libwasmer_runtime_c_api.dylib`, which can be then changed by the linker option `-rpath` (use `-Wl,-rpath,$value` with the compiler to send the `-rpath` value to the linker). This is super useful when dynamically linking libraries against another language.
Hywan
force-pushed
the
fix-runtime-c-api-dylib
branch
from
May 29, 2019 14:14
cc1a846
to
ff5d50b
Compare
Hywan
added a commit
to Hywan/go-ext-wasm
that referenced
this pull request
May 29, 2019
This patch depends on wasmerio/wasmer#474, which fixes the dylib ID for macOS to use `@rpath`. This patch renames the `just go` recipe to `just build`. The `just build` recipe compiles the Rust dynamic library only when required, i.e. when the `libwasmer_runtime_c_api.*` file is absent from the source tree. This patch also updates `bridge.go` to specify the `rpath` to the linker with `-Wl,-rpath`. On macOS, the solution would be to set `rpath` to `@executable_path` but since https://nvd.nist.gov/vuln/detail/CVE-2018-6574, some flags are disabled (see https://github.com/golang/go/wiki/InvalidFlag for more information). Hopefully for us, cgo has this special `${SRCDIR}` variable (see https://golang.org/cmd/cgo/#hdr-Using_cgo_with_the_go_command), which is a possible alternative.
bors try |
bjfish
approved these changes
May 29, 2019
bors r+ |
bors bot
added a commit
that referenced
this pull request
May 29, 2019
474: fix(runtime-c-api) Set the install name of the dylib to `@rpath`. r=Hywan a=Hywan ```sh $ objdump -macho -dylib-id libwasmer_runtime_c_api.dylib libwasmer_runtime_c_api.dylib: /Users/distiller/project/target/release/deps/libwasmer_runtime_c_api.dylib ``` we observe that the dylib ID (aka install name) is set to `/Users/distiller/project/target/release/deps/libwasmer_runtime_c_api.dylib`, which is valid only in the context of CircleCI. This patch changes the dylib ID to `@rpath/libwasmer_runtime_c_api.dylib`, which can be then changed by the linker option `-rpath` (use `-Wl,-rpath,$value` with the compiler to send the `-rpath` value to the linker). This is super useful when dynamically linking libraries against another language. Having the dylib ID already set to `@rpath` avoid any build system to call `install_name_tool` manually, which isn't always possible (e.g. in Go with cgo where we can only pass options to the compiler with `LDFLAGS`, it's impossible to run any arbitrary command). Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
bors bot
added a commit
to wasmerio/wasmer-go
that referenced
this pull request
May 29, 2019
12: feat(runtime) Use dynamic libraries instead of compiling the runtime r=Hywan a=Hywan Dependency: wasmerio/wasmer#474. This sequence of patches aims at using dynamic libraries for the runtime. It avoids the need to compile the runtime (with `rustc`/`cargo`) when installing the Go library. Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
we observe that the dylib ID (aka install name) is set to
/Users/distiller/project/target/release/deps/libwasmer_runtime_c_api.dylib
,which is valid only in the context of CircleCI.
This patch changes the dylib ID to
@rpath/libwasmer_runtime_c_api.dylib
, which can be then changed bythe linker option
-rpath
(use-Wl,-rpath,$value
with the compilerto send the
-rpath
value to the linker).This is super useful when dynamically linking libraries against
another language. Having the dylib ID already set to
@rpath
avoid anybuild system to call
install_name_tool
manually, which isn't alwayspossible (e.g. in Go with cgo where we can only pass options to the
compiler with
LDFLAGS
, it's impossible to run any arbitrary command).