danielpclark / rutie

“The Tie Between Ruby and Rust.”
MIT License
939 stars 62 forks source link

Anything that involves accessing RbConfig fails with EXC BAD ACCESS #183

Open lockieluke opened 3 months ago

lockieluke commented 3 months ago

Minimal reproducible:

use rutie::{Module, VM};

fn main() {
    VM::init();

    let rbconfig = Module::from_existing("RbConfig");
    println!("{:?}", rbconfig);

    VM::exit(0);
}

Logs: image

Anything from require 'rbconfig' would fail with the same error, it did work at some point.

I have been using the macOS default Ruby from the very beginning and it does support SHARED

lockieluke commented 3 months ago

Can confirm if you load rbconfig with its absolute path, it'll work:

VM::require("/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin23/rbconfig.rb");
let bin_dir = unsafe { Module::from_existing("RbConfig").const_get("CONFIG").send("[]", &[RString::from("bindir").into()]).try_convert_to::<RString>().unwrap().to_string() };
println!("{}", bin_dir);

Output:

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin