-
Notifications
You must be signed in to change notification settings - Fork 5
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
Problem: absolute path inside dylib (fix #123) #124
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,10 @@ jobs: | |
- name: Build play-cpp-sdk library | ||
run: ./checkmac.sh && cargo build --package play-cpp-sdk --release --target x86_64-apple-darwin | ||
|
||
- name: Test building demo project | ||
working-directory: demo | ||
run: make x86_64_build_test | ||
|
||
- name: Build demo project | ||
working-directory: demo | ||
run: make x86_64_build | ||
|
@@ -40,6 +44,8 @@ jobs: | |
cp ./LICENSE build | ||
cp ./CHANGELOG.md build | ||
cd build | ||
install_name_tool -id @rpath/libplay_cpp_sdk.dylib ./lib/libplay_cpp_sdk.dylib | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we pack @rpath in CI for users, the binary will be used in demo (starts from a clean repository clone), so we should keep consistent in the setup: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, i'll modify There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think libplay_cpp_sdk.dylib should be delivered with @rpath, because it is not system dylib. |
||
otool -L ./lib/libplay_cpp_sdk.dylib | ||
tar zcvf ../play_cpp_sdk_${PLATFORM}.tar.gz * | ||
cd .. | ||
shasum -a 256 *.tar.gz > "checksums-$PLATFORM.txt" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,9 +53,17 @@ dynamic: easywsclient.o | |
$(FLAGS) \ | ||
-L lib \ | ||
|
||
x86_64_build: prepare_x86_64 easywsclient.o.x86_64 | ||
# test whether dylib loading correctly | ||
x86_64_test_dylib: | ||
./demo test | ||
|
||
x86_64_build: x86_64_build_static x86_64_build_dynamic | ||
|
||
x86_64_build_test:x86_64_build_dynamic x86_64_test_dylib | ||
|
||
x86_64_build_static: prepare_x86_64 easywsclient.o.x86_64 | ||
arch -x86_64 \ | ||
g++ -o demo \ | ||
g++ -o demostatic \ | ||
easywsclient.o \ | ||
main.cc \ | ||
chainmain.cc \ | ||
|
@@ -65,6 +73,35 @@ x86_64_build: prepare_x86_64 easywsclient.o.x86_64 | |
-std=c++14 \ | ||
$(FLAGS) | ||
|
||
# use -rpath option to add the path to the dynamic library loading path | ||
# -rpath lib in gcc or | ||
# install_name_tool -add_rpath @executable_path/lib ./demo | ||
# in mac, to use DYLD_LIBRARY_PATH, it is normalized to use $rpath in dylib | ||
x86_64_build_dynamic : prepare_x86_64 easywsclient.o.x86_64 | ||
install_name_tool -id @rpath/libplay_cpp_sdk.dylib ./lib/libplay_cpp_sdk.dylib | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. g++ has -install_name option. |
||
otool -L ./lib/libplay_cpp_sdk.dylib | ||
arch -x86_64 \ | ||
g++ -o demo \ | ||
easywsclient.o \ | ||
main.cc \ | ||
chainmain.cc \ | ||
cronos.cc \ | ||
extra.cc \ | ||
./include/walletconnectcallback.cc \ | ||
./include/nft.cc \ | ||
./include/pay.cc \ | ||
./include/defi-wallet-core-cpp/src/contract.rs.cc \ | ||
./include/defi-wallet-core-cpp/src/core.cc \ | ||
./include/defi-wallet-core-cpp/src/nft.rs.cc \ | ||
./include/defi-wallet-core-cpp/src/uint.rs.cc \ | ||
./include/extra-cpp-bindings/src/lib.rs.cc \ | ||
lib/libplay_cpp_sdk.dylib \ | ||
lib/libcxxbridge1.a \ | ||
-std=c++14 \ | ||
-rpath lib \ | ||
$(FLAGS) | ||
|
||
|
||
run_static: | ||
. ./.env && ./demostatic | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifying the path in packing probably has a side effect: the binary was not tested in integration test.
It is better to modify the
build.rs
or setup.cargo/config
and pass the the option to compiler: rust-lang/cargo#5077There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, i'm checking now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked with tag, now released with @rpath like this