JuliaLinearAlgebra / libblastrampoline

Using PLT trampolines to provide a BLAS and LAPACK demuxing library.
MIT License
66 stars 17 forks source link

Crash on Apple Silicon trying to use Accelerate #102

Closed ViralBShah closed 1 year ago

ViralBShah commented 1 year ago

I believe LBT should be able to detect the LP64 interface and forward those symbols.

julia> using LinearAlgebra

julia> using Libdl; libacc = dlopen("/System/Library/Frameworks/Accelerate.framework/Accelerate")
Ptr{Nothing} @0x00000003e1f58480

julia> BLAS.lbt_forward(libacc; clear=true, suffix_hint="")

signal (11): Segmentation fault: 11
in expression starting at REPL[3]:1
_ZN5dyld39MachOFile8trieWalkER11DiagnosticsPKhS4_PKc at /usr/lib/dyld (unknown line)
Allocations: 785624 (Pool: 785337; Big: 287); GC: 1
staticfloat commented 1 year ago

This is because lbt_forward takes in a path as a string, not an already-opened handle. Unfortunately, it appears that you can pass a Ptr{Cvoid} in as a Cstring without raising any alarms, which I did not know about. Perhaps we should change lbt_forward to take in path as an ::AbstractString to prevent this in the future.

ViralBShah commented 1 year ago

Sorry for the noise on this.