Re: Starting FriCAS not in the $HOME directory

Camm Maguire <[email protected]> Thu, 29 May 2025 16:23:45 -0400
Newsgroups gmane.comp.mathematics.algebra.fricas.devel,gmane.lisp.gcl.devel
Message-ID <[email protected]>
Greetings!

Gr=C3=A9gory Vanuxem <[email protected]> writes:

> Hi Waldek,
>
> Many thanks for this quick response and fix. Just tested on official FriC=
AS and the 2 problems you mentioned previously gone away.
>
> The .fricas.input file is still not "read" but for my mid-term work it is=
 not a big problem, my startup file is just displaying computation times an=
d augmenting line
> length of output to 110. Maybe this is related to my Kali distribution on=
 WSL2, I don't know.
>
> The )read command is to blame on my settings:
>
> (1) -> )sys pws
>
>    >> System error:
>    INTERNAL-SIMPLE-ERROR: The assertion !posix_spawnp(&pid, *p1, &file_ac=
tions, &attr, (void *)p1, environ) on line 65 of o/unixsys.c in function vs=
ystem failed:
> No such file or directory
>
> (1) -> )sys pwd
> /home/greg
> (1) -> )sys ls -l .fricas.input
> -rw-r--r-- 1 greg greg 35 Feb 11 09:42 .fricas.input
> (1) -> )read .fricas.input
>
>    The file .fricas.input is needed but does not exist.
>
> BTW great improvements have been done for gcl-2.7.1, thanks to you and
> Camm, it's a very good thing for me since I plan to code a wrapper in
> Common Lisp using my C wrapper to Julia compatible with GCL. I did one
> for Axiom in the past, a coding LISP game for me containing only
> "and", "or "and "not" keywords (no

Most happy to see a satisfied customer!

> loops or conditionals). A direct wrapper to Fortran BLAS in fact. Now
> I have to look at documentation changes for the GCL-2.7 series FFI.
>

I turn your attention to defdlfun.  In 2.7.x we can establish persistent
(across image saves) bindings to new external shared libraries on the
fly, with the call overhead being a single pointer dereference:


>(describe 'defdlfun)

DEFDLFUN - internal symbol in COMMON-LISP-USER package
From ((DEFDLFUN . External Shared Libraries) gcl-si.info):

 -- Macro: DEFDLFUN
     Package:SYSTEM

     Syntax:
          (compile (DEFDLFUN {RETURN NAME &optional LIBNAME) ARGS*))

     GCL specific: Produces an entry function to function NAME in
     external shared library LIBNAME with the specified args/return
     signature.  This function must be compiled to run.  When inlined,
     the function call collapses to a single reference to a pointer
     which is automatically updated to the location of the external
     function at image startup.  The connection to the external library
     is persistent across image saves and re-executions.  The RETURN and
     ARGS specifiers are keywords from the following list corresponding
     to the accompanying C programming types:

     :char :short :int :long :float :double

     Unsigned versions available are:

     :uchar :ushort :uint

     Complex float and complex double types can be access via:

     :fcomplex :dcomples

     Pointers to types available are

     :void* :char* :long* :float* :double*

     Example usage:


         =20
         =20
          GCL (GNU Common Lisp)  2.7.0 Thu Oct 26 12:00:01 PM EDT 2023  CLt=
L1    git: Version_2_7_0pre38
          Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
          Binary License:  GPL due to GPL'ed components: (XGCL READLINE UNE=
XEC)
          Modifications of this banner must retain notice of a compatible l=
icense
          Dedicated to the memory of W. Schelter
         =20
          Use (help) to get some basic information on how to use GCL.
          Temporary directory for compiler files set to /tmp/
         =20
          >(do-symbols (s :lib) (print s))
         =20
          LIB:|libm|
          LIB:|libc|
          NIL
         =20
          >(compile (si::defdlfun (:double "cblas_ddot" "libblas.so") :uint=
 :double* :uint :double* :uint))
         =20
          ;; Compiling /tmp/gazonk_653784_0.lsp.
          ;; End of Pass 1.
          ;; End of Pass 2.
          OPTIMIZE levels: Safety=3D0 (No runtime error checking), Space=3D=
