456f8b404b9b44c1e38d725f281cdc43abca57f7 fails to build fricas-aldor interface

13 views
Skip to first unread message

Ralf Hemmecke

unread,
Apr 22, 2023, 7:24:53 PM4/22/23
to fricas-devel
Hello,

with the recent commit

Directly use '%' in types, do not rename it to '$'

the fricas-aldor-interface fails to build. I investigate later more deeply.

Ralf



aldor -Wname=fricas -Mno-abbrev -Mpreview -Y al -L
FriCASLib=fricas_A1AGG -fao=ao/A1AGG.ao ap/A1AGG.ap 2>&1 | tee
tmp/A1AGG_ao.out
(Message Preview)

#1 (Error) Have determined 1 possible types for the expression.
Meaning 1: Symbol
The context requires an expression of type Tuple(Type).

(Message Preview)

#2 (Error) Have determined 1 possible types for the expression.
Meaning 1: Symbol, with , with
The context requires an expression of type Tuple(Type).

(Message Preview)

#3 (Error) Argument 1 of `->' did not match any possible parameter type.
The rejected type is Symbol, with , with .
Expected type Tuple(Type).

(Message Preview)
"ap/A1AGG.ap", line 17:
(|RestrictTo| (|LitString| "%") |Symbol|)))
............................................^
[L17 C45] #4 (Error) No meaning for string-style literal `"%"'.

(Message Preview)

#5 (Error) Have determined 1 possible types for the expression.
Meaning 1: Symbol
The context requires an expression of type Tuple(Type).

(Message Preview)

#6 (Error) Have determined 1 possible types for the expression.
Meaning 1: Symbol, with
The context requires an expression of type Tuple(Type).

(Message Preview)

#7 (Error) Argument 1 of `->' did not match any possible parameter type.
The rejected type is Symbol, with .
Expected type Tuple(Type).

Ralf Hemmecke

unread,
Apr 24, 2023, 7:02:04 PM4/24/23
to fricas...@googlegroups.com
Obviously, the commit modified the output of .ap files.

Before and after we have

(1) -> )boot GETDATABASE('Eltable, 'CONSTRUCTORCATEGORY)

