Cross Building tcsh with ELLCC: Revisted

A long time ago, I wrote a post about building the tcsh shell with ELLCC. The subject came up again recently, so I thought that a revisit might be in order.

First, I downloaded the latest tcsh sources with wget and unpacked them with tar:

rich@dev:~$ wget ftp://ftp.astron.com/pub/tcsh/tcsh-6.19.00.tar.gz
--2016-08-31 16:16:59--  ftp://ftp.astron.com/pub/tcsh/tcsh-6.19.00.tar.gz
           => ‘tcsh-6.19.00.tar.gz’
Resolving ftp.astron.com (ftp.astron.com)... 38.117.134.18
Connecting to ftp.astron.com (ftp.astron.com)|38.117.134.18|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /pub/tcsh ... done.
==> SIZE tcsh-6.19.00.tar.gz ... 947135
==> PASV ... done.    ==> RETR tcsh-6.19.00.tar.gz ... done.
Length: 947135 (925K) (unauthoritative)

tcsh-6.19.00.tar.gz 100%[===================>] 924.94K  2.17MB/s    in 0.4s    

2016-08-31 16:17:00 (2.17 MB/s) - ‘tcsh-6.19.00.tar.gz’ saved [947135]

rich@dev:~$ tar xfp tcsh-6.19.00.tar.gz
rich@dev:~$ 

I used wget to get tcsh, but you could also use a web browser.

Next I went into the source directory and ran configure to set up for an ELLCC build:

