diff options
| author | Omar Rizwan <omar@omar.website> | 2024-03-19 19:22:28 +0000 |
|---|---|---|
| committer | Omar Rizwan <omar@omar.website> | 2024-03-19 19:22:28 +0000 |
| commit | 3fc8f85c828d9dde9db826fdef8db0744ae674a3 (patch) | |
| tree | 20aa77d569a5c5b57d43d0916ce45368c6ec699c /lib | |
| parent | folk0: Stick with 720p for now (diff) | |
| download | folk-3fc8f85c828d9dde9db826fdef8db0744ae674a3.tar.gz folk-3fc8f85c828d9dde9db826fdef8db0744ae674a3.zip | |
Make loadlibLd, filter by architecture if multiple candidates
Fixes https://discord.com/channels/956758212152025098/956758650700046366/1202431317971570728
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/c.tcl | 12 | ||||
| -rw-r--r-- | lib/terminal.tcl | 2 |
2 files changed, 12 insertions, 2 deletions
@@ -524,9 +524,19 @@ namespace eval c { $loader compile proc loadlib {filename} { if {[loadlibImpl $filename] == "(void*) 0x0"} { - error "Failed to dlopen $filename: [loadlibError]" + error "c loadlib: Failed to dlopen $filename: [loadlibError]" } } + proc loadlibLd {libname} { + set candidates [split [exec /usr/sbin/ldconfig -p | grep $libname] "\n"] + if {[llength $candidates] == 0} { + error "c loadlibLd: Could not find library $libname" + } elseif {[llength $candidates] > 1} { + # Is it greater than 1? if so, filter by arch + set candidates [lsearch -all -inline $candidates *$::tcl_platform(machine)*] + } + loadlib [lindex $candidates 0 end] + } namespace export * namespace ensemble create diff --git a/lib/terminal.tcl b/lib/terminal.tcl index f81847e6..2ab8dd2d 100644 --- a/lib/terminal.tcl +++ b/lib/terminal.tcl @@ -63,7 +63,7 @@ set cc [c create] $cc cflags -I./vendor/libtmt ./vendor/libtmt/tmt.c if {$::tcl_platform(os) ne "Darwin"} { - c loadlib [lindex [exec /usr/sbin/ldconfig -p | grep libutil.so | head -1] end] + c loadlibLd libutil } $cc cflags -lutil |