(EVAL-WHEN (EVAL LOAD)
(PROG () (RETURN (GETDATABASE '|Eltable| 'CONSTRUCTORCATEGORY))))
Value = (|Join| (CATEGORY |domain| (SIGNATURE |elt| (|t#2| $ |t#1|))))

However, where before the commit we get

(1) -> )boot modemapToAx(GETDATABASE('Eltable, 'CONSTRUCTORMODEMAP))

(EVAL-WHEN (EVAL LOAD)
(PROG ()
(RETURN (|modemapToAx| (GETDATABASE '|Eltable| 'CONSTRUCTORMODEMAP)))))
Value = (|Define|
(|Declare| |Eltable|
(|Apply| ->
(|Comma| . #1=((|Declare| |#1| |Type|) (|Declare| |#2| |Type|)))
|Category|))
(|Lambda| (|Comma| . #1#) |Category|
(|Label| |Eltable|
(|With| NIL
(|Sequence|
(|Declare| |apply|
(|Apply| -> (|Comma| % |#1|) |#2|)))))))

whereas after this becomes

(1) -> )boot modemapToAx(GETDATABASE('Eltable, 'CONSTRUCTORMODEMAP))

(EVAL-WHEN (EVAL LOAD)
(PROG ()
(RETURN (|modemapToAx| (GETDATABASE '|Eltable| 'CONSTRUCTORMODEMAP)))))
Value = (|Define|
(|Declare| |Eltable|
(|Apply| ->
(|Comma| . #1=((|Declare| |#1| |Type|) (|Declare| |#2| |Type|)))
|Category|))
(|Lambda| (|Comma| . #1#) |Category|
(|Label| |Eltable|
(|With| NIL
(|Sequence|
(|Declare| |apply|
(|Apply| ->
(|Comma| (|RestrictTo| (|LitString| "%") |Symbol|)
|#1|)
|#2|)))))))

I think it is the removal of the line

axFormatType(typeform) ==
atom typeform =>
typeform = '$ => '% <---------
STRINGP typeform =>
['Apply,'Enumeration, INTERN typeform]
...
MEMQ(typeform, $FormalMapVariableList) => typeform
axAddLiteral('string, 'Symbol, 'Literal)
['RestrictTo, ['LitString, PNAME typeform], 'Symbol]
typeform is ['construct,: args] =>
axAddLiteral('bracket, ['Apply, 'List, 'Symbol], [ 'Apply,
'Tuple, 'Symbol])
axAddLiteral('string, 'Symbol, 'Literal)
['RestrictTo, ['Apply, 'bracket,
:[axFormatType a for a in args]],
['Apply, 'List, 'Symbol] ]

because falling through seems to be the source of this |RestrictTo|.

Maybe thes is another place. But that is for tomorrow... Too late now.

Ralf

Waldek Hebisch

unread,
Apr 24, 2023, 7:15:01 PM4/24/23
to fricas...@googlegroups.com
<snip>

Yes, we should special case '% like in attached patch.

--
Waldek Hebisch
ax.diff

Ralf Hemmecke

unread,
May 6, 2023, 11:47:41 AM5/6/23
to fricas...@googlegroups.com, Peter Broadbery
I compiled "Fix fricas-aldor interface"
fa45633db5587c104bcdd4e9a1889bd1650a3901 just fine.
However, now I realized that there still seems to be a problem.

For the attached files I get the following, but have no idea where I
should look for the source of the problem.

With sieve.as I have the same problem. When calling sieve(10) it yields

(1) ->
>> System error:
The function FOAM-USER::|fiRaiseException| is undefined.

I use:

Aldor version 1.3.0(ac0a8a0b9d37d6c937615dfd4301b862817590cb) for
LINUX(glibc2.10+)

Any idea how to trace this down?

Ralf

(1) -> Compiling FriCAS source code from file
/dev/shm/hemmecke/fricas/b/aldortest/funny.as using Aldor
compiler and options
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y
$FRICAS/algebra -I $FRICAS/algebra
Use the system command )set compiler args to change these
options.
Compiling Lisp source code from file ./funny.lsp
Issuing )library command for funny
Reading /dev/shm/hemmecke/fricas/b/aldortest/funny.asy
FunnySeries is now explicitly exposed in frame initial
FunnySeries will be automatically loaded when needed from
/dev/shm/hemmecke/fricas/b/aldortest/funny
(1) ->
Type: Void
(2) ->
Type: Void
(3) ->
Type: Void
(4) ->
Type: Void
(5) ->
(5) 0
Type:
Fraction(Integer)
(6) ->
(6) z
Type:
Symbol
(7) ->
(7) 1
Type:
UnivariateLaurentSeries(Fraction(Integer),z,0)
(8) ->
(8) z
Type:
UnivariateLaurentSeries(Fraction(Integer),z,0)
(9) ->
>> System error:
The function FOAM-USER::|fiRaiseException| is undefined.

(9) ->
sx is declared as being in FunnySeries(Fraction(Integer),z,0) but
has not been given a value.
funny.as
funny.input
sieve.as

Waldek Hebisch

unread,
May 6, 2023, 1:37:00 PM5/6/23
to fricas...@googlegroups.com
On Sat, May 06, 2023 at 05:47:38PM +0200, Ralf Hemmecke wrote:
> I compiled "Fix fricas-aldor interface"
> fa45633db5587c104bcdd4e9a1889bd1650a3901 just fine.
> However, now I realized that there still seems to be a problem.
>
> For the attached files I get the following, but have no idea where I should
> look for the source of the problem.
>
> With sieve.as I have the same problem. When calling sieve(10) it yields
>
> (1) ->
> >> System error:
> The function FOAM-USER::|fiRaiseException| is undefined.
>
> I use:
>
> Aldor version 1.3.0(ac0a8a0b9d37d6c937615dfd4301b862817590cb) for
> LINUX(glibc2.10+)
>
> Any idea how to trace this down?

Well, 'fiRaiseException' is part of Aldor, so error you see is
really Aldor error, but IMO a minor one.

Stanard thing for runtime errors is

)set break break

after that (using sbcl)

backtrace 5

will print last 5 calls. IIUC argument to 'fiRaiseException'
contains real error message. Call chain tells you where the
error is.

The process is essentially the same as described in 'doc/debug.txt'.

I can not debug this, because Aldor from git does not build on
any of my machines (due to an autotools problem). And old
Aldor would not do due to incompatible changes.

--
Waldek Hebisch

Ralf Hemmecke

unread,
May 6, 2023, 4:06:59 PM5/6/23
to fricas...@googlegroups.com
1) -> )set break break
(1) -> )co sieve.as
Compiling FriCAS source code from file
/home/hemmecke/backup/git/fricas-bisect/aldortest/sieve.as using
Aldor compiler and options
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y
$FRICAS/algebra -I $FRICAS/algebra
Use the system command )set compiler args to change these
options.
Compiling Lisp source code from file ./sieve.lsp
Issuing )library command for sieve
Reading /home/hemmecke/backup/git/fricas-bisect/aldortest/sieve.asy
(1) -> sieve 3

debugger invoked on a UNDEFINED-FUNCTION @52A005B4 in thread
#<THREAD "main thread" RUNNING {10023F0103}>:
The function FOAM-USER::|fiRaiseException| is undefined.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE ] Retry calling FOAM-USER::|fiRaiseException|.
1: [USE-VALUE ] Call specified function.
2: [RETURN-VALUE ] Return specified values.
3: [RETURN-NOTHING] Return zero values.
4: [ABORT ] Exit from the current thread.

("undefined function" "Export not found

================================================

The curor stops exactly after the "found". No closing paren visible.

If I type 3 ENTER, I get:

<THREAD "main thread" RUNNING {10023F0103}>:
User error: Reached a 'never'

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit from the current thread.

(FOAM:|Halt| 102)
source: (ERROR
(COND ((= N 101) "System Error: Unfortunate use of
dependent type")
((= N 102) "User error: Reached a 'never'")
((= N 103) "User error: Bad union branch")
((= N 104) "User error: Assertion failed")
(T (FORMAT NIL "Unknown halt condition ~a" N))))

After that I could use

backtrace 5

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10023F0103}>
0: (FOAM:|Halt| 102)
1: (FOAM-USER::|C50-runtime-lazyForceImport| #(NIL (#(0 (#<FUNCTION
FOAM-USER::|C81-runtime-n|> . #1=(# #)) NIL (#<FUNCTION
FOAM-USER::|C82-runtime-ptrg|> . #1#) (#<FUNCTION
FOAM-USER::|C83-runtime-h|> . #1#) (#<FUNCTION
FOAM-USER::|C86-runtime-i|> . #1#)) 1 #(|oldAxiomDomain| (#<FUNCTION
|oldAxiomDomainDevaluate|>) (NIL) (#<FUNCTION
|oldAxiomDomainLookupExport|>) (#<FUNCTION |oldAxiomDomainHashCode|>)
(#<FUNCTION |oldAxiomAddChild|>)) 740244383 . #2=#(#3=(|Boolean|)
(#<FUNCTION |lookupComplete|> #2# #(~= 10 ~ 16 |xor| 21 |true| 27 |test|
31 |smaller?| 36 ...)) NIL 0 (#(|Logic&| T T T |OrderedSet&| T T T
|Finite&| T T T ...) #(# # # # # # # # # # # # ...) . #(1 29 0 28 30 1
33 0 32 34 2 0 ...)) NIL #3# (#<FUNCTION |BOOLEAN;test;2%;1|> . #2#)
(#4=#<FUNCTION |makeSpadConstant|> #<FUNCTION |BOOLEAN;true;%;3|> #2# 8)
(#4# #<FUNCTION |BOOLEAN;false;%;4|> #2# 9) (#<FUNCTION
|BOOLEAN;not;2%;5|> . #2#) (#<FUNCTION |BOOLEAN;~;2%;6|> . #2#) ...))
11137124 740244383 NIL) #<unused argument>)
2: (FOAM-USER::|C1-sieve-sieve| 2 (#S(FOAM-USER::|Struct-sieve-7|
:|Boolean-0| #1=(#(0 (#2=#<FUNCTION FOAM-USER::|C81-runtime-n|> . #3=#)
NIL (#4=#<FUNCTION FOAM-USER::|C82-runtime-ptrg|> . #3#) (#5=#<FUNCTION
FOAM-USER::|C83-runtime-h|> . #3#) (#6=#<FUNCTION
FOAM-USER::|C86-runtime-i|> . #3#)) 1 #(|oldAxiomDomain| (#<FUNCTION
|oldAxiomDomainDevaluate|>) (NIL) (#<FUNCTION
|oldAxiomDomainLookupExport|>) (#<FUNCTION |oldAxiomDomainHashCode|>)
(#<FUNCTION |oldAxiomAddChild|>)) 740244383 . #7=#(#8=(|Boolean|)
(#<FUNCTION |lookupComplete|> #7# #) NIL 0 (# # . #) NIL #8# (#<FUNCTION
|BOOLEAN;test;2%;1|> . #7#) (#9=#<FUNCTION |makeSpadConstant|>
#<FUNCTION |BOOLEAN;true;%;3|> #7# 8) (#9# #<FUNCTION
|BOOLEAN;false;%;4|> #7# 9) (#<FUNCTION |BOOLEAN;not;2%;5|> . #7#)
(#<FUNCTION |BOOLEAN;~;2%;6|> . #7#) ...)) :|NonNegativeInteger-1|
#10=(#(0 (#2# . #11=#) NIL (#4# . #11#) (#5# . #11#) (#6# . #11#)) 1 #(0
(#<FUNCTION FOAM-USER::|C70-runtime-n|> . #12=#) NIL (#<FUNCTION
FOAM-USER::|C71-runtime-extendg|> . #12#) (#<FUNCTION
FOAM-USER::|C72-runtime-h|> . #12#) (#<FUNCTION
FOAM-USER::|C73-runtime-i|> . #12#)) . #((#<FUNCTION
FOAM-USER::|C65-axextend-extend0|> . #13=#) NIL 0 #(2 2 #) NIL NIL NIL
NIL NIL 0 0 #(0 # # 15) ...)) :|PrimitiveArray-2| (|runOldAxiomFunctor|
. |PrimitiveArray|) :|true-3| #(NIL #1# 11137124 740244383 NIL)
:|false-4| #(NIL #1# 13900568 740244383 NIL) :|+-5| (#14=#<FUNCTION
FOAM-USER::|C54-axextend-+|> . #15=(#S(FOAM-USER::|Struct-axextend-9|
:|mod-0| # :|rem-1| # :|quo-2| # :>=-3 # :<=-4 # :>-5 # :<-6 # :=-7 #
:|--8| # :*-9 # :|+-10| # :|zero?-11| # ...) (NIL #13#))) :|0-6| #(NIL
#10# 200089 172927374 NIL) :*-7 #16=(#17=#<FUNCTION
FOAM-USER::|C118-runtime-lazyGetter|> .
#18=(#S(FOAM-USER::|Struct-runtime-28| :|getter-0| # :|flag-1| NIL
:|self-2| #16#) #19=(# NIL) #20=#<FUNCTION
FOAM-USER::|C106-runtime-lazyGetter2|> . #18#)) :|1-8| #(T NIL 200090
172927374 1) :|integer-9| #21=(#22=#<FUNCTION
FOAM-USER::|C126-runtime-lazyGetter|> .
#23=(#S(FOAM-USER::|Struct-runtime-28| :|getter-0| # :|flag-1| NIL
:|self-2| #21#) #19# #20# . #23#)) :|coerce-10| #24=(#22# .
#25=(#S(FOAM-USER::|Struct-runtime-28| :|getter-0| # :|flag-1| NIL
:|self-2| #24#) #19# #20# . #25#)) :|..-11| #26=(#17# .
#27=(#S(FOAM-USER::|Struct-runtime-28| :|getter-0| # :|flag-1| NIL
:|self-2| #26#) #19# #20# . #27#)) ...) NIL))
3: (SB-EVAL::EVAL-THE ((VALUES T) (FUNCALL (THE FUNCTION (CAR
#1=#:G442)) 2 (CDR #1#))) #<SB-EVAL::ENV {1004A92AF3}>)
4: (SB-EVAL:EVAL-IN-NATIVE-ENVIRONMENT (SPADCALL 2
FOAM-USER::|G-sieve_sieve_825325564|) #<NULL-LEXENV>)

0]

From here I have no idea how to continue. If it helps, I also attache
sieve.lsp and sieve.asy as generated by aldor. But they are identical
for both c4482787fec4223e96960c1dfaa628cab40ec145 and
fa45633db5587c104bcdd4e9a1889bd1650a3901.

Interestingly, FriCAS c4482787fec4223e96960c1dfaa628cab40ec145 works.
And when I compile sieve.as against the libfricas.al from that version,
only sieve.fasl is different. So the problem must lie inside libfricas.al.

Well, I have to compare all the generated .ap files in the src-aldor
directory. Ufff...no differences except some fasl files and the version
string in the .log files.

Makefile2 | 4 ++--
Makefile3 | 4 ++--
cliques | Bin 3220504 -> 3220928 bytes
lib/axextend.fasl | Bin 758561 -> 758561 bytes
lib/axlit.fasl | Bin 267107 -> 267107 bytes
lib/boolean0.fasl | Bin 10671 -> 10671 bytes
lib/lang.fasl | Bin 251632 -> 251632 bytes
lib/minimach.fasl | Bin 91148 -> 91148 bytes
lib/runtime.fasl | Bin 488118 -> 488118 bytes
lib/subsetc.fasl | Bin 32418 -> 32418 bytes

And the above looks unsuspicious. Probably just a timestamp difference.

Even better. The generated libfricas.al is bitidentical in FriCAS
c4482787fec4223e96960c1dfaa628cab40ec145 (working) and
fa45633db5587c104bcdd4e9a1889bd1650a3901 (nonworking).

Doesn't that suggest that FriCAS is to blame and not Aldor?

What could it be???

Ralf
sieve.asy
sieve.lsp

Waldek Hebisch

unread,
May 6, 2023, 5:26:29 PM5/6/23
to fricas...@googlegroups.com
You should just type 'backtrace 5'. Or may ENTER for clearer
position on the screen. IIUC 3 return from current function
obscuring exact location of the error.

>
> <THREAD "main thread" RUNNING {10023F0103}>:
> User error: Reached a 'never'
>
> Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
>
> restarts (invokable by number or by possibly-abbreviated name):
> 0: [ABORT] Exit from the current thread.
>
> (FOAM:|Halt| 102)
> source: (ERROR
> (COND ((= N 101) "System Error: Unfortunate use of dependent
> type")
> ((= N 102) "User error: Reached a 'never'")
> ((= N 103) "User error: Bad union branch")
> ((= N 104) "User error: Assertion failed")
> (T (FORMAT NIL "Unknown halt condition ~a" N))))
>
> After that I could use
>
> backtrace 5
>
> Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10023F0103}>
> 0: (FOAM:|Halt| 102)
> 1: (FOAM-USER::|C50-runtime-lazyForceImport|

This is inside Aldor runtime, looks like function responsible
for runtime search for funtions.

> From here I have no idea how to continue. If it helps, I also attache
> sieve.lsp and sieve.asy as generated by aldor. But they are identical for
> both c4482787fec4223e96960c1dfaa628cab40ec145 and
> fa45633db5587c104bcdd4e9a1889bd1650a3901.
>
> Interestingly, FriCAS c4482787fec4223e96960c1dfaa628cab40ec145 works.
> And when I compile sieve.as against the libfricas.al from that version, only
> sieve.fasl is different. So the problem must lie inside libfricas.al.

Clearly this is problem of incompatiblity of runtimes. Something
must still assume that FriCAS function signatures contain '$'.
One point is that 'hashType' in 'hashcode.boot' must compute the
same value which Aldor computes. Or there are some places where
current domain needs special case and it may still use '$'.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages