We are able to build Fricas with ECL supplied by macOS Homebrew on an
M1 machine,  native arm64,
no x86_64 stuff involved.

It's Fricas 1.3.8 patched with ECL-specific patches (SageMath patches,
see https://github.com/sagemath/sage/tree/develop/build/pkgs/fricas/patches)
discussed in https://github.com/fricas/fricas/issues/59
(which happened after 1.3.8 was released)% otool -L
./local/lib/fricas/target/aarch64-apple-darwin22.3.0/bin/FRICASsys
./local/lib/fricas/target/aarch64-apple-darwin22.3.0/bin/FRICASsys:
        /opt/homebrew/opt/ecl/lib/libecl.21.2.dylib (compatibility
version 21.2.1, current version 0.0.0)
        /opt/homebrew/opt/gmp/lib/libgmp.10.dylib (compatibility
version 15.0.0, current version 15.1.0)
        /opt/homebrew/opt/bdw-gc/lib/libgc.1.dylib (compatibility
version 7.0.0, current version 7.1.0)
        /usr/lib/libffi.dylib (compatibility version 1.0.0, current
version 30.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
current version 1319.0.0)

(Note that arm64 Homebrew is installed in /opt)

% file ./local/lib/fricas/target/aarch64-apple-darwin22.3.0/bin/FRICASsys
./local/lib/fricas/target/aarch64-apple-darwin22.3.0/bin/FRICASsys:
Mach-O 64-bit executable arm64

HTH
Dima

