Ingredients?
$ nim --version
Nim Compiler Version 1.6.14 [Linux: arm]
Compiled at 2023-06-29
Copyright (c) 2006-2023 by Andreas Rumpf
active boot switches: -d:release
$ tcc --version
tcc version 0.9.28rc 2023-10-25 mob@6b967b1 (ARM eabi Linux)
Run
What?
$ cat x.nim
echo "Hi, Nim!"
$ nim compile --cc:tcc x.nim
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
..........................................................
Hint: tcc -c -w -I/usr/lib/nim/lib -I/tmp/mc-yeti -o
/home/yeti/.cache/nim/x_d/@m..@s..@susr@slib@snim@[email protected]
/home/yeti/.cache/nim/x_d/@m..@s..@susr@slib@snim@[email protected] [Exec]
/home/yeti/.cache/nim/x_d/@m..@s..@susr@slib@snim@[email protected]:319:
error: unknown constraint 'q'
Error: execution of an external program failed: 'tcc -c -w
-I/usr/lib/nim/lib -I/tmp/mc-yeti -o
/home/yeti/.cache/nim/x_d/@m..@s..@susr@slib@snim@[email protected]
/home/yeti/.cache/nim/x_d/@m..@s..@susr@slib@snim@[email protected]'
Run
Digging...
$ awk '310<=NR && NR<=322'
/home/yeti/.cache/nim/x_d/@m..@s..@susr@slib@snim@[email protected]
static int __tcc_cas(int *ptr, int oldVal, int newVal)
{
unsigned char ret;
__asm__ __volatile__ (
" lock\n"
" cmpxchgl %2,%1\n"
" sete %0\n"
: "=q" (ret), "=m" (*ptr)
: "r" (newVal), "m" (*ptr), "a" (oldVal)
: "memory");
return ret;
}
Run
There I only can surrender.
On AMD64 it compiles:
$ nim compile --cc:tcc x.nim
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
..........................................................
CC: ../../usr/lib/nim/lib/std/private/digitsutils.nim
CC: ../../usr/lib/nim/lib/system/dollars.nim
CC: ../../usr/lib/nim/lib/system/io.nim
CC: ../../usr/lib/nim/lib/system.nim
CC: x.nim
Hint: [Link]
tcc: error: undefined symbol 'fabs'
Error: execution of an external program failed: 'tcc -o /tmp/mc-yeti/x
-ldl
/home/yeti/.cache/nim/x_d/@m..@s..@susr@slib@snim@slib@sstd@[email protected]
/home/yeti/.cache/nim/x_d/@m..@s..@susr@slib@snim@slib@[email protected]
/home/yeti/.cache/nim/x_d/@m..@s..@susr@slib@snim@slib@[email protected]
/home/yeti/.cache/nim/x_d/@m..@s..@susr@slib@snim@[email protected]
/home/yeti/.cache/nim/x_d/@mx.nim.c.o'
Run
...and yes, I know how to add `libm`, but that was not the problem here.
Does (accidentally?) someone know how to keep TinyCC on Debian/ARMEL
(Arm6HF/Pi1) happy?