Building on ArchLinux or any distro that is segfaulting
I was able to build this on ArchLinux after reading some comments here on the issue tracker, not sure if this also may apply to other distributions:
cd ~/code || mkdir ~/code && cd ~/code
git clone https://github.com/vlang/v
cd v/compiler
wget https://vlang.io/v.c
gcc -lgcc_s -w -o vc v.c
./vc -o v .
./v --help
Giving flags like --help (./vc --help) to the generated vc binary will cause a segfault, but it will be able to compile the v files and generate the v executable. If you have clang installed you can use it instead of gcc to have a better behaving vc binary that doesn' t segfaults:
clang -w -o vc v.c
Hope this helps someone else, maybe default build instructions on README need some update...
edit: added clang note
That still gives me a segfault (Devuan Ascii, gcc 6.3.0).
Edited to say, didn't download originally to ~/code/v but to ~/git/v. So I should have r'd tfm :) Once in the proper directory it built properly.
./vc --help still segfaults though.
yes, I use it to compile on Manjaro,and gcc is 8.3.0,but is crashed when ./vc --help #438 and just remove -std=c11,there is no crash,but I dont known why。
try clang if u have. https://github.com/vlang/v/issues/329#issuecomment-504719104
try clang if u have. #329 (comment)
With clang works, i have try with gcc but with vc --help crash, unless compile any example app
I can report the generated executable doesn't crash with --help paramenter if compiled with clang as others mentioned:
clang -w -o vc v.c
./vc --help
which properly outputs:
errno=2 err='No such file or directory' V panic: --help doesnt exist
with gcc it shows:
[1] 15780 segmentation fault (core dumped) ./vc --help
and with valgrind ./vc --help:
==15935== Memcheck, a memory error detector ==15935== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==15935== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info ==15935== Command: ./vc --help ==15935== errno=2 err='No such file or directory' V panic: --help doesnt exist ==15935== ==15935== HEAP SUMMARY: ==15935== in use at exit: 28,371 bytes in 183 blocks ==15935== total heap usage: 202 allocs, 19 frees, 41,331 bytes allocated ==15935== ==15935== LEAK SUMMARY: ==15935== definitely lost: 329 bytes in 17 blocks ==15935== indirectly lost: 0 bytes in 0 blocks ==15935== possibly lost: 0 bytes in 0 blocks ==15935== still reachable: 28,042 bytes in 166 blocks ==15935== suppressed: 0 bytes in 0 blocks ==15935== Rerun with --leak-check=full to see details of leaked memory ==15935== ==15935== For counts of detected and suppressed errors, rerun with: -v ==15935== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
you should use -std=gnu11 for GCC like this #479, #464
https://aur.archlinux.org/packages/vlang-git
you should use
-std=gnu11for GCC like this #479, #464 https://aur.archlinux.org/packages/vlang-git
The AUR package does not works:
/usr/lib/vlang not found. Run: git clone https://github.com/vlang/v ~/code/v ==> ERROR: Se produjo un fallo en build(). Cancelando... Error making: vlang-git
@alfonsodg broken changes https://github.com/vlang/v/commit/b990f04064708fb9e16b1fc284c46a3a56bb7abd
@alfonsodg should be fixed
@alfonsodg should be fixed
Yes!! It works now....
`>>> [alfonsodg@aldebaran sql]$ v --help
-
To build a V program: v file.v
-
To get current V version: v version
-
To build an optimized executable: v -prod file.v `
why not using gnu flags? The advantage would be that with zsh you get a completion for free because gnu flags it can make a completion of with
compdef _gnu_generic v
Solved it: #507
Should be fixed by https://github.com/vlang/v/commit/baa4f9d0c9253463ccd29c6ac614a8d49565c01d