On Sat, Mar 25, 2023 at 6:48 PM Grégory Vanuxem <[email protected]> wrote:
>
> Hello,
>
> It seems the C code files are compiled for the x86_64 target arch. Do
> you have a compatible gcc for your arch?
>
> You can try to export something like (in bash) before configure step.:
>
> export CC='gcc -march=armv9-a’
>
> Or something like that.
> For example on my machine:
>
> ┌──(greg㉿ellipse)-[~/Git/jlfricas]
> └─$ export CC='gcc -march=x86-64'
>
> ┌──(greg㉿ellipse)-[~/Git/jlfricas]
> └─$ ./configure  --enable-gmp
> checking build system type... x86_64-linux-gnu
> checking host system type... x86_64-linux-gnu
> checking target system type... x86_64-linux-gnu
> checking for in-tree build on case insensitive file system... no
> checking for make... make
> checking for gcc... gcc -march=x86-64
> checking whether the C compiler works... yes
>
> From the doc:
> =================================================
> march=name[+extension…]
>
> This specifies the name of the target ARM architecture. GCC uses this
> name to determine what kind of instructions it can emit when
> generating assembly code. This option can be used in conjunction with
> or instead of the -mcpu= option.
>
> Permissible names are: ‘armv4t’, ‘armv5t’, ‘armv5te’, ‘armv6’,
> ‘armv6j’, ‘armv6k’, ‘armv6kz’, ‘armv6t2’, ‘armv6z’, ‘armv6zk’,
> ‘armv7’, ‘armv7-a’, ‘armv7ve’, ‘armv8-a’, ‘armv8.1-a’, ‘armv8.2-a’,
> ‘armv8.3-a’, ‘armv8.4-a’, ‘armv8.5-a’, ‘armv8.6-a’, ‘armv9-a’,
> ‘armv7-r’, ‘armv8-r’, ‘armv6-m’, ‘armv6s-m’, ‘armv7-m’, ‘armv7e-m’,
> ‘armv8-m.base’, ‘armv8-m.main’, ‘armv8.1-m.main’, ‘armv9-a’, ‘iwmmxt’
> and ‘iwmmxt2’.
> =================================================
>
> But you have also configure target options for that:
> ./configure --help
> |snip]
> System types:
>   --build=BUILD     configure for building on BUILD [guessed]
>   --host=HOST       cross-compile to build programs to run on HOST [BUILD]
>   --target=TARGET   configure for building compilers for TARGET [HOST]
>
> Hope that helps. Otherwise, you'll have to install a C compiler that
> can produce arm binaries.
>
> __
> Greg
>
> Le sam. 25 mars 2023 à 15:23, Johannes Prof. Dr. Grabmeier, TH DEG
> <[email protected]> a écrit :
> >
> > Thanks for all the hints, which helped me to proceed:
> >
> > 1. Downloaded and installed binary of sbcl-2.1.2 for Darwin on ARM64 
> > successful!
> > 2. configure: still problem with the case sensitive file system check, I 
> > commented this check out in configure
> > 3. Then configure runs successful in a terminal (next mistake I made, I 
> > userd iterm, probably some how with x86 background/emulation so uname -m 
> > gave x_86 and not arm 64, this is ok in terminal
> > 4. but make fails, somehow it will again is confused with x86_64.
> >
> > Any ideas?
> >
> >
> >
> > DAASE=/Users/jgrabmeier/fricas-1.3.8/target/arm-apple-darwin22.3.0 
> > FRICAS=/Users/jgrabmeier/fricas-1.3.8/target/arm-apple-darwin22.3.0 
> > FRICAS_INITFILE='' 
> > /Users/jgrabmeier/fricas-1.3.8/build/arm-apple-darwin22.3.0/bin/interpsys
> > Checking for foreign routines
> > FRICAS="/Users/jgrabmeier/fricas-1.3.8/target/arm-apple-darwin22.3.0"
> > spad-lib="/Users/jgrabmeier/fricas-1.3.8/target/arm-apple-darwin22.3.0/lib/libspad.so"
> > foreign routines found
> >
> > debugger invoked on a SIMPLE-ERROR in thread
> > #<THREAD "main thread" RUNNING {7006170243}>:
> >   Error opening shared object 
> > "/Users/jgrabmeier/fricas-1.3.8/target/arm-apple-darwin22.3.0/lib/libspad.so":
> >   
> > dlopen(/Users/jgrabmeier/fricas-1.3.8/target/arm-apple-darwin22.3.0/lib/libspad.so,
> >  0x000A): tried: 
> > '/Users/jgrabmeier/fricas-1.3.8/target/arm-apple-darwin22.3.0/lib/libspad.so'
> >  (mach-o file, but is an incompatible architecture (have 'x86_64', need 
> > 'arm64')), 
> > '/System/Volumes/Preboot/Cryptexes/OS/Users/jgrabmeier/fricas-1.3.8/target/arm-apple-darwin22.3.0/lib/libspad.so'
> >  (no such file), 
> > '/Users/jgrabmeier/fricas-1.3.8/target/arm-apple-darwin22.3.0/lib/libspad.so'
> >  (mach-o file, but is an incompatible architecture (have 'x86_64', need 
> > 'arm64')).
> >
> > 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.
> >
> > (SB-SYS:DLOPEN-OR-LOSE #S(SB-ALIEN::SHARED-OBJECT :PATHNAME 
> > #P"/Users/jgrabmeier/fricas-1.3.8/target/arm-apple-darwin22.3.0/lib/libspad.so"
> >  :NAMESTRING 
> > "/Users/jgrabmeier/fricas-1.3.8/target/arm-apple-darwin22.3.0/lib/libspad.so"
> >  :HANDLE NIL :DONT-SAVE NIL))
> > 0]
> >
> >
> >
> >
> >
> > Waldek Hebisch schrieb am Freitag, 24. März 2023 um 14:25:13 UTC+1:
> >>
> >> On Fri, Mar 24, 2023 at 11:41:14AM +0100, Prof. Dr. Johannes Grabmeier 
> >> wrote:
> >> > Dear all,
> >> >
> >> > thanks  to Qian, I did what you suggested, but I do not know whether it
> >> > works as I encountered new problems.
> >> >
> >> > checking for in-tree build on case insensitive file system... configure:
> >> > error: in tree build on case insensitive file system is not supported. 
> >> > Use
> >> > out-of-source-tree build instead.
> >> >
> >> > how do I use "out-of-source-tree build" instead?
> >> >
> >> > Then I get the error message:
> >> >
> >> > checking Lisp implementation... mmap: Cannot allocate memory
> >> > ensure_space: failed to validate 1073741824 bytes at 0x1000000000
> >> > (hint: Try "ulimit -a"; maybe you should increase memory limits.)
> >> > sed: config_cl.out: No such file or directory
> >> > configure: error: Unable to determine Lisp flavor
> >> >
> >> > Next attempt was to update SBCL to actual version 2.3.2, same error
> >>
> >> Just quick remark: do not try sbcl-2.3.2 with FriCAS-1.3.8, it is
> >> expected to fail. Instead, use sbcl-2.3.1 or earlier (or latest
> >> FriCAS from git repo).
> >>
> >> > ~/sbcl$ sh make.sh
> >> > mmap: Cannot allocate memory
> >> > ensure_space: failed to validate 1073741824 bytes at 0x1000000000
> >> > (hint: Try "ulimit -a"; maybe you should increase memory limits.)
> >> > No working host Common Lisp implementation.
> >> > See ./INSTALL, the "SOURCE DISTRIBUTION" section
> >> >
> >> > and this memory error also occurs, when I wanted to run my old FriCAS
> >> > version, which I once compiled on my old Macbook.
> >> >
> >> >
> >> > Principle thaughts: x86 is Intel, but Apple now has its own M2 chip, so
> >> > allone for that reasons an x86 binary probably does not work. So I have 
> >> > to
> >> > use and fix the compile problem with case insensitive file system (it is
> >> > case sensitive!) and the SBCL memory problem.
> >> >
> >> >
> >> > Any ideas an help is really appreciated. Thanks a lot.
> >>
> >> Apple includes x86 emulation, so x86 binary has non zero chance of
> >> working. But native version would probably avoid some troubles.
> >>
> >> The messages suggest that already sbcl has problem, FriCAS needs
> >> working Lisp, so this must be resolved first. For native sbcl
> >> normal way is to compile it using earler version of sbcl.
> >> sbcl folks provide binary of sbcl-2.1.2 for Darwin on ARM64, which
> >> theortically should work.
> >>
> >> --
> >> 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/5a12e6da-7420-4a14-b14f-323903274f7cn%40googlegroups.com.
>
> --
> 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/CAHnU2daoR1DJ97jixDe6ck3HPOK%2BwgAGoGpHYZcMXKig7JqsXw%40mail.gmail.com.

-- 
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/CAAWYfq1b1Owr01Pq9n5hwYFaYMmMgZ5%2BYYsyjpOmwn0EZ170fQ%40mail.gmail.com.

Reply via email to