vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.88k stars 2.17k forks source link

Cannot make on raspberry pi #7654

Closed shanko closed 3 years ago

shanko commented 3 years ago

Transcript below:

pi@raspberrypi:~/v(master)
$ git pull
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 12 (delta 0), reused 11 (delta 0), pack-reused 0
Unpacking objects: 100% (12/12), done.
From https://github.com/vlang/v
   ecc7c27c9..ef6011b94  master     -> origin/master
Updating ecc7c27c9..ef6011b94
Fast-forward
 vlib/v/fmt/tests/struct_default_field_expressions_keep.vv | 8 +++++++-
 vlib/v/parser/struct.v                                    | 1 +
 vlib/x/websocket/websocket_client.v                       | 3 +--
 3 files changed, 9 insertions(+), 3 deletions(-)
pi@raspberrypi:~/v(master)
$ make
make fresh_vc
make[1]: Entering directory '/home/pi/v'
git clone --depth 1 --quiet --single-branch https://github.com/vlang/vc ./vc
make[1]: Leaving directory '/home/pi/v'
cd ./vc && git clean -xf && git pull --quiet
make fresh_tcc
make[1]: Entering directory '/home/pi/v'
rm -rf ./thirdparty/tcc
git clone --depth 1 --quiet --single-branch --branch thirdparty-linux-arm https://github.com/vlang/tccbin ./thirdparty/tcc
warning: Could not find remote branch thirdparty-linux-arm to clone.
fatal: Remote branch thirdparty-linux-arm not found in upstream origin
make[1]: *** [Makefile:134: fresh_tcc] Error 128
make[1]: Leaving directory '/home/pi/v'
make: *** [Makefile:137: thirdparty/tcc/.git/config] Error 2
pi@raspberrypi:~/v(master)
$ uname -a
Linux raspberrypi 5.4.74-v7l+ #1366 SMP Fri Nov 6 14:41:33 GMT 2020 armv7l GNU/Linux
pi@raspberrypi:~/v(master)
$
ckqee commented 3 years ago

It appears you have a Raspberry Pi 2 ? Could be wrong - please can you confirm?

Can you try the following and let us know if this gets you further

git clone https://github.com/vlang/v

cd v

cd thirdparty

git clone git://repo.or.cz/tinycc.git

mv tinycc tcc 

cd tcc 

./configure --prefix=/var/tmp/tcc --crtprefix=/var/tmp/tcc/lib:/usr/lib64:/usr/lib/arm-linux-gnueabihf --libpaths=/var/tmp/tcc/lib:/usr/lib/arm-linux-gnueabihf:/usr/lib64:/usr/lib:/lib/arm-linux-gnueabihf:/lib:/usr/local/lib/arm-linux-gnueabihf:/usr/local/lib --debug

cd ..

cd ..

make

Save the above to a script say v.on.armv7l.sh then make it executable

chmod +x v.on.armv7l.sh

You should then see the following:

./v.on.armv7l.sh
Cloning into 'v'...
remote: Enumerating objects: 72, done.
remote: Counting objects: 100% (72/72), done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 66707 (delta 32), reused 30 (delta 15), pack-reused 66635
Receiving objects: 100% (66707/66707), 25.26 MiB | 3.52 MiB/s, done.
Resolving deltas: 100% (47617/47617), done.
Checking out files: 100% (2158/2158), done.
Cloning into 'tinycc'...
remote: Counting objects: 13981, done.
remote: Compressing objects: 100% (3673/3673), done.
remote: Total 13981 (delta 10219), reused 13939 (delta 10180)
Receiving objects: 100% (13981/13981), 4.00 MiB | 3.13 MiB/s, done.
Resolving deltas: 100% (10219/10219), done.
Binary directory    /var/tmp/tcc/bin
TinyCC directory    /var/tmp/tcc/lib/tcc
Library directory   /var/tmp/tcc/lib
Include directory   /var/tmp/tcc/include
Manual directory    /var/tmp/tcc/share/man
Info directory      /var/tmp/tcc/share/info
Doc directory       /var/tmp/tcc/share/doc
Source path         /home/pi/v_dir/v/thirdparty/tcc
C compiler          gcc (8.3)
Target OS           Linux
CPU                 arm
Triplet             arm-linux-gnueabihf
Config              strip=no arm_eabihf arm_vfp arm_vfp
Creating config.mak and config.h
make fresh_vc
make[1]: Entering directory '/home/pi/v_dir/v'
git clone --depth 1 --quiet --single-branch https://github.com/vlang/vc ./vc
make[1]: Leaving directory '/home/pi/v_dir/v'
cd ./vc && git clean -xf && git pull --quiet
cd ./thirdparty/tcc && git clean -xf && git pull --quiet
Removing config.h
Removing config.mak
Removing config.texi
cc  -g -std=gnu99 -w -o ./v ./vc/v.c -lm -lpthread
./v self
V self compiling ...
make modules
make[1]: Entering directory '/home/pi/v_dir/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 '/home/pi/v_dir/v'
V has been successfully built
V 0.2.1 7bcc5af

real    2m42.006s
user    2m8.951s
sys     0m4.305s
shanko commented 3 years ago

Thanks a lot for looking into this @ckqee, it worked like a charm. Transcript as below:

pi@raspberrypi:~/v(master)
$ git pull
remote: Enumerating objects: 364, done.
remote: Counting objects: 100% (364/364), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 473 (delta 325), reused 340 (delta 314), pack-reused 109
Receiving objects: 100% (473/473), 224.45 KiB | 798.00 KiB/s, done.
Resolving deltas: 100% (332/332), completed with 107 local objects.
From https://github.com/vlang/v
   13cd7e88e..f7135979f  master     -> origin/master
 * [new branch]          vweb2      -> origin/vweb2
   6703de0c2..74580233e  vweb_embed -> origin/vweb_embed
Updating 13cd7e88e..f7135979f
Fast-forward
 .github/workflows/binary_artifact.yml              |   6 +-
 .github/workflows/ci.yml                           |  53 +++---
 .github/workflows/periodic.yml                     |   2 +-
 .github/workflows/prebuilt.yml                     |   2 +-
 .gitignore                                         |   1 +
 CHANGELOG.md                                       |   1 +
 cmd/tools/gen_vc.v                                 |  23 +--
 cmd/tools/vwipe-cache.v                            |  13 ++
 cmd/v/help/build.txt                               |   2 +-
 cmd/v/help/other.txt                               |   3 +
 cmd/v/v.v                                          |   1 +
 doc/docs.md                                        |  12 +-
 examples/2048/2048.v                               |   5 +-
 examples/flappylearning/game.v                     |  36 +++-
 examples/vweb/vweb_assets/vweb_assets.v            |  15 +-
 examples/vweb/vweb_example.v                       |  26 +--
 make.bat                                           |   3 -
 tutorials/building-a-simple-web-blog-with-vweb.md  |  23 +--
 tutorials/code/blog/blog.v                         |  31 ++--
 vlib/builtin/cfns.c.v                              |   2 +-
 vlib/builtin/map_test.v                            |  20 ++
 vlib/builtin/utf8_test.v                           |   8 +
 vlib/cli/command_test.v                            |   4 +-
 vlib/clipboard/clipboard_test.v                    |   4 +-
 vlib/clipboard/clipboard_windows.c.v               |   2 +-
 vlib/clipboard/x11/clipboard.c.v                   |   2 +
 vlib/gg/gg.v                                       |   2 +
 vlib/live/common.v                                 |   2 +-
 vlib/os/os_c.v                                     |  12 +-
 vlib/sokol/c/declaration.c.v                       |   1 +
 vlib/sqlite/sqlite.v                               |   1 -
 vlib/v/ast/ast.v                                   |  10 +-
 vlib/v/ast/str.v                                   |   2 +-
 vlib/v/builder/cc.v                                |   4 +-
 vlib/v/checker/check_types.v                       |   2 +-
 vlib/v/checker/checker.v                           | 201 ++++++++++++++++-----
 vlib/v/checker/tests/any_int_float_ban_err.out     |  41 +++++
 vlib/v/checker/tests/any_int_float_ban_err.vv      |  15 ++
 .../v/checker/tests/map_init_key_duplicate_err.out |   6 +
 vlib/v/checker/tests/map_init_key_duplicate_err.vv |   2 +
 vlib/v/checker/tests/map_init_wrong_type.out       |  16 +-
 vlib/v/checker/tests/map_init_wrong_type.vv        |   2 +
 vlib/v/checker/tests/method_op_err.out             |  27 +++
 vlib/v/checker/tests/method_op_err.vv              |  25 +++
 vlib/v/checker/tests/reference_return.out          |   7 +
 vlib/v/checker/tests/reference_return.vv           |  14 ++
 vlib/v/checker/tests/sum_type_exists.out           |   6 +-
 vlib/v/checker/tests/vweb_routing_checks.out       |  24 +--
 vlib/v/checker/tests/vweb_routing_checks.vv        |  11 +-
 vlib/v/gen/auto_eq_methods.v                       |  53 +++---
 vlib/v/gen/auto_str_methods.v                      |   4 +-
 vlib/v/gen/cgen.v                                  |  60 +++---
 vlib/v/gen/cmain.v                                 |   4 +
 vlib/v/gen/comptime.v                              |   2 +-
 vlib/v/gen/fn.v                                    |  25 ++-
 vlib/v/gen/x64/gen.v                               |  74 +++++---
 vlib/v/parser/containers.v                         |   4 +-
 vlib/v/parser/fn.v                                 |   9 +-
 vlib/v/parser/parser.v                             |  27 ++-
 vlib/v/parser/pratt.v                              |  10 +-
 vlib/v/parser/struct.v                             |  14 +-
 vlib/v/parser/tests/embed_pub_mut_err.out          |   7 +
 vlib/v/parser/tests/embed_pub_mut_err.vv           |   9 +
 vlib/v/parser/tests/invalid_fn_decl_script_err.out |   7 +
 vlib/v/parser/tests/invalid_fn_decl_script_err.vv  |   5 +
 vlib/v/pref/pref.v                                 |   4 +
 vlib/v/scanner/scanner.v                           |  13 --
 vlib/v/table/table.v                               |   3 +-
 vlib/v/table/types.v                               |   2 -
 vlib/v/tests/complex_assign_test.v                 |   2 -
 vlib/v/tests/field_publicity/embed.v               |  10 +
 vlib/v/tests/generics_method_test.v                |  37 ++++
 ...or_overloading_with_string_interpolation_test.v |  32 ++--
 vlib/v/tests/ref_return_test.v                     |  14 ++
 vlib/v/tests/sizeof_test.v                         |  13 +-
 vlib/v/tests/str_gen_test.v                        |  46 ++++-
 vlib/v/tests/struct_embed_test.v                   |  69 +++++++
 vlib/v/token/token.v                               |  13 +-
 vlib/v/util/util.v                                 |  18 +-
 vlib/vweb/README.md                                |   4 +-
 vlib/vweb/tests/vweb_test.v                        |  11 +-
 vlib/vweb/tests/vweb_test_server.v                 |  34 ++--
 vlib/vweb/vweb.v                                   |  98 +++++-----
 vlib/x/json2/decoder.v                             |   2 +-
 vlib/x/json2/encoder.v                             |   6 -
 85 files changed, 1093 insertions(+), 385 deletions(-)
 create mode 100644 cmd/tools/vwipe-cache.v
 create mode 100644 vlib/v/checker/tests/any_int_float_ban_err.out
 create mode 100644 vlib/v/checker/tests/any_int_float_ban_err.vv
 create mode 100644 vlib/v/checker/tests/method_op_err.out
 create mode 100644 vlib/v/checker/tests/method_op_err.vv
 create mode 100644 vlib/v/checker/tests/reference_return.out
 create mode 100644 vlib/v/checker/tests/reference_return.vv
 create mode 100644 vlib/v/parser/tests/embed_pub_mut_err.out
 create mode 100644 vlib/v/parser/tests/embed_pub_mut_err.vv
 create mode 100644 vlib/v/parser/tests/invalid_fn_decl_script_err.out
 create mode 100644 vlib/v/parser/tests/invalid_fn_decl_script_err.vv
 create mode 100644 vlib/v/tests/field_publicity/embed.v
 create mode 100644 vlib/v/tests/generics_method_test.v
 create mode 100644 vlib/v/tests/ref_return_test.v
