Greetings, When building GCL 2.7 on various versions of macOS, I found that GCL needs to load different system libraries in different versions of macOS, and the Lisp function LIB-NAME defined in lsp/gcl_dl.lsp is used to compute the full path of these libraries from just the name.
Currently on macOS the code assumes that the needed library must be under "/usr/lib/system/". But this is only true for libraries like "libsystem_*.dylib". All other libraries, e.g. libSystem.B.dylib, is under "/usr/lib/". The following patch has been verified on all macOS versions from 10.6 to 15.x: diff --git a/lsp/gcl_dl.lsp b/lsp/gcl_dl.lsp index 6f6b35f44..4d8f9962e 100644 --- a/lsp/gcl_dl.lsp +++ b/lsp/gcl_dl.lsp @@ -3,9 +3,16 @@ (export '(mdlsym mdl lib-name)) +(defvar *dll-extension* #+darwin ".dylib" #+cygwin ".dll" #-(or darwin cygwin) ".so") + (defun lib-name (p) - (if (or (string= p "") (string= p "libc") (string= p "libm")) "" - (string-concatenate #+darwin "/usr/lib/system/" p #+darwin ".dylib" #+cygwin ".dll" #-(or darwin cygwin) ".so")));FIXME + (cond ((or (string= p "") (string= p "libc") (string= p "libm")) + "") + #+darwin ; "/usr/lib/system/" is macOS-specific + ((string<= "libsystem" p) + (string-concatenate "/usr/lib/system/" p *dll-extension*)) + (t + (string-concatenate #+darwin "/usr/lib/" p *dll-extension*)))) (defun mdl (n p vad) (let* ((sym (mdlsym n (lib-name p))) * * * Note also that, in the above patch, I defined a new variable *dll-extension* to eliminate some code duplication. This is unnecessary, and feel free to eliminate it. But I think it should be useful to have such a special variable exported in SI package, for users who needs to load dynamic libraries by just filename without extension name. --Chun
signature.asc
Description: OpenPGP digital signature
