Re: Trouble running matlisp on Ubuntu with Allegro

Eric Timmons <[email protected]> Fri, 27 May 2011 16:06:47 -0400
Newsgroups gmane.lisp.matlisp.user
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------040103060609060704010600
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Here's the patch for the version of lazy-loader I'm currently using. You 
can see a bit of the hackishness I mentioned earlier for the stuff 
dealing with Windows. I'm not too familiar with using linkers and the 
one I used (from MinGW) produced a DLL without absolute pathnames to 
some of the dependencies, hence the need to actually chdir into the 
folder with the dll I'm trying to load. That's what I'm going to 
hopefully fix before writing the info on installing on Windows.

I didn't have to put any extra arguments into the load function for 
either Ubuntu or Windows. Perhaps that's where some of my problems come 
from.

-Eric

On 5/26/2011 10:30 AM, Raymond Toy wrote:
>>>>>> "Eric" == Eric Timmons<[email protected]>  writes:
>
>      Eric>  I can definitely write something up on how to install on Windows. My
>      Eric>  solution was a little hackish so expect to see something once I've gone
>      Eric>  back to try and make it better.
>
> That would be great!
>
>      Eric>  I am using the full version of Allegro 8.1 on both the Windows and
>      Eric>  Ubuntu machines.
>
> Can you send me a patch for lazy-loader.lisp.in to support Allegro?  I
> have an idea of what it should be, but I'd like to compare it with
> what you did.
>
> Ray
>
>
> ------------------------------------------------------------------------------
> vRanger cuts backup time in half-while increasing security.
> With the market-leading solution for virtual backup and recovery,
> you get blazing-fast, flexible, and affordable data protection.
> Download your free trial now.
> http://p.sf.net/sfu/quest-d2dcopy1
> _______________________________________________
> Matlisp-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matlisp-users

--------------040103060609060704010600
Content-Type: text/plain;
 name="0002-lazy-loader.lisp.in-for-Allegro.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="0002-lazy-loader.lisp.in-for-Allegro.patch"

>From 467c697f4f6c0f6043ced128c393df894f422b06 Mon Sep 17 00:00:00 2001
From: Eric Timmons <[email protected]>
Date: Fri, 27 May 2011 15:56:20 -0400
Subject: [PATCH 2/2] lazy-loader.lisp.in for Allegro.

---
 lib/lazy-loader.lisp.in |   54 +++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/lib/lazy-loader.lisp.in b/lib/lazy-loader.lisp.in
index 9aa94a2..1ca01a9 100644
--- a/lib/lazy-loader.lisp.in
+++ b/lib/lazy-loader.lisp.in
@@ -202,8 +202,36 @@
 
 #+:allegro
 (defun load-blas-&-lapack-libraries ()
-  #+(or :unix :linux) (load "matlisp:lib;libmatlisp.so")
-  #+:mswindows (load "matlisp:lib;libmatlisp.dll"))
+  #+:linux86-64 (progn 
+				  ;; Load the libraries.
+				  (load "matlisp:lib;linux64;libdfftpack.so")
+				  (load "matlisp:lib;linux64;libtoms715.so")
+				  (load "matlisp:lib;linux64;libblas.so")
+				  (load "matlisp:lib;linux64;liblapack.so"))
+  #+:microsoft-32 (progn 
+					;; The libblas and liblapack have dependencies that need to be satisfied.
+					;; It's annoying, but the easiest way I know to do it is change into the directory
+					;; when attempting to load the dll.
+					(let ((old-dir (excl:current-directory)))
+					  ;; Change to the win32 directory.
+					  (excl:chdir "matlisp:lib;win32;")
+					  ;; Load the libraries.
+					  (load "./libblas.dll")
+					  (load "./liblapack.dll")
+					  ;; Change back.
+					  (excl:chdir old-dir)))
+  #+:microsoft-64 (progn 
+					;; The libblas and liblapack have dependencies that need to be satisfied.
+					;; It's annoying, but the easiest way I know to do it is change into the directory
+					;; when attempting to load the dll.
+					(let ((old-dir (excl:current-directory)))
+					  ;; Change to the win64 directory.
+					  (excl:chdir "matlisp:lib;win64;")
+					  ;; Load the libraries.
+					  (load "./libblas64.dll")
+					  (load "./liblapack64.dll")
+					  ;; Change back.
+					  (excl:chdir old-dir))))
 
 )
 
@@ -220,11 +248,29 @@
 
 #+(and :allegro (not :mswindows))
 (defun unload-blas-&-lapack-libraries ()
-  (ff:unload-foreign-library "matlisp:lib;libmatlisp.so"))
+  (ff:unload-foreign-library "matlisp:lib;linux64;libdfftpack.so")
+  (ff:unload-foreign-library "matlisp:lib;linux64;libtoms715.so")
+  (ff:unload-foreign-library "matlisp:lib;linux64;libblas.so")
+  (ff:unload-foreign-library "matlisp:lib;linux64;liblapack.so"))
 
 #+(and :allegro :mswindows)
 (defun unload-blas-&-lapack-libraries ()
-  (ff:unload-foreign-library "matlisp:lib;libmatlisp.dll"))
+  #+:microsoft-32 (let ((old-dir (excl:current-directory)))
+					  ;; Change to the win32 directory.
+					  (excl:chdir "matlisp:lib;win32;")
+					  ;; Unload the libraries.
+					  (ff:unload-foreign-library "./liblapack.dll")
+					  (ff:unload-foreign-library "./libblas.dll")
+					  ;; Change back.
+					  (excl:chdir old-dir))
+  #+:microsoft-64 (let ((old-dir (excl:current-directory)))
+					  ;; Change to the win64 directory.
+					  (excl:chdir "matlisp:lib;win64;")
+					  ;; Unload the libraries.
+					  (ff:unload-foreign-library "./liblapack64.dll")
+					  (ff:unload-foreign-library "./libblas64.dll")
+					  ;; Change back.
+					  (excl:chdir old-dir)))
 
 
 (eval-when (:load-toplevel :execute)
-- 
1.7.4.msysgit.0


--------------040103060609060704010600
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
--------------040103060609060704010600
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Matlisp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matlisp-users

--------------040103060609060704010600--