Skip to content

Commit c982c48

Browse files
committed
Use rpath to compile the cg_clif executable
1 parent bf94b38 commit c982c48

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ done
2828
# Build cg_clif
2929
unset CARGO_TARGET_DIR
3030
export RUSTFLAGS="-Zrun_dsymutil=no"
31+
unamestr=$(uname)
32+
if [[ "$unamestr" == 'Linux' ]]; then
33+
export RUSTFLAGS='-Clink-arg=-Wl,-rpath=$ORIGIN/../lib '$RUSTFLAGS
34+
elif [[ "$unamestr" == 'Darwin' ]]; then
35+
export RUSTFLAGS='-Clink-arg=-Wl,-rpath,@loader_path/../lib -Zosx-rpath-install-name '$RUSTFLAGS
36+
dylib_ext='dylib'
37+
else
38+
echo "Unsupported os"
39+
exit 1
40+
fi
3141
if [[ "$CHANNEL" == "release" ]]; then
3242
cargo build --release
3343
else

scripts/config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if [[ $(uname) == 'Darwin' ]]; then
5353
export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
5454
fi
5555

56-
export LD_LIBRARY_PATH="$dir/lib:$(rustc --print sysroot)/lib:$dir/target/out:$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib"
56+
export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib:$dir/target/out:$dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib"
5757
export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
5858

5959
export CG_CLIF_DISPLAY_CG_TIME=1

0 commit comments

Comments
 (0)