From 1fabf07143227bf2d652cdea7344f53f021155e7 Mon Sep 17 00:00:00 2001 From: qwerty2501 <939468+qwerty2501@users.noreply.github.com> Date: Sun, 24 Jul 2022 14:35:13 +0900 Subject: [PATCH] =?UTF-8?q?[Rust]RPATH=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=82=92?= =?UTF-8?q?=E3=81=97=E3=81=9F=20(#203)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * RPATHの設定をした * build.rs で設定できるようになったので不要な処理を削除 --- .github/workflows/build_and_deploy.yml | 4 ---- crates/voicevox_core/build.rs | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 775806052..c8000d0b4 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -90,10 +90,6 @@ jobs: cp -v -n target/${{ matrix.target }}/release/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.*.dylib "artifact/${{ env.ASSET_NAME }}" || true cp -v README.md "artifact/${{ env.ASSET_NAME }}/README.txt" echo "${{ env.VERSION }}" > "artifact/${{ env.ASSET_NAME }}/VERSION" - - name: Set libcore.dylib's identification name (macOS) - if: startsWith(matrix.os, 'macos') - shell: bash - run: install_name_tool -id "@rpath/libcore.dylib" "artifact/${{ env.ASSET_NAME }}/libcore.dylib" - name: Code signing (Windows) if: startsWith(matrix.os, 'windows') && github.event.inputs.code_signing == 'true' shell: bash diff --git a/crates/voicevox_core/build.rs b/crates/voicevox_core/build.rs index 27aba7049..b86dafff7 100644 --- a/crates/voicevox_core/build.rs +++ b/crates/voicevox_core/build.rs @@ -41,6 +41,12 @@ __declspec(dllimport) cbindgen::generate_with_config(&crate_dir, config) .unwrap() .write_to_file(&output_file); + + #[cfg(target_os = "linux")] + println!("cargo:rustc-link-arg=-Wl,-rpath,$ORIGIN"); + + #[cfg(target_os = "macos")] + println!("cargo:rustc-link-arg=-Wl,-install_name,@rpath/libcore.dylib"); } fn target_dir() -> PathBuf { PathBuf::from(env::var("CARGO_WORKSPACE_DIR").unwrap()).join("target")