V version:
# git rev-parse --short HEAD
c546e88
OS:
uLinux => https://github.com/prologic/ulinux
What did you do?
```sh
$ history
12 static-get -x -i -p / git
13 git clone https://github.com/vlang/v
14 git config --global http.sslVerify false
15 git clone https://github.com/vlang/v
16 cd v
17 make
18 static-get -x -i -p / make
19 make
20 export CC=tcc
21 make
22 git rev-parse --short HEAD
23 history
What did you expect to see?
V to successfully self-compile.
What did you see instead?
This error:
# make
cd /tmp/vc && git clean -xf && git pull --quiet
cd /var/tmp/tcc && git clean -xf && git pull --quiet
tcc -std=gnu11 -w -o v /tmp/vc/v.c -lm
./v self
V panic: V tool "/root/v/cmd/tools/vself.v" could not be compiled
V error: C compiler error, while attempting to run:
-----------------------------------------------------------
cc -std=gnu11 -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -Wno-unused-result -Wno-unused-function -Wno-missing-braces -Wno-unused-label -Werror=implicit-function-declaration -o "/root/v/cmd/tools/vself" "/root/.cache/v/vself.tmp.c" -lm -lpthread -ldl
-----------------------------------------------------------
Probably your C compiler is missing.
Please reinstall it, or make it available in your PATH.
On Debian/Ubuntu, run `sudo apt install build-essential`
TODO: print_backtrace_skipping_top_frames_linux 4 with tcc fails tests with "stack smashing detected" .
print_backtrace_skipping_top_frames is not implemented on this platform for now...
make: *** [all] Error 1
Also the currently available LInux prebuilt binary does not work; is this a dynamically linked binary?
# ./v
-sh: ./v: not found
Try doing export VFLAGS='-cc tcc' first, then make again.
I also discovered some more info about the pre-built binary package you provide:
# ldd v
/lib64/ld-linux-x86-64.so.2 (0x7fa377359000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fa377359000)
Error relocating v: backtrace_symbols: symbol not found
Error relocating v: backtrace: symbol not found
Error relocating v: __realpath_chk: symbol not found
Error relocating v: __memcpy_chk: symbol not found
Error relocating v: __vsnprintf_chk: symbol not found
Error relocating v: __printf_chk: symbol not found
Error relocating v: __fprintf_chk: symbol not found
Error relocating v: __vsprintf_chk: symbol not found
Since this system uses musl libc I symlinked some stuff v was expecting to be able to find, but it also looks like it is compiled against some symbols that this system doesn't have libraries for.
Thank you! This works.
# export VFLAGS='-cc tcc'
# export CC=tcc
# make
cd /tmp/vc && git clean -xf && git pull --quiet
cd /var/tmp/tcc && git clean -xf && git pull --quiet
tcc -std=gnu11 -w -o v /tmp/vc/v.c -lm
./v self
V Self Compiling...
make modules
make[1]: Entering directory `/root/v'
#./v build module vlib/builtin > /dev/null
#./v build module vlib/strings > /dev/null
#./v build module vlib/strconv > /dev/null
make[1]: Leaving directory `/root/v'
V has been successfully built
# ls
0.2_roadmap.txt CODE_OF_CONDUCT.md Dockerfile.alpine Makefile doc thirdparty v.mod
BSDmakefile CONTRIBUTING.md Dockerfile.cross README.md examples tutorials v_old
CHANGELOG.md Dockerfile LICENSE cmd make.bat v vlib
#
I'll create a PR to update the README regarding compilation on a tcc/musl system.
Last question; How should I package this up in the target system? Do I just need v and vlib somewhere?
@prologic : you need the v executable itself, vlib/ and cmd/ .
You also need the .git/ folder and the Makefile, if you intend for your users to be able to do v up. Otherwise, you have to replace cmd/tools/vup.v with a dummy program, for example:
fn main(){ println('v up is not supported on this system') } .
If you want to have your cmd/ folder readonly, you will also need to do: ./v build-tools before making the package, so that v can precompile them.
Personally, I would not bother with packaging yet, since v is moving fast, and has no backwards compatibility guarantees for now. You can just clone it in a folder, for example /opt/v/ , then do v up to keep it up to date.
Most helpful comment
@prologic : you need the v executable itself, vlib/ and cmd/ .
You also need the .git/ folder and the Makefile, if you intend for your users to be able to do
v up. Otherwise, you have to replacecmd/tools/vup.vwith a dummy program, for example:fn main(){ println('v up is not supported on this system') }.If you want to have your cmd/ folder readonly, you will also need to do:
./v build-toolsbefore making the package, so that v can precompile them.Personally, I would not bother with packaging yet, since v is moving fast, and has no backwards compatibility guarantees for now. You can just clone it in a folder, for example /opt/v/ , then do
v upto keep it up to date.