rich@dev:~$ cd tcsh-6.19.00/
rich@dev:~/tcsh-6.19.00$ CC="/home/rich/ellcc/bin/ecc -target x86_64-linux" CPP="${CC} -E" ./configure
checking for a BSD-compatible install... /usr/bin/install -c
[snip lot's of configure output]
config.status: creating config.h
config.status: executing ./atconfig commands
rich@dev:~/tcsh-6.19.00$ 

In this case I configured for an x86_64-linux host. A little later I’ll configure the build for a MIPS.

Now for the build:

rich@dev:~/tcsh-6.19.00$ make
grep 'ERR_' ./sh.err.c | grep '^#define' >> sh.err.h.tmp
sh.err.h recreated.
/home/rich/ellcc/bin/ecc -target x86_64-linux -E -I. -I. -D_PATH_TCSHELL='"/usr/local/bin/tcsh"'    -D_h_tc_const\
    ./tc.const.c | \
    sed -n -e 's/^\(Char STR[a-zA-Z0-9_]*\) *\[ *\].*/extern \1[];/p' | \
    sort >> tc.const.h.tmp
tc.const.h recreated.
/home/rich/ellcc/bin/ecc -target x86_64-linux -c -g -O2 -I. -I. -D_PATH_TCSHELL='"/usr/local/bin/tcsh"'    sh.c
/home/rich/ellcc/bin/ecc -target x86_64-linux -c -g -O2 -I. -I. -D_PATH_TCSHELL='"/usr/local/bin/tcsh"'    [snip lots of files compiled]
/home/rich/ellcc/bin/ecc -target x86_64-linux -c -g -O2 -I. -I. -D_PATH_TCSHELL='"/usr/local/bin/tcsh"'    sh.proc.c
sh.proc.c:155:16: error: variable has incomplete type 'union wait'
    union wait w;
               ^
sh.proc.c:155:11: note: forward declaration of 'union wait'
    union wait w;
          ^
1 error generated.
Makefile:465: recipe for target 'sh.proc.o' failed
make: *** [sh.proc.o] Error 1
rich@dev:~/tcsh-6.19.00$ 

It turns out the ELLCC’s standard C library doesn’t support a BSD style wait, so I added a conditional compilation around lin 50 of sh.proc.c:

#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
# if !defined(__ANDROID__) && !defined(__ELLCC__)
#  define BSDWAIT
# endif
#endif /* _BSD || (IRIS4D && __STDC__) || __lucid || glibc */

Now the make succeeded, but when I tried to run the shell I got:

rich@dev:~/tcsh-6.19.00$ ./tcsh
(nil) current memory allocation:
free:       0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
used:       0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
        Total in use: 0, total free: 0
        Allocated memory from 0x1a00000 to 0xffffffffffffffff.  Real top at 0x1a00000
nbytes=56: Out of memory
Aborted (core dumped)
rich@dev:~/tcsh-6.19.00$ 

Not good! It turned out that tcsh tries to to its own memory allocation using sbrk() rather than malloc() by default. A quick edit of config_f.h (around line 213) adding another conditional compilation fixed it:

#if defined(__MACHTEN__) || defined(PURIFY) || defined(MALLOC_TRACE) || defined(_OSD_POSIX) || defined(__MVS__) || defined (__CYGWIN__) || defined(__GLIBC__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__ELLCC__)
# define SYSMALLOC
#else
# undef SYSMALLOC
#endif

You have to manually delete tc.alloc.o and run make again for this change to take affect:

rich@dev:~/tcsh-6.19.00$ rm tc.alloc.o
rich@dev:~/tcsh-6.19.00$ make
/home/rich/ellcc/bin/ecc -target x86_64-linux -E -I. -I. -D_PATH_TCSHELL='"/usr/local/bin/tcsh"'    -D_h_tc_const\
    ./tc.const.c | \
    sed -n -e 's/^\(Char STR[a-zA-Z0-9_]*\) *\[ *\].*/extern \1[];/p' | \
    sort >> tc.const.h.tmp
tc.const.h unchanged.
/home/rich/ellcc/bin/ecc -target x86_64-linux -c -g -O2 -I. -I. -D_PATH_TCSHELL='"/usr/local/bin/tcsh"'    tc.alloc.c
rm -f tcsh core
/home/rich/ellcc/bin/ecc -target x86_64-linux -o tcsh  -g -O2 -I. -I. sh.o sh.dir.o sh.dol.o sh.err.o sh.exec.o sh.char.o sh.exp.o sh.file.o sh.func.o sh.glob.o sh.hist.o sh.init.o sh.lex.o sh.misc.o sh.parse.o sh.print.o sh.proc.o sh.sem.o sh.set.o sh.time.o glob.o dotlock.o mi.termios.o ma.setp.o vms.termcap.o tw.help.o tw.init.o tw.parse.o tw.spell.o tw.comp.o tw.color.o ed.chared.o ed.refresh.o ed.screen.o ed.init.o ed.inputl.o ed.defns.o ed.xmap.o ed.term.o tc.alloc.o tc.bind.o tc.const.o tc.defs.o tc.disc.o tc.func.o tc.nls.o tc.os.o tc.printf.o tc.prompt.o tc.sched.o tc.sig.o tc.str.o tc.vers.o tc.who.o  -lncurses   
clang-3.9: warning: argument unused during compilation: '-g'
make[1]: Entering directory '/home/rich/tcsh-6.19.00/nls'
make[1]: Nothing to be done for 'catalogs'.
make[1]: Leaving directory '/home/rich/tcsh-6.19.00/nls'

Now when I run tcsh I get:

rich@dev:~/tcsh-6.19.00$ ./tcsh
[~/tcsh-6.19.00] dev% set
_
addsuffix
anyerror
arch    Linux-x86_64
arch1   Linux
arch2   x86_64
arch3
argv    ()
autolist
cdpath  (.. /home/rich /usr/rich/src /usr/src /sys/arch/i386 /usr/local/etc/httpd/htdocs)
cdtohome
csubstnonl
cwd     /home/rich/tcsh-6.19.00
dirstack        /home/rich/tcsh-6.19.00
echo_style      both
edit
elegant /home/rich/elegant
euid    1000
euser   rich
gid     1000
group   rich
histdup erase
history 1000
home    /home/rich
iarch   Linux-x86_64
killring        30
notify
owd
path    (/opt/microchip/mplabc32/v2.01/bin /opt/jdk1.5.0_06/jre/bin /usr/local/bin /sbin /usr/sbin /usr/lib64/qt-3.3/bin /usr/lib64/ccache /usr/local/bin /usr/bin /bin /usr/games /usr/local/sbin /usr/sbin /home/rich/.local/bin /home/rich/bin)
prompt  [%~] %m% 
prompt2 %R? 
prompt3 CORRECT>%R (y|n|e|a)? 
promptchars     $#
savehist        (1024 merge)
shell   /usr/local/bin/tcsh
shlvl   4
sourced 0
status  0
tcsh    6.19.00
term    xterm
uid     1000
user    rich
version tcsh 6.19.00 (Astron) 2015-05-21 (x86_64-unknown-linux) options wide,nls,dl,al,kan,rh,color,filec
[~/tcsh-6.19.00] dev% exit
exit
rich@dev:~/tcsh-6.19.00$

Nice! Now what about the MIPS? I cleaned up and did a new configure, but it failed:

rich@dev:~/tcsh-6.19.00$ make distclean
make[1]: Entering directory '/home/rich/tcsh-6.19.00/nls'
rm -f C.cat et.cat finnish.cat french.cat german.cat greek.cat italian.cat ja.cat pl.cat russian.cat spanish.cat ukrainian.cat
make[1]: Leaving directory '/home/rich/tcsh-6.19.00/nls'
rm -f a.out strings x.c xs.c tcsh tcsh.a _MAKE_LOG gethost
rm -f *.o *.i *.s
rm -f sh.prof.c ed.defns.h tc.const.h sh.err.h tc.defs.c
rm -f tcsh.*.m tcsh.*.cat
rm -f Makefile config.h config_p.h
rm -f config.status config.cache config.log tcsh.ps
rm -f missing
rm -rf autom4te.cache
rm -f *~ #*
rich@dev:~/tcsh-6.19.00$ CC="/home/rich/ellcc/bin/ecc -target mips32r2el-linux" CPP="${CC} -E" ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking cached host tuple... ok
Tcsh will use configuration file `linux'.
checking for gcc... /home/rich/ellcc/bin/ecc -target mips32r2el-linux
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/home/rich/tcsh-6.19.00':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
rich@dev:~/tcsh-6.19.00$

Not a big deal, though. All I have to do is tell configure that I’m cross compiling:

rich@dev:~/tcsh-6.19.00$  CC="/home/rich/ellcc/bin/ecc -target mips32r2el-linux" CPP="${CC} -E" ./configure -host=x86_64-linux
checking for a BSD-compatible install... /usr/bin/install -c
[snip lots of configure output]
config.status: executing ./atconfig commands
rich@dev:~/tcsh-6.19.00$ make
grep 'ERR_' ./sh.err.c | grep '^#define' >> sh.err.h.tmp
sh.err.h recreated.
/home/rich/ellcc/bin/ecc -target mips32r2el-linux -E -I. -I. -D_PATH_TCSHELL='"/usr/local/bin/tcsh"'    -D_h_tc_const\
    ./tc.const.c | \
    sed -n -e 's/^\(Char STR[a-zA-Z0-9_]*\) *\[ *\].*/extern \1[];/p' | \
    sort >> tc.const.h.tmp
tc.const.h recreated.
/home/rich/ellcc/bin/ecc -target mips32r2el-linux -c -g -O2 -I. -I. -D_PATH_TCSHELL='"/usr/local/bin/tcsh"'    sh.c
[snip lots of make output]
make[1]: Leaving directory '/home/rich/tcsh-6.19.00/nls'
rich@dev:~/tcsh-6.19.00$ 

Now I can run file on the tcsh executable to see what it is, and then try to run it:

ich@dev:~/tcsh-6.19.00$ file tcsh
tcsh: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, statically linked, BuildID[sha1]=778f05c34a07a583f3e56ad979235b0bbcb55279, not stripped  
rich@dev:~/tcsh-6.19.00$ ~/ellcc/bin/qemu-mipsel tcsh
exit
rich@dev:~/tcsh-6.19.00$

The good news is that the MIPS executable runs. The bad news is that it exits immediately. A little poking around finds that the MIPS tcsh can run single commands:

rich@dev:~/tcsh-6.19.00$ ~/ellcc/bin/qemu-mipsel tcsh -c set
_
addsuffix
anyerror
arch    Linux-x86_64
arch1   Linux
arch2   x86_64
arch3
argv    ()
cdpath  (.. /home/rich /usr/rich/src /usr/src /sys/arch/i386 /usr/local/etc/httpd/htdocs)
cdtohome
command set
csubstnonl
cwd     /home/rich/tcsh-6.19.00
dirstack        /home/rich/tcsh-6.19.00
echo_style      both
edit
elegant /home/rich/elegant
euid    1000
euser   rich
gid     1000
group   rich
histdup erase
history 1000
home    /home/rich
iarch   Linux-x86_64
killring        30
notify
owd
path    (/opt/microchip/mplabc32/v2.01/bin /opt/jdk1.5.0_06/jre/bin /usr/local/bin /sbin /usr/sbin /usr/lib64/qt-3.3/bin /usr/lib64/ccache /usr/local/bin /usr/bin /bin /usr/games /usr/local/sbin /usr/sbin /home/rich/.local/bin /home/rich/bin)
prompt  [%~] %m% 
savehist        (1024 merge)
shell   /usr/local/bin/tcsh
shlvl   4
sourced 0
status  0
tcsh    6.19.00
term    xterm
uid     1000
user    rich
version tcsh 6.19.00 (Astron) 2015-05-21 (mips-unknown-linux) options wide,nls,dl,al,kan,sm,rh,color,filec
rich@dev:~/tcsh-6.19.00$

I tried mips32r2-linux (big endian) and it failed exactly the same way. I also tried a similar cross build for arm32v7-linux and it worked fine. My guess is that there is a bug in QEMU that isn’t handling a MIPS system call correctly, but that investigation will have to be on another day. I’d love to test the binary on a real MIPS system, but I don’t have one. I suspect it might just work.

30 thoughts on “Cross Building tcsh with ELLCC: Revisted

  1. tMH

    Hello Rich! Since I made my 1st post about compiling tcsh for mipsel system – can I ask you to post these two binaries – for mips and mipsel – somewhere – I’ll make tests of on my iconbit , and reply back right after that!

    Reply
  2. tMH

    Rich, BTW, the main what I’m trying to get: I’ve browsed this post, others , and found that ELLCC compiler might be built without gdb, wihout qemu, without this musl.. Moreover, I need mipsel compiler only, thus I can get rid of whole-compiling for arm, sparc, x86(-64) and other targets.

    Can you, please, explain step by step how to compile all the stuff for mipsel target only, w/o those debug/develop/emulation tools ?
    Thanks in advance!

    Reply
  3. rich Post author

    You need to build the host version of ELLCC first, which will build the libraries, GDB, QEMU, etc. After that, you can just build the MIPS el version:

    cd ~/ellcc
    ./build
    ./build mips32r2el-linux
    

    -Rich

    Reply
  4. tMH

    OK, I did other test by removed all comments, i.e., returned /libecc/Makefile in its source mode, but after that I met this:
    )
    Making all in test
    make[4]: Nothing to be done for `all’.
    Making all in doc
    Making all in examples
    /home/dev/ellcc/libecc/../bin/ecc -target arm64v8-linux -DHAVE_CONFIG_H -I. -I../../../../src/libmetalink/doc/examples -I../.. -I../../../../src/libmetalink/lib/includes -I../../lib/includes -DHAVE_INTTYPES_H -target arm64v8-linux -g -MT metalinkcat.o -MD -MP -MF .deps/metalinkcat.Tpo -c -o metalinkcat.o metalinkcat.c
    mv -f .deps/metalinkcat.Tpo .deps/metalinkcat.Po
    /bin/bash ../../libtool –tag=CC –mode=link /home/dev/ellcc/libecc/../bin/ecc -target arm64v8-linux -target arm64v8-linux -g -target arm64v8-linux -o metalinkcat metalinkcat.o ../../lib/libmetalink.la
    libtool: link: /home/dev/ellcc/libecc/../bin/ecc -target arm64v8-linux -target arm64v8-linux -g -target arm64v8-linux -o metalinkcat metalinkcat.o ../../lib/.libs/libmetalink.a /usr/lib/x86_64-linux-gnu/libexpat.so
    clang-4.0: warning: argument unused during compilation: ‘-g’
    /home/dev/ellcc/bin/ecc-ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libexpat.so’
    clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
    make[5]: *** [metalinkcat] Error 1
    make[4]: *** [all-recursive] Error 1
    make[3]: *** [all-recursive] Error 1
    make[2]: *** [all] Error 2
    make[1]: *** [arm64v8-linux.libmetalink.build] Error 2
    make: *** [arm64v8-linux] Error 2

    Any ideas ? Rich, I still hope you can give the advice how to compile all the stuff for mipsel target ONLY…
    As you can see this error above happens in arm64v8-linux – which I do not need at all !

    Reply
    1. rich Post author

      The MIPS library build would fail for the same reason. The ARM library just happens to be built first. You can control which libraries are built by editing the file ~/ellcc/libecc/config/libraries

      Do you need to have a MIPS resident compiler or would just running a cross compiler be good enough?

      -Rich

      Reply
  5. tMH

    part1of3:
    The only reason up stated seeking mipsel compiled is to compile some small program on my iconbit/mipsel device, others targets can be thrown off…
    Anyway, I would like to bring up good news… I CAREFULLY once again inspected your post about libmetalink section and finally commented only these three lines – YES, as you pointed. Before I commented these lines with the start line “$(Configs):: musl.install”, that’s why I got second error and question to you:)

    Reply
  6. tMH

    part2of3:
    Now I see that compile process _still_ going on (4th hour on my core2duo with 6gb ram with mint linux):
    1 [|||||||||||||||||| 45.3%] Tasks: 65, 71 thr; 2 running
    2 [|||||||||||||||||||||||| 60.1%] Load average: 1.12 1.07 1.08
    Mem[|||||||||||||||||||||||||||||911/5967MB] Uptime: 06:55:40

    – I will wait till process is over and then – or – if another error will appear – will write results here:)

    Reply
  7. tMH

    Rich, this wordpress comments thinge is working with strange effects. It losing my posts, other times telling me that I making DUPLICATE post, although I am sure that I’m posting all fresh comment.

    Reply
  8. tMH

    part3of3:
    Anyway, Rich, I am still waiting for those two compiled binaries for mips/mipsel of TCSH.
    Please, pack ’em with your favorite archive program and upload this archive to RGHOST filehoster, then post URL here 🙂
    Thanks in advance!

    -Viktor

    Reply
  9. tMH

    Sorry, did not notice your tcsh downloads post, I’ll get ’em now. Thanks!
    next: OK, seems like ./build completed it progcess:
    Compiling rm.c
    ../../../../../bin/ecc -target x86_64-elk -c __stubbegin.S
    ../../../../../bin/ecc -g -target x86_64-elk -I../../../../../libecc/src/elk/sys -I../../../../../libecc/src/elk/include -c __stubend.c
    ../../../../../bin/ecc -target x86_64-linux -o rm_bin.o -r __stubbegin.o rm.o __stubend.o -nostdlib
    Installing the elk library for x86_64-elk
    dev@rd2 ~/ellcc/ $
    — 6+ hours passed 🙂

    Now I’ll run building with exact compile target as you, Rich, told me. I’ll report later.

    Reply
  10. tMH

    About your tcsh compiled binaries:
    /tmp/usbmounts/sda1/busybox.1.24.0 # ./tcsh.eb
    ./tcsh.eb: line 1: syntax error: unexpected “(”
    /tmp/usbmounts/sda1/busybox.1.24.0 # ./tcsh.el
    tcsh.el: No entry for terminal type “vt320”
    tcsh.el: using dumb terminal settings.
    exit
    /tmp/usbmounts/sda1/busybox.1.24.0 # export TERM=vt102
    /tmp/usbmounts/sda1/busybox.1.24.0 # ./tcsh.el
    tcsh.el: No entry for terminal type “vt102”
    tcsh.el: using dumb terminal settings.
    exit
    /tmp/usbmounts/sda1/busybox.1.24.0 # export TERM=linux
    /tmp/usbmounts/sda1/busybox.1.24.0 # ./tcsh.el
    tcsh.el: No entry for terminal type “linux”
    tcsh.el: using dumb terminal settings.
    exit
    /tmp/usbmounts/sda1/busybox.1.24.0 #
    — notice, that .el version doing exit all the time.. I hope I’ll get my version working because I made tests with ‘helloworld.c’ and binary of this compiled code ran on iconbit w/o problems.

    Reply
  11. tMH

    Ehh… my try did not complete ok.. Here is ending of the process:
    /home/dev/ellcc/bin/ecc -target mips32r2el-linux -c -g -O2 -I. -I. -D_PATH_TCSHELL='”/usr/local/bin/tcsh”‘ sh.print.c
    /home/dev/ellcc/bin/ecc -target mips32r2el-linux -c -g -O2 -I. -I. -D_PATH_TCSHELL='”/usr/local/bin/tcsh”‘ sh.proc.c
    sh.proc.c:155:16: error: variable has incomplete type ‘union wait’
    union wait w;
    ^
    sh.proc.c:155:11: note: forward declaration of ‘union wait’
    union wait w;
    ^
    1 error generated.
    make: *** [sh.proc.o] Error 1

    — The full configure & make log is located here: https://paste.fedoraproject.org/420997/47293286/raw/
    Any ideas how to fix this stuff ? Thanks in advance!
    -Viktor

    Reply
  12. rich Post author

    To fix the build, read my blog post. I had to make a few small source changes to tcsh.

    On a brighter note, try to run http://ellcc.org/downloads/ksh on your MIPS el system. I think you’lll have better luck with that shell (built from loksh).

    To build that shell, I went into ~/ellcc/libecc/ecclinux and edited the build file like this:

    elif [ "${BOARD}" = "malta" ] ; then
      ARCH=mips
      LINUX_CONFIG=${BOARD}_defconfig
      TARGET=mips32r2el-linux               # MIPS
      LD_EMUL=elf32elmip
      NO_VDSO=0
      DTB=0
      INSTALL=install
    

    (I added the “el”)

    I used this command line:
    ./build -exclude kernel malta

    The build fails after a while, which I’ll have to look into, but it does build ksh,

    You might also be interested in http://ellcc.org/downloads/vim

    -Rich

    Reply
  13. tMH

    Forgot to say – I did not run ./build mips32r2el-linux before compiling tcsh.
    Now it is running.. .45% so far 🙂 I’ll report later what’s happened after that.

    Reply
  14. tMH

    About KSH:
    /tmp/usbmounts/sda1/busybox.1.24.0 # ./ksh
    # set
    set
    HISTSIZE=1000
    HOSTNAME=iconBIT
    KSH_VERSION=’@(#)PD KSH v5.2.14 99/07/13.2′

    — looks like it works OK.

    I am still waiting for “./build mips32r2el-linux” process completion, then I’ll try to compile tcsh on my own (with your fixes, of course). Will report after that! 🙂 THANKS!!!

    Reply
  15. rich Post author

    Now you might understand why I don’t the tools build all possible targets. It takes a long time. 😉

    I think the tcsh problem might be a bug in the MIPS code in the musl C standard library, because the other targets seem to work OK.

    -Rich

    Reply
  16. tMH

    About VIM: looks like it running ok, but I see problems with terminal settings… might this is the reason why precompiled tcsh.el did not run OK…

    I’m still waiting for results of “./build mips32r2el-linux”, [ 84%] so far..

    Reply
  17. rich Post author

    I think you need to install the terminfo stuff from ~/ellcc/libecc/share to /usr/share on your target system.

    -Rich

    Reply
  18. tMH

    OK, I got the same results as you – tcsh exits immediately after run, complaining about terminal that cannot be found. About your proporsal:
    /tmp/usbmounts/sda1/busybox.1.24.0/share/terminfo # mv * /usr/share/terminfo/
    mv: can’t create directory ‘/usr/share/terminfo/1’: Read-only file system

    — This #$%#$% device mounts /system (where are located /usr, /usr/bin etc) folder as RO, so I cannot write nothing there… umount does not work either because system is running.. yet whole system is located on internal flash memory as I understand because there only one real HDD is mounted as you can see – /tmp/usbmounts/sda1, and /system is not there…

    Might be you’ll have time to discover why tcsh exits all the time ? And after that explain the method how to run tcsh w/o problems? Another thingie – ./configure should understand –prefix… I set –prefix onto /tmp/usbmounts/sda1/busybox.1.24.0/ – made ./bin and ./share – still my version of tcsh complains about terminal..

    Reply
  19. rich Post author

    I think you can set TERMINFO or TERMINFO_DIRS environment variables to override where terminfo stuff is put.

    I’ll try to figure out why tcsh is not working. Like I said, it could be a bug in musl.

    -Rich

    Reply
  20. tMH

    Surprisingly you were right, now my compiled version of tcsh is not complaining about terminal no more, but still does exit :
    /tmp/usbmounts/sda1/busybox.1.24.0/bin # export TERMINFO=”/tmp/usbmounts/sda1/busybox.1.24.0/share/
    terminfo”
    /tmp/usbmounts/sda1/busybox.1.24.0/bin # ./tcsh
    exit
    /tmp/usbmounts/sda1/busybox.1.24.0/bin #

    Reply
  21. tMH

    btw, your vim also runs w/o terminal error, seems like this TERMINFO variable is standard one for many utilities like this vim or tcsh, and other ones.

    Reply
  22. rich Post author

    I noticed you were from Moscow earlier. I was going to ask you why you were up so late. 🙂

    musl is a very good implementation of a C standard library, don’t mean to say that there is a bug in musl, it could be a bug in tcsh that relies on buggy behavior.

    One thing that is important to me for my ELLCC project: The entire runtime environment, all libraries, etc. are not GPL.

    Eventually, I’d like to get rid of all the GPL stuff in the build environment also.

    -Rich

    Reply

Leave a Reply

Your email address will not be published.