V version: V 0.1.21 a29c80c
OS: Gentoo (Linux 4.19.72-gentoo x86_64)
What did you do?
I downloaded V via git, compiled it successfully, and created a symlink on my path with sudo ./v symlink. Then I tried compiling the hello world example from https://vlang.io/with v hello.v:
fn main() {
areas := ['game', 'web', 'tools', 'science', 'systems',
'embedded', 'drivers', 'GUI', 'mobile']
for area in areas {
println('Hello, $area developers!')
}
}
What did you expect to see?
I expected compilation to succeed (with or without warnings) in creating a hello binary, which, when run, displayed the following output:
Hello, game developers!
Hello, web developers!
Hello, tools developers!
Hello, science developers!
Hello, systems developers!
Hello, embedded developers!
Hello, drivers developers!
Hello, GUI developers!
Hello, mobile developers!
What did you see instead?
/lib/libc.so.6: error: bad architecture
/lib64/libm.so.6: error: referenced dll 'libc.so.6' not found
/lib/libm.so.6: error: bad architecture
/usr/lib64/libm.so: error: unrecognized file type
/usr/lib...
(Use `v -g` to print the entire error message)
V error: C error. This should never happen. Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose
The full error message (with v -g hello.v):
C compiler=cc
all .v files:
["/home/cody/src/v/vlib/builtin/array.v", "/home/cody/src/v/vlib/builtin/builtin.v", "/home/cody/src/v/vlib/builtin/float.v", "/home/cody/src/v/vlib/builtin/hashmap.v", "/home/cody/src/v/vlib/builtin/int.v", "/home/cody/src/v/vlib/builtin/map.v", "/home/cody/src/v/vlib/builtin/option.v", "/home/cody/src/v/vlib/builtin/string.v", "/home/cody/src/v/vlib/builtin/utf8.v", "/home/cody/src/v/vlib/strings/builder_c.v", "/home/cody/src/v/vlib/strings/similarity.v", "/home/cody/src/v/vlib/strings/strings.v", "/home/cody/src/v/vlib/strconv/atoi.v", "hello.v"]
/lib/libc.so.6: error: bad architecture
/lib64/libm.so.6: error: referenced dll 'libc.so.6' not found
/lib/libm.so.6: error: bad architecture
/usr/lib64/libm.so: error: unrecognized file type
/usr/lib/libm.so: error: bad architecture
/lib/libc.so.6: error: bad architecture
/usr/lib64/libpthread.so: error: referenced dll 'libc.so.6' not found
/usr/lib/libpthread.so: error: bad architecture
/lib/libc.so.6: error: bad architecture
/usr/lib64/libdl.so: error: referenced dll 'libc.so.6' not found
/usr/lib/libdl.so: error: bad architecture
/lib64/libc.so.6: error: referenced dll 'ld-linux-x86-64.so.2' not found
/lib/libc.so.6: error: bad architecture
/usr/lib64/libc.so: error: unrecognized file type
/lib/libc.so.6: error: bad architecture
/lib/libc.so.6: error: bad architecture
/usr/lib/libc.so: error: unrecognized file type
tcc: error: undefined symbol '__gcc_personality_v0'
tcc: error: undefined symbol '_Unwind_Resume'
tcc: error: undefined symbol '_Unwind_GetIP'
tcc: error: undefined symbol '_Unwind_GetCFA'
tcc: error: undefined symbol '_Unwind_Backtrace'
tcc: error: undefined symbol '__unordtf2'
tcc: error: undefined symbol '__letf2'
V error: C error. This should never happen. Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose
The output of cc -v:
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/8.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-8.3.0-r1/work/gcc-8.3.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/8.3.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/8.3.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 8.3.0-r1 p1.1' --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-libmpx --disable-systemtap --enable-vtable-verify --enable-lto --without-isl --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 8.3.0 (Gentoo 8.3.0-r1 p1.1)
I noticed that a file named hello.tmp.c was created, and when I tried compiling that with cc -o hello hello.tmp.c, it succeeded in creating hello, which gave the expected output when run.
This is very strange.
Can you try v -show_c_cmd hello.v? @clpo13
(Sorry for the delay)
I hadn't updated v in a while on this computer, so this was run on version 0.1.21 eeea257 with the output of v -show_c_cmd -g hello.v being:
C compiler=cc
all .v files:
["/home/cody/src/v/vlib/builtin/array.v", "/home/cody/src/v/vlib/builtin/builtin.v", "/home/cody/src/v/vlib/builtin/float.v", "/home/cody/src/v/vlib/builtin/hashmap.v", "/home/cody/src/v/vlib/builtin/int.v", "/home/cody/src/v/vlib/builtin/map.v", "/home/cody/src/v/vlib/builtin/option.v", "/home/cody/src/v/vlib/builtin/string.v", "/home/cody/src/v/vlib/builtin/utf8.v", "/home/cody/src/v/vlib/strings/builder_c.v", "/home/cody/src/v/vlib/strings/similarity.v", "/home/cody/src/v/vlib/strings/strings.v", "/home/cody/src/v/vlib/strconv/atoi.v", "hello.v"]
==========
/var/tmp/tcc/bin/tcc -std=gnu11 -w -g -rdynamic -Werror=implicit-function-declaration -o "hello" "/home/cody/code/hello-v/hello.tmp.c" -lm -lpthread -ldl
/lib/libc.so.6: error: bad architecture
/lib64/libm.so.6: error: referenced dll 'libc.so.6' not found
/lib/libm.so.6: error: bad architecture
/usr/lib64/libm.so: error: unrecognized file type
/usr/lib/libm.so: error: bad architecture
/lib/libc.so.6: error: bad architecture
/usr/lib64/libpthread.so: error: referenced dll 'libc.so.6' not found
/usr/lib/libpthread.so: error: bad architecture
/lib/libc.so.6: error: bad architecture
/usr/lib64/libdl.so: error: referenced dll 'libc.so.6' not found
/usr/lib/libdl.so: error: bad architecture
/lib64/libc.so.6: error: referenced dll 'ld-linux-x86-64.so.2' not found
/lib/libc.so.6: error: bad architecture
/usr/lib64/libc.so: error: unrecognized file type
/lib/libc.so.6: error: bad architecture
/lib/libc.so.6: error: bad architecture
/usr/lib/libc.so: error: unrecognized file type
tcc: error: undefined symbol '__gcc_personality_v0'
tcc: error: undefined symbol '_Unwind_Resume'
tcc: error: undefined symbol '_Unwind_GetIP'
tcc: error: undefined symbol '_Unwind_GetCFA'
tcc: error: undefined symbol '_Unwind_Backtrace'
tcc: error: undefined symbol '__unordtf2'
tcc: error: undefined symbol '__letf2'
V error: C error. This should never happen. Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose
After this, I ran v up, so the version is now 0.1.23 ed5c9a2. The problem reported above no longer occurs. v -show_c_cmd hello.v now outputs:
==========
cc -std=gnu11 -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -Wno-unused-result -Wno-missing-braces -Wno-unused-label -Werror=implicit-function-declaration -o "hello" "/tmp/v/hello.tmp.c" -lm -lpthread -ldl
cc took 433 ms
=========
Whatever the problem was, it looks like it was fixed sometime between eeea257 and ed5c9a2. All tests run with v test-compiler succeed.
Sounds like maybe this can be closed if it's no longer an issue?
Most helpful comment
Sounds like maybe this can be closed if it's no longer an issue?