From 064f1653fd230e449fe9e7c167b420d1340f8b39 Mon Sep 17 00:00:00 2001 From: Sam Lijin Date: Mon, 22 Jul 2024 22:18:41 -0700 Subject: [PATCH] try to link against the mise install of ruby --- engine/language_client_ruby/ext/ruby_ffi/build.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/engine/language_client_ruby/ext/ruby_ffi/build.rs b/engine/language_client_ruby/ext/ruby_ffi/build.rs index 299662bdb..11a8cfa68 100644 --- a/engine/language_client_ruby/ext/ruby_ffi/build.rs +++ b/engine/language_client_ruby/ext/ruby_ffi/build.rs @@ -1,3 +1,5 @@ +use std::process::Command; + pub fn main() { // This is derived from the rustc commands that 'rake compile' runs, e.g. // @@ -5,5 +7,18 @@ pub fn main() { // // You need to run 'rake compile' from language_client_ruby itself to see these paths. + match Command::new("mise").args(["where", "ruby"]).output() { + Ok(output) => { + let ruby_path = String::from_utf8_lossy(&output.stdout).trim().to_string(); + println!("cargo:rustc-link-search=native={}/lib", ruby_path); + } + Err(e) => { + println!( + "cargo:rustc-warning=Failed to execute 'mise where ruby': {}", + e + ); + } + } + println!("cargo:rustc-link-arg=-Wl,-undefined,dynamic_lookup"); }