0, Speed=3D3
          ;; Finished compiling /tmp/gazonk_653784_0.o.
          ;; Loading #P"/tmp/gazonk_653784_0.o"
          ;; start address for /tmp/gazonk_653784_0.o 0x2700860
          ;; Finished loading #P"/tmp/gazonk_653784_0.o"
          #<function 0000000001a4a860>
          NIL
          NIL
         =20
          >(do-symbols (s :lib) (print s))
         =20
          LIB:|libblas|
          LIB:|libm|
          LIB:|libc|
          NIL
         =20
          >(do-symbols (s 'lib::|libblas|) (unless (find-symbol (symbol-nam=
e s) :user) (print s)))
         =20
          |libblas|:|cblas_ddot|
          NIL
          NIL
         =20
          >(setq a (make-array 3 :element-type 'long-float) b (make-array 3=
 :element-type 'long-float))
         =20
          #(0.0 0.0 0.0)
         =20
          >(setf (aref a 1) 1.2 (aref b 1) 2.3)
         =20
          2.3
         =20
          >(|libblas|:|cblas_ddot| 3 a 1 b 1)
         =20
          2.76
         =20
          >(compile (defun foo (a b) (declare ((vector long-float) a b)) (|=
libblas|:|cblas_ddot| (length a) a 1 b 1)))
         =20
          ;; Compiling /tmp/gazonk_653784_0.lsp.
          ;; End of Pass 1.
          ;; End of Pass 2.
          OPTIMIZE levels: Safety=3D0 (No runtime error checking), Space=3D=
0, Speed=3D3
          ;; Finished compiling /tmp/gazonk_653784_0.o.
          ;; Loading #P"/tmp/gazonk_653784_0.o"
          ;; start address for /tmp/gazonk_653784_0.o 0x2715050
          ;; Finished loading #P"/tmp/gazonk_653784_0.o"
          #<function 0000000001a62140>
          NIL
          NIL
         =20
          >(compile (defun bar (a b) (declare (inline |libblas|:|cblas_ddot=
|) ((vector long-float) a b)) (|libblas|:|cblas_ddot| (length a) a 1 b 1)))
         =20
          ;; Compiling /tmp/gazonk_653784_0.lsp.
          ;; End of Pass 1.
          ;; End of Pass 2.
          OPTIMIZE levels: Safety=3D0 (No runtime error checking), Space=3D=
0, Speed=3D3
          ;; Finished compiling /tmp/gazonk_653784_0.o.
          ;; Loading #P"/tmp/gazonk_653784_0.o"
          ;; start address for /tmp/gazonk_653784_0.o 0x2729570
          ;; Finished loading #P"/tmp/gazonk_653784_0.o"
          #<function 0000000001a62740>
          NIL
          NIL
         =20
          >(foo a b)
         =20
          2.76
         =20
          >(bar a b)
         =20
          2.76
         =20
          >(setq compiler::*disassemble-objdump* nil)
         =20
          NIL
         =20
          >(disassemble '|libblas|:|cblas_ddot|)
         =20
          ;; Compiling /tmp/gazonk_653784_0.lsp.
          ;; End of Pass 1.
          ;; End of Pass 2.
          OPTIMIZE levels: Safety=3D0 (No runtime error checking), Space=3D=
0, Speed=3D3
          ;; Finished compiling /tmp/gazonk_653784_0.o.
         =20
          #include "gazonk_653784_0.h"
          void init_code(){do_init((void *)VV);}
          /*	local entry for function libblas::cblas_ddot	*/
         =20
          static object LI1__cblas_ddot___gazonk_653784_0(fixnum V6,object =
V7,fixnum V8,object V9,fixnum V10)
          {	 VMB1 VMS1 VMV1
          	if(!(((char)tp0(make_fixnum(V6)))=3D=3D(1))){
          	goto T8;
          	}
          	if(!((0)<=3D(V6))){
          	goto T13;
          	}
          	if(!((V6)<=3D((fixnum)4294967295))){
          	goto T11;
          	}
          	goto T12;
         =20
          	goto T13;
          T13:;
          	goto T11;
         =20
          	goto T12;
          T12:;
          	goto T7;
         =20
          	goto T11;
          T11:;
          	goto T6;
         =20
          	goto T8;
          T8:;
          	goto T6;
         =20
          	goto T7;
          T7:;
          	goto T5;
         =20
          	goto T6;
          T6:;
          	goto T3;
         =20
          	goto T5;
          T5:;
          	goto T2;
         =20
          	goto T3;
          T3:;
          	V11=3D CMPmake_fixnum(V6);
          	V6=3D fixint((fcall.argd=3D4,/* SYSTEM::CHECK-TYPE-SYMBOL */(obj=
ect )(*LnkLI2)(((object)VV[1]),(V11),((object)VV[2]),Cnil)));
          	goto T2;
          T2:;
          	switch(tp6(V7)){
          	case 428:
          	goto T27;
          T27:;
          	case 492:
          	goto T28;
          T28:;
          	goto T25;
         =20
          	default:
          	goto T29;
          T29:;
          	goto T24;
         =20
          	goto T24;
          	}
          	goto T24;
         =20
          	goto T25;
          T25:;
          	goto T23;
         =20
          	goto T24;
          T24:;
          	goto T22;
         =20
          	goto T23;
          T23:;
          	goto T21;
         =20
          	goto T22;
          T22:;
          	goto T19;
         =20
          	goto T21;
          T21:;
          	goto T18;
         =20
          	goto T19;
          T19:;
          	V7=3D (fcall.argd=3D4,/* SYSTEM::CHECK-TYPE-SYMBOL */(object )(*=
LnkLI2)(((object)VV[3]),(V7),((object)VV[4]),Cnil));
          	goto T18;
          T18:;
          	if(!(((char)tp0(make_fixnum(V8)))=3D=3D(1))){
          	goto T39;
          	}
          	if(!((0)<=3D(V8))){
          	goto T44;
          	}
          	if(!((V8)<=3D((fixnum)4294967295))){
          	goto T42;
          	}
          	goto T43;
         =20
          	goto T44;
          T44:;
          	goto T42;
         =20
          	goto T43;
          T43:;
          	goto T38;
         =20
          	goto T42;
          T42:;
          	goto T37;
         =20
          	goto T39;
          T39:;
          	goto T37;
         =20
          	goto T38;
          T38:;
          	goto T36;
         =20
          	goto T37;
          T37:;
          	goto T34;
         =20
          	goto T36;
          T36:;
          	goto T33;
         =20
          	goto T34;
          T34:;
          	V12=3D CMPmake_fixnum(V8);
          	V8=3D fixint((fcall.argd=3D4,/* SYSTEM::CHECK-TYPE-SYMBOL */(obj=
ect )(*LnkLI2)(((object)VV[5]),(V12),((object)VV[2]),Cnil)));
          	goto T33;
          T33:;
          	switch(tp6(V9)){
          	case 428:
          	goto T58;
          T58:;
          	case 492:
          	goto T59;
          T59:;
          	goto T56;
         =20
          	default:
          	goto T60;
          T60:;
          	goto T55;
         =20
          	goto T55;
          	}
          	goto T55;
         =20
          	goto T56;
          T56:;
          	goto T54;
         =20
          	goto T55;
          T55:;
          	goto T53;
         =20
          	goto T54;
          T54:;
          	goto T52;
         =20
          	goto T53;
          T53:;
          	goto T50;
         =20
          	goto T52;
          T52:;
          	goto T49;
         =20
          	goto T50;
          T50:;
          	V9=3D (fcall.argd=3D4,/* SYSTEM::CHECK-TYPE-SYMBOL */(object )(*=
LnkLI2)(((object)VV[6]),(V9),((object)VV[4]),Cnil));
          	goto T49;
          T49:;
          	if(!(((char)tp0(make_fixnum(V10)))=3D=3D(1))){
          	goto T70;
          	}
          	if(!((0)<=3D(V10))){
          	goto T75;
          	}
          	if(!((V10)<=3D((fixnum)4294967295))){
          	goto T73;
          	}
          	goto T74;
         =20
          	goto T75;
          T75:;
          	goto T73;
         =20
          	goto T74;
          T74:;
          	goto T69;
         =20
          	goto T73;
          T73:;
          	goto T68;
         =20
          	goto T70;
          T70:;
          	goto T68;
         =20
          	goto T69;
          T69:;
          	goto T67;
         =20
          	goto T68;
          T68:;
          	goto T65;
         =20
          	goto T67;
          T67:;
          	goto T64;
         =20
          	goto T65;
          T65:;
          	V13=3D CMPmake_fixnum(V10);
          	V10=3D fixint((fcall.argd=3D4,/* SYSTEM::CHECK-TYPE-SYMBOL */(ob=
ject )(*LnkLI2)(((object)VV[7]),(V13),((object)VV[2]),Cnil)));
          	goto T64;
          T64:;
          	{object V14 =3D make_longfloat(((double(*)(uint,double*,uint,dou=
ble*,uint))(dlcblas_ddot))((uint)V6,(double*)V7->v.v_self,(uint)V8,(double*=
)V9->v.v_self,(uint)V10));
          	VMR1(V14);}
          }
          static object  LnkTLI2(object first,...){object V1;va_list ap;va_=
start(ap,first);V1=3D(object )call_proc_new(((object)VV[0]),0,262147,(void =
**)(void *)&LnkLI2,0,first,ap);va_end(ap);return V1;} /* SYSTEM::CHECK-TYPE=
-SYMBOL */
          (9 (MAPC 'EVAL *COMPILER-COMPILE-DATA*))
          static object LI1__cblas_ddot___gazonk_653784_0(fixnum V6,object =
V7,fixnum V8,object V9,fixnum V10)
          ;
          static void *dlcblas_ddot;
          #define VMB1  object  V13 ,V12 ,V11;
          #define VMS1
          #define VMV1
          #define VMRV1(a_,b_) return((object )a_);
          #define VMR1(a_) VMRV1(a_,0);
          #define VM1 0
          static void * VVi[9]=3D{
          #define Cdata VV[8]
          (void *)(&dlcblas_ddot),
          (void *)(LI1__cblas_ddot___gazonk_653784_0)
          };
          #define VV (VVi)
          static object  LnkTLI2(object,...);
          static object  (*LnkLI2)() =3D (object (*)()) LnkTLI2;
          NIL
         =20
          >(disassemble 'foo)
         =20
          ;; Compiling /tmp/gazonk_653784_0.lsp.
          ;; End of Pass 1.
          ;; End of Pass 2.
          OPTIMIZE levels: Safety=3D0 (No runtime error checking), Space=3D=
0, Speed=3D3
          ;; Finished compiling /tmp/gazonk_653784_0.o.
         =20
          #include "gazonk_653784_0.h"
          void init_code(){do_init((void *)VV);}
          /*	local entry for function COMMON-LISP-USER::FOO	*/
         =20
          static object LI1__FOO___gazonk_653784_0(object V3,object V4)
          {	 VMB1 VMS1 VMV1
          	if(!(((char)((fixnum)((uchar*)((fixnum)V3))[(fixnum)2]&(fixnum)1=
))=3D=3D(0))){
          	goto T5;
          	}
          	goto T2;
         =20
          	goto T5;
          T5:;
          	V5=3D ((fixnum)((uint*)((fixnum)V3))[(fixnum)4]&268435455);
          	goto T1;
         =20
          	goto T2;
          T2:;
          	V5=3D (((fixnum)((uint*)((fixnum)V3))[(fixnum)1]>>(fixnum)3)&268=
435455);
          	goto T1;
          T1:;
          	{object V6 =3D (/* libblas::cblas_ddot */(object )(*LnkLI2)(V5,(=
V3),(fixnum)1,(V4),(fixnum)1));
          	VMR1(V6);}
          }
          static object  LnkTLI2(object first,...){object V1;va_list ap;va_=
start(ap,first);V1=3D(object )call_proc_new(((object)VV[0]),0,5,(void **)(v=
oid *)&LnkLI2,1092,first,ap);va_end(ap);return V1;} /* libblas::cblas_ddot =
*/
          (2 (MAPC 'EVAL *COMPILER-COMPILE-DATA*))
          static object LI1__FOO___gazonk_653784_0(object V3,object V4)
          ;
          #define VMB1  fixnum  V5;
          #define VMS1
          #define VMV1
          #define VMRV1(a_,b_) return((object )a_);
          #define VMR1(a_) VMRV1(a_,0);
          #define VM1 0
          static void * VVi[2]=3D{
          #define Cdata VV[1]
          (void *)(LI1__FOO___gazonk_653784_0)
          };
          #define VV (VVi)
          static object  LnkTLI2(object,...);
          static object  (*LnkLI2)() =3D (object (*)()) LnkTLI2;
          NIL
         =20
          >(disassemble 'bar)
         =20
          ;; Compiling /tmp/gazonk_653784_0.lsp.
          ;; End of Pass 1.
          ;; End of Pass 2.
          OPTIMIZE levels: Safety=3D0 (No runtime error checking), Space=3D=
0, Speed=3D3
          ;; Finished compiling /tmp/gazonk_653784_0.o.
         =20
          #include "gazonk_653784_0.h"
          void init_code(){do_init((void *)VV);}
          /*	local entry for function COMMON-LISP-USER::BAR	*/
         =20
          static object LI1__BAR___gazonk_653784_0(object V3,object V4)
          {	 VMB1 VMS1 VMV1
          	{fixnum V5;
          	if(!(((char)((fixnum)((uchar*)((fixnum)V3))[(fixnum)2]&(fixnum)1=
))=3D=3D(0))){
          	goto T5;
          	}
          	goto T2;
         =20
          	goto T5;
          T5:;
          	V5=3D ((fixnum)((uint*)((fixnum)V3))[(fixnum)4]&268435455);
          	goto T1;
         =20
          	goto T2;
          T2:;
          	V5=3D (((fixnum)((uint*)((fixnum)V3))[(fixnum)1]>>(fixnum)3)&268=
435455);
          	goto T1;
          T1:;
          	{object V6 =3D make_longfloat(((double(*)(uint,double*,uint,doub=
le*,uint))(dlcblas_ddot))((uint)V5,(double*)V3->v.v_self,(uint)1,(double*)V=
4->v.v_self,(uint)1));
          	VMR1(V6);}}
          }
          (2 (MAPC 'EVAL *COMPILER-COMPILE-DATA*))
          static object LI1__BAR___gazonk_653784_0(object V3,object V4)
          ;
          static void *dlcblas_ddot;
          #define VMB1
          #define VMS1
          #define VMV1
          #define VMRV1(a_,b_) return((object )a_);
          #define VMR1(a_) VMRV1(a_,0);
          #define VM1 0
          static void * VVi[2]=3D{
          #define Cdata VV[1]
          (void *)(&dlcblas_ddot),
          (void *)(LI1__BAR___gazonk_653784_0)
          };
          #define VV (VVi)
          NIL
         =20
          >(si::save-system "ff")
          $ ./ff
          GCL (GNU Common Lisp)  2.7.0 Thu Oct 26 12:00:01 PM EDT 2023  CLt=
L1    git: Version_2_7_0pre38
          Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
          Binary License:  GPL due to GPL'ed components: (XGCL READLINE UNE=
XEC)
          Modifications of this banner must retain notice of a compatible l=
icense
          Dedicated to the memory of W. Schelter
         =20
          Use (help) to get some basic information on how to use GCL.
          Temporary directory for compiler files set to /tmp/
         =20
          >(foo a b)
         =20
          2.76
         =20
          >(bar a b)
         =20
          2.76
         =20
          >
         =20

Take care,


>

> - Greg
>
> PS / I Cc-ed to gcl-devel=20
>
> Le sam. 24 mai 2025 =C3=A0 15:30, Waldek Hebisch <[email protected]> a =C3=
=A9crit :
>
>  On Fri, May 23, 2025 at 09:56:29PM +0200, Gr=C3=A9gory Vanuxem wrote:
>  > Hello,
>  >=20
>  > I don't know if you can reproduce this: if I start FriCAS from $HOME i=
t
>  > starts nicely but if I start in another directory see the snippet belo=
w.
>  > I tried with gcl2.7.1-4 from a Debian based distribution and after wit=
h the
>  > official Debian sid and the same happens:
>  >
>  <snip>=20
>  >=20
>  >    >> System error:
>  >    INTERNAL-SIMPLE-PARSE-ERROR: "/home/greg//.fricas.input" is not a v=
alid
>  > pathname on host NIL
>  >=20
>  >=20
>  >    >> System error:
>  >    INTERNAL-SIMPLE-ERROR: The tag |top_level| is undefined.
>
>  Should be fixed now.
>
>  --=20
>                                Waldek Hebisch
>
>  --=20
>  You received this message because you are subscribed to the Google Group=
s "FriCAS - computer algebra system" group.
>  To unsubscribe from this group and stop receiving emails from it, send a=
n email to [email protected].
>  To view this discussion visit https://groups.google.com/d/msgid/fricas-d=
evel/aDHJ1HqJwLlykCMl%40fricas.org.

--=20
Camm Maguire			     		    [email protected]
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

--=20
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 e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/fricas-deve=
l/87cybryxm6.fsf%40maguirefamily.org.