pi@raspberrypi:~/v(master)
$ cd thirdparty
pi@raspberrypi:~/v/thirdparty(master)
$ git clone git://repo.or.cz/tinycc.git
Cloning into 'tinycc'...
remote: Counting objects: 13981, done.
remote: Compressing objects: 100% (3673/3673), done.
remote: Total 13981 (delta 10219), reused 13939 (delta 10180)
Receiving objects: 100% (13981/13981), 4.00 MiB | 1.44 MiB/s, done.
Resolving deltas: 100% (10219/10219), done.
pi@raspberrypi:~/v/thirdparty(master+)
$ mv tinycc tcc
pi@raspberrypi:~/v/thirdparty(master)
$ cd tcc
pi@raspberrypi:~/v/thirdparty/tcc(mob)
$ ./configure --prefix=/var/tmp/tcc --crtprefix=/var/tmp/tcc/lib:/usr/lib64:/usr/lib/arm-linux-gnueabihf --libpaths=/var/tmp/tcc/lib:/usr/lib/arm-linux-gnueabihf:/usr/lib64:/usr/lib:/lib/arm-linux-gnueabihf:/lib:/usr/local/lib/arm-linux-gnueabihf:/usr/local/lib --debug
Binary directory    /var/tmp/tcc/bin
TinyCC directory    /var/tmp/tcc/lib/tcc
Library directory   /var/tmp/tcc/lib
Include directory   /var/tmp/tcc/include
Manual directory    /var/tmp/tcc/share/man
Info directory      /var/tmp/tcc/share/info
Doc directory       /var/tmp/tcc/share/doc
Source path         /home/pi/v/thirdparty/tcc
C compiler          gcc (8.3)
Target OS           Linux
CPU                 arm
Triplet             arm-linux-gnueabihf
Config              strip=no arm_eabihf arm_vfp arm_vfp
Creating config.mak and config.h
pi@raspberrypi:~/v/thirdparty/tcc(mob)
$ cd ..
pi@raspberrypi:~/v/thirdparty(master)
$ cd ..
pi@raspberrypi:~/v(master)
$ make
cd ./vc && git clean -xf && git pull --quiet
cd ./thirdparty/tcc && git clean -xf && git pull --quiet
Removing config.h
Removing config.mak
Removing config.texi
cc  -g -std=gnu99 -w -o ./v ./vc/v.c -lm -lpthread 
./v self
V self compiling ...
make modules
make[1]: Entering directory '/home/pi/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 '/home/pi/v'
V has been successfully built
V 0.2.1 f713597
pi@raspberrypi:~/v(master)

$ v version
V 0.2.1 f713597
pi@raspberrypi:~/v(master)
$ 
shanko commented 3 years ago

Oh, forgot to add details about my Raspberry Pi 4 Model B Rev 1.1:

pi@raspberrypi:~/v(master)
$ cat /proc/cpuinfo
processor   : 0
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 144.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

processor   : 1
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 144.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

processor   : 2
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 144.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

processor   : 3
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 144.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

Hardware    : BCM2711
Revision    : c03111
Serial      : 10000000876be23f
Model       : Raspberry Pi 4 Model B Rev 1.1
pi@raspberrypi:~/v(master)
$ 
malcolmrjones commented 3 years ago

I also encountered the same issue but it was resolved using @ckqee given solution.

System Info:

spaceface777 commented 3 years ago

I've pushed a new thirdparty-linux-arm branch to the tccbin repo - this should fix compilation on 32-bit arm devices like the Raspberry Pi.