Dnia Wed, Sep 20, 2023 at 06:20:16PM +0800, Qian Yun napisał(a):
> When launching "FRICASsys" from terminal without environment variable
> "FRICAS" set, you get following message:
>
> Checking for foreign routines
> FRICAS=NIL
> spad-lib="/lib/libspad.so"
>
> Then it will look for "/lib/libspad.so" to load and will fail.
>
> It will affect functionalities like ")compile", because it will
> need the "remove_directory" C function.
>
> This can be a common scenario: during debugging, you may have
> multiple directories containing different "FRICASsys", it can
> be convenient to run the binary directly without setting different
> "FRICAS" first. Also this is the current status of our Windows
> distribution: we only have "bin/FRICASsys.exe" and "FRICAS" is not
> set in Windows environment variables.
>
> So the following patch is to deal with this case -- when "FRICAS"
> is not set. There is already logic in function "initroot" to set
> variable "$spadroot" by probing parent directory.
The code look fine. But I have mixed feeling about motivation.
Namely, if FRICAS is different than '$spadroot', then we are
going to have troubles sooner or later. On Linux when
debugging freshly build FriCAS I use command line like:
(export FRICAS=/sklad/fricas/axp1/fr-build92/target/x86_64-linux-gnu ;
$FRICAS/bin/fricas)
This is long, but is build using bash filename completition, so
is moderate amount of typing. And once build the command sits
in command history and is easy to recall.
Somewhat related to this: I am not sure if we want to support
running without 'libspad.so'. This was allowed because early
Sage packaged FriCAS used clisp without support for foreign
interface. It is not clear to me if there is real need now to
run without 'libspad.so'.
>
> ====
>
> diff --git a/src/interp/util.lisp b/src/interp/util.lisp
> index 63cd20f3..2a6219cd 100644
> --- a/src/interp/util.lisp
> +++ b/src/interp/util.lisp
> @@ -77,7 +77,7 @@
> ;;; It is set up in the {\bf reroot} function.
> (defvar $library-directory-list ())
>
> -;;; Prefix a filename with the {\bf FRICAS} shell variable.
> +;;; Prefix a filename with the {\bf $spadroot} variable.
> (defun make-absolute-filename (name)
> (concatenate 'string $spadroot name))
>
> @@ -88,13 +88,10 @@
> be {\bf \$spadroot}. The {\bf reroot} function will change the
> system to use a new root directory and will have the same effect
> as changing the {\bf FRICAS} shell variable and rerunning the system
> -from scratch. A correct call looks like:
> -\begin{verbatim}
> -(in-package "BOOT")
> -(reroot "${FRICAS}")
> -\end{verbatim}
> -where the [[${FRICAS}]] variable points to installed tree.
> +from scratch.
> |#
> +(defvar $spadroot "")
> +
> (defun reroot (dir)
> (setq $spadroot dir)
> (setq $directory-list
> @@ -267,10 +264,9 @@
> #+:GCL (system:gbc-time 0)
> #+(or :sbcl :clisp :openmcl :lispworks)
> (if *fricas-load-libspad*
> - (let* ((ax-dir (|getEnv| "FRICAS"))
> - (spad-lib (concatenate 'string ax-dir "/lib/libspad.so")))
> + (let ((spad-lib (make-absolute-filename "/lib/libspad.so")))
> (format t "Checking for foreign routines~%")
> - (format t "FRICAS=~S~%" ax-dir)
> + (format t "FRICAS=~S~%" $spadroot)
> (format t "spad-lib=~S~%" spad-lib)
> (if (|fricas_probe_file| spad-lib)
> (progn
> @@ -280,7 +276,7 @@
> (|quiet_load_alien| spad-lib)
> #+(or :sbcl :openmcl)
> (fricas-lisp::init-gmp
> - (concatenate 'string ax-dir "/lib/gmp_wrap.so"))
> + (make-absolute-filename "/lib/gmp_wrap.so"))
> #+(and :clisp :ffi)
> (progn
> (eval `(FFI:DEFAULT-FOREIGN-LIBRARY ,spad-lib))
>
> --
> You received this message because you are subscribed to the Google Groups
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/fricas-devel/96fede8a-cba3-4c4a-9a8f-665bfb93d656%40gmail.com.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/ZQtnxoFm2ZuOJ/Hf%40mail.math.uni.wroc.pl.