Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package request: Common Lisp programming language compiler #183

Open
NLKNguyen opened this issue Mar 27, 2016 · 43 comments

Comments

Projects
None yet
@NLKNguyen
Copy link

commented Mar 27, 2016

Thanks for the amazing terminal app for Android. I purchased the styling add-on today, and it looks great.

I'd like to request a Lisp compiler package:

SBCL is more preferred among Lisp community, but either one would be great.

@fornwall

This comment has been minimized.

Copy link
Member

commented Mar 27, 2016

Having SBCL as a Termux package would be great! Will look at adding it in the future - and if anyone else is interested in looking at it in the meantime it would also be great :).

@Neo-Oli

This comment has been minimized.

Copy link
Member

commented Apr 23, 2016

Hi, I am reopening this issue. Package requests will now be labeled and tracked as an issue.

@Neo-Oli Neo-Oli reopened this Apr 23, 2016

@Ryan-B-W

This comment has been minimized.

Copy link

commented Jun 9, 2016

I have a suggestion for an alternate common lisp implementation: ECL, or embeddable Common Lisp, which can be found at https://common-lisp.net/project/ecl/. I think ECL may be a good candidate because it has mainline android support and is a fully standards compliant common lisp implementation while also being very lightweight as well. I would try building it myself but I don't have access to a suitable build environment right now.

@vit1-irk

This comment has been minimized.

Copy link

commented Jul 6, 2016

Here's an easy howto I've wrote to have binary SBCL work on Termux: https://gist.github.com/vit1-irk/f45bec7f882d319d01c66ce6d54dfc9f

Also I have a failing attempt to build it from sources: https://gist.github.com/vit1-irk/9cec4df75d3f4de65b89a9aaf3b02df1

@plops

This comment has been minimized.

Copy link

commented Sep 4, 2016

I managed to compile ECL inside termux on a Nexus 7 (2013 Wifi).

apt install libgmp libgmp-dev clang make git libffi libffi-dev
git clone https://gitlab.com/embeddable-common-lisp/ecl.git
cd ecl
# comment out link_map and r_debug definition around line 123 in dyn_load.c 
vi /data/data/com.termux/files/home/ecl/src/bdwgc/dyn_load.c
./configure  --host=arm-linux-androideabi --with-system-gmp --enable-boehm=included  --with-cxx --with-dffi --enable-shared=no --disable-soname --prefix=/data/data/com.termux/files/usr/local --with-cross-config=`pwd`/src/util/android.cross_config
make install

Using the libgc that comes with termux failed. So did compiling with --enable-shared.

-bash-4.3# ecl 
;;; Loading "/data/data/com.termux/files/home/quicklisp/setup.lisp"
;;; Loading #P"/data/data/com.termux/files/usr/local/lib/ecl-16.1.2/asdf.fasc"
ECL (Embeddable Common-Lisp) 16.1.2 (git:326829fd58b733f6f42e81f2e53a7b8c5860c7c5)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
Copyright (C) 2015 Daniel Kochmanski
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  
Top level in: #<process TOP-LEVEL>.
> (ql:quickload :swank)
To load "swank":
  Install 1 Quicklisp release:
    slime

You can download a tar file (5.5MB) with the binary here: https://github.com/plops/ecl-termux-binary

@Grimler91

This comment has been minimized.

Copy link
Member

commented May 10, 2017

I looked a bit into building clisp (needed by xindy, see #966) and it seems to have problems with clang, or at least require an assembly patch. There's an helpful patch located here but it doesn't takes us all the way, make fails due to invalid instructions in an assembly file.

My work so far is located at https://github.com/Grimler91/termux-packages/tree/xindy for anyone interested.

@VitoVan

This comment has been minimized.

Copy link

commented Oct 19, 2017

Is anyone working on this for now ?

I tried build it follow this instruction:

https://github.com/termux/termux-packages#setting-up-a-build-environment-using-docker

But it's not working yet, there are errors throw out when compiling and I am trying to solve them.

I am not good at Cross Compiling or C or C++ or Common Lisp or anything related to this, so if anyone is working on this, would you like to share some progress ? I appreciate that very much.

@Grimler91

This comment has been minimized.

Copy link
Member

commented Oct 19, 2017

@VitoVan Are you interested in sbcl or clisp?

If you share the compiling errors we could probably (try) to help solve them.

I haven't looked at clisp for quite some time, I was stuck at trying to solve some C_CODE_ALIGNMENT error. Compiling on device also went further than cross compiling, though cross compiling can probably be fixed with the right flags.

@VitoVan

This comment has been minimized.

Copy link

commented Oct 23, 2017

Hi @Grimler91 , it's great to have your reply, and Yes, I am interested in sbcl.

I tried copy disabled-packages/sbcl to packages/sbcl and then run ./build-package.sh sbcl and then it failed.

I have totally messed up the whole environment when I'm trying to solve the problems it thrown out, and I will go back and try it again and shared the compiling errors from the beginning.


Before doing that, I have a question for the first sight of sbcl/build.sh here:

TERMUX_PKG_VERSION=1.3.9

And the most recent version of SBCL is 1.4.0, should we change the version number first ?

@sdrausty

This comment has been minimized.

Copy link

commented Nov 30, 2017

It looks like ECL is currently available in Termux through Arch Linux PRoot. This script is designed to install Arch Linux in just a few keystrokes. Tapping this link https://sdrausty.github.io/TermuxArch/setupTermuxArch.sh will transfer setupTermuxArch.sh to your device. Simply run bash ~/storage/downloads/setupTermuxArch.sh to install Arch Linux in Termux. To install use pacman -S ecl and this will install ECL on device.

screenshot_20171130-040102

@VitoVan

This comment has been minimized.

Copy link

commented Dec 1, 2017

SBCL should work with proot as well as ECL, but it feels inelegant.

If we are going to use proot, then the Emacs / Vi packages from termux is not necessary any more.

@sdrausty

This comment has been minimized.

Copy link

commented Dec 1, 2017

Use what works

@KedalionDaimon

This comment has been minimized.

Copy link

commented Dec 13, 2017

If we are using "proot" and similar, then why use Termux? Why not use Debian on Android, etc.? - The whole point of Termux is that it is not-quite-so-heavy as a full Linux - and full Linux on Android IS available - and from the three possible Common Lisps, NONE work: neither Clisp, nor ECL, nor SBCL. Don't cheat yourself with "Arch root" etc: the Lisp area here still needs fixing!

@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Dec 13, 2017

actually ecl works
im working on packaging it now

@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Dec 13, 2017

https://github.com/its-pointless/its-pointless.github.io/tree/master/files/dists/termux/extras/binary-i686
here for i686 you can work out where your arch is from here ... but its there

@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Dec 13, 2017

Right so basically at this point i can cross compile ecl for the 4 archs we support. It requires a 32 bit ecl to cross compile for 32 bit termux_archs. Libgc current version in 32bit doesn't play well with docker. So you have to use a recent commit. Also needs the headers and stuff from libatomic_ops which is needed for libgc etc ...
Basically same issue i had with guile...

@KedalionDaimon

This comment has been minimized.

Copy link

commented Dec 13, 2017

For the fun of it, I just did a pkg install ecl aaaand... it popped up! As I assume this must be your doing, I just dropped by to say: THANK YOU!

@dkharlan

This comment has been minimized.

Copy link

commented Dec 16, 2017

ECL works for me, but not with Slime:

(progn (load "/data/data/com.termux/files/home/.emacs.d/elpa/slime-20171207.1712/swank-loader.lisp" :verbose t) (funcall (read-from-string "swank-loader:init")) (funcall (read-from-string "swank:start-server") "/data/data/com.termux/files/usr/tmp/slime.7278"))
 
 ECL (Embeddable Common-Lisp) 16.1.3 (git:UNKNOWN)
 Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
 Copyright (C) 1993 Giuseppe Attardi
 Copyright (C) 2000 Juan J. Garcia-Ripoll
 Copyright (C) 2016 Daniel Kochmanski
 ECL is free software, and you are welcome to redistribute it
 under certain conditions; see file 'Copyright' for details.
Type :h for Help.
Top level in: #<process TOP-LEVEL>.
>
;;; Loading "/data/data/com.termux/files/home/.emacs.d/elpa/slime-20171207.1712/swank-loader.lisp"
;;; Loading #P"/data/data/com.termux/files/usr/lib/ecl-16.1.3/cmp.fas"
pthread_kill failed at suspend

Process inferior-lisp aborted (core dumped)

This is with the following in my .emacs:

(setq inferior-lisp-program "/data/data/com.termux/files/usr/bin/ecl")
(setq slime-contribs '(slime-fancy))

Please let me know if this isn't the right forum for this (and where would be) and I'll repost there. Thanks!

@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Dec 21, 2017

The error pthread_kill failed at suspend is a libgc error that iv mostly worked out. On arm recompiling libgc with -Os instead of -Oz and on i686 i needed to remove a termux patch. As of right now i think that error is no long happening on the versions uploaded as i have replaced them with working versions.
I686 is not using threads...

@vit1-irk

This comment has been minimized.

Copy link

commented Dec 21, 2017

@its-pointless just tried to upgrade ecl from your repo and to install quicklisp

this libgc problem is still present

> (quicklisp-quickstart:install)

; Fetching #<url "http://beta.quicklisp.org/client/quicklisp.sexp">
; 0.82KB
==================================================
838 bytes in 0.01 seconds (102.29KB/sec)
; Fetching #<url "http://beta.quicklisp.org/client/2017-03-06/quicklisp.tar">
; 250.00KB
==================================================
256,000 bytes in 0.19 seconds (1302.08KB/sec)pthread_kill failed at suspend
Aborted
$
@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Dec 21, 2017

I will have to use a static lib libgc until libgc is updated. I will update here when i get around to it sometime today. I thought fornwall had updated libgc after change of cflags for arm but i was mistaken.

@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Dec 21, 2017

try now i uploaded arm version without threads. which should work. When libgc is updated i will enable threads.
Libgc statically linked doesn't work ....

@phoe

This comment has been minimized.

Copy link

commented Dec 29, 2017

@its-pointless The package currently hosted at https://github.com/its-pointless/its-pointless.github.io/blob/master/files/dists/termux/extras/binary-arm/ecl_16.1.3_arm.deb does not seem to have threads disabled.

┌─[u0_a89][localhost][~]
└─▪ ecl -load ../tmp/quicklisp.lisp
;;; Loading "/data/data/com.termux/files/home/../tmp/quicklisp.lisp"
;;; Loading #P"/data/data/com.termux/files/usr/lib/ecl-16.1.3/sockets.fas"

  ==== quicklisp quickstart 2015-01-28 loaded ====

    To continue with installation, evaluate: (quicklisp-quickstart:install)

    For installation options, evaluate: (quicklisp-quickstart:help)

ECL (Embeddable Common-Lisp) 16.1.3 (git:UNKNOWN)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
Copyright (C) 2016 Daniel Kochmanski
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  
Top level in: #<process TOP-LEVEL>.
> (quicklisp-quickstart:install)

; Fetching #<url "http://beta.quicklisp.org/client/quicklisp.sexp">
; 0.82KB
==================================================
838 bytes in 0.01 seconds (68.20KB/sec)
; Fetching #<url "http://beta.quicklisp.org/client/2017-03-06/quicklisp.tar">
; 250.00KB
==================================================
256,000 bytes in 0.01 seconds (16666.67KB/sec)
; Fetching #<url "http://beta.quicklisp.org/client/2015-09-24/setup.lisp">
; 4.94KB
==================================================
5,054 bytes in 0.01 seconds (705.08KB/sec)
; Fetching #<url "http://beta.quicklisp.org/asdf/2.26/asdf.lisp">
; 194.07KB
==================================================
198,729 bytes in 0.01 seconds (13862.24KB/sec)pthread_kill failed at suspend
Aborted
@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Dec 29, 2017

have you upgraded your libgc version on device? It should work if you do if not i will fix this in a second.

@phoe

This comment has been minimized.

Copy link

commented Dec 29, 2017

@its-pointless

┌─[u0_a89][localhost][~]
└─▪ apt install libgc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libgc is already the newest version (7.6.2).
libgc set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Dec 29, 2017

Damn it.
K i will fix

@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Dec 29, 2017

Ok try again now...

@phoe

This comment has been minimized.

Copy link

commented Dec 29, 2017

Worked this time. I managed to install Quicklisp. Thanks!

(Though thread support will nonetheless be most appreciated, if you manage to get it.)

@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Dec 30, 2017

Okay iv worked out what is going on. Its actually recommeded to remove tkill from libgc since ndk 11 or more accurately api 23 or android 6. So i can actually now embed libgc into ecl so it works in threads. The issue is i don't know if this will work on api 21 aka android 5, i also do not know what effect it may have on other applications if lib is changed.
since its currently causing bugs here it may not work properly anywhere else..

@phoe

This comment has been minimized.

Copy link

commented Dec 31, 2017

Does it mean that I should not yet download ECL again, or that ECL will break for older androids if you do this change?

@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Dec 31, 2017

I haven't changed it keep as it is for now.

@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Jan 1, 2018

Okay if you want try version with threads get ecl-ext as opposed to ecl. Requires android 6(aka api 23) and above.

@phoe

This comment has been minimized.

Copy link

commented Jan 2, 2018

Yes, I tried it, and it seems working so far. Thank you!

@phoe

This comment has been minimized.

Copy link

commented Jan 2, 2018

@its-pointless https://www.reddit.com/r/Common_Lisp/comments/7npeab/
I have made a small HOWTO regarding your ECL-EXT package - I hope you don't mind. (:

@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Jan 3, 2018

just make sure to mention ecl-ext is not available for 64 bit targets because threads already works. Could avoid possible confusion i guess?

@phoe

This comment has been minimized.

Copy link

commented Jan 3, 2018

I am confused now. Is ECL-EXT 32-bit? Where can I get a 64-bit one?

@its-pointless

This comment has been minimized.

Copy link
Contributor

commented Jan 3, 2018

If you are on arm or i686 its 32 bit
Aarch64 or x86_64 its 64bit
unless you are using a chromebook you are using arm which is 32bit,

@phoe

This comment has been minimized.

Copy link

commented Jan 3, 2018

Understood. I have updated my blogpost - can you check if it is better now?

@OverkillGuy

This comment has been minimized.

Copy link

commented Nov 5, 2018

Digging up dead tickets: I've also tried my hand at building SBCL from the disabled package.
See my fork at https://github.com/OverkillGuy/termux-packages/tree/sbcl-build.
I seem to have an issue with pthreads constants not defined.
Here's my compile log: sbcl-compile-error.log
I'm going doing the rabbit hole of understanding what the hell is up, yey my first time doing Makefile-spelunking!

aarch64-linux-android-clang  -Oz -g -Wall -Wundef -Wsign-compare -Wpointer-arith -O3 -I/data/data/com.termux/files/usr/include -I. -DSBCL_PREFIX=\"'/data/data/com.termux/files/usr'\"  -c -o linux-os.o linux-os.c
linux-os.c:183:14: warning: implicit declaration of function 'confstr' is invalid in C99
      [-Wimplicit-function-declaration]
  size_t n = confstr (_CS_GNU_LIBPTHREAD_VERSION, NULL, 0);
             ^
linux-os.c:183:23: error: use of undeclared identifier '_CS_GNU_LIBPTHREAD_VERSION'
  size_t n = confstr (_CS_GNU_LIBPTHREAD_VERSION, NULL, 0);
                      ^
linux-os.c:186:16: error: use of undeclared identifier '_CS_GNU_LIBPTHREAD_VERSION'
      confstr (_CS_GNU_LIBPTHREAD_VERSION, buf, n);
               ^
1 warning and 2 errors generated.
<builtin>: recipe for target 'linux-os.o' failed

Hoping my tiny contribution can inspire others, or something.
Will report if I get any further

@phoe

This comment has been minimized.

Copy link

commented Nov 5, 2018

use of undeclared identifier '_CS_GNU_LIBPTHREAD_VERSION'

It seems that the C symbol for _CS_GNU_LIBPTHREAD_VERSION was not found for some reason.

I assume that all of your pthread headers are properly included, aren't they?

@OverkillGuy

This comment has been minimized.

Copy link

commented Nov 5, 2018

Indeed, the wrong file seems included? linux-os.c has a variant for arm64 called arm64-linux-os.c, but for some reason, the generic one was compiled. Could be a conf/flag issue.
Good. I don't like digging GNU PTHREAD things.

@dram

This comment has been minimized.

Copy link

commented Feb 1, 2019

Recently, it seems that latest ECL (code from git repo) can be built in Termux cleanly without any modification, and it also works with SLIME. Following is related commands:

git clone https://gitlab.com/embeddable-common-lisp/ecl.git
cd ecl
./configure --prefix=$HOME/.local --build=aarch64-linux-android --enable-gmp=included
make
make install

Anyone familiar with cross compilation can also have a try.

@ksaj

This comment has been minimized.

Copy link

commented May 5, 2019

Yup I haven't had the least bit of luck getting clisp or esl to compile. The ecl configure fails on a missing makeinfo for the manual, and I couldn't find that anywhere...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.