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.76k stars 2.16k forks source link

Compilation fails with bad architecture warning #14330

Open ktrace opened 2 years ago

ktrace commented 2 years ago

V full version: V 0.2.4 0699f32 OS: linux, Linux version 5.15.29-calculate (root@localhost) (gcc (Gentoo 11.2.1_p20220115 p4) 11.2.1 20220115, GNU ld (Gentoo 2.37_p1 p2) 2.37) #1 SMP PREEMPT Thu Mar 17 13:22:02 UTC 2022

'./v' -cg -W -o '2048' 'examples/2048/2048.v'

Expect to see normal compiling

See: tmp/v_1001/2048.4357934880370255081.tmp.c:24174: warning: assignment discards qualifiers from pointer target type /lib/libc.so.6: error: bad architecture tcc: error: referenced dll 'libc.so.6' not found /lib/libm.so.6: error: bad architecture tcc: error: /usr/lib64/libm.so: unrecognized file type 0 /usr/lib/libm.so: error: bad architecture /lib/libc.so.6: error: bad architecture tcc: error: referenced dll 'libc.so.6' not found /usr/lib/libXau.so.6: error: bad architecture tcc: error: referenced dll 'libXau.so.6' not found /usr/lib/libxcb.so.1: error: bad architecture tcc: error: referenced dll 'libxcb.so.1' not found /usr/lib/libX11.so: error: bad architecture tcc: error: library 'X11' not found builder error: C error. This should never happen.

ktrace commented 2 years ago
$ file /lib/libc.so.6
/lib/libc.so.6: ELF 32-bit LSB shared object, Intel 80386, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 3.2.0, stripped

but:

$ file /lib64/libc.so.6
/lib64/libc.so.6: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, stripped

Seems need better lib's detection

spytheman commented 2 years ago

Try compiling with your platform's gcc, i.e. try passing -cc gcc too.

ktrace commented 2 years ago

It's 'make check' after clone repo and 'make'. look like need ./v -cc gcc test-all, but "-cc gcc" just ignored.

spytheman commented 1 year ago

Can you please, explicitly run this exact command: ./v -cc gcc examples/2048/2048.v, and report if it works?

If it works, please also report the results of: gcc -print-search-dir

ktrace commented 1 year ago

Can you please, explicitly run this exact command: ./v -cc gcc examples/2048/2048.v, and report if it works?

Silently build without any warning, executable run successfully.

If it works, please also report the results of: gcc -print-search-dir

$ gcc -print-search-dirs установка: /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/ программы: =/usr/libexec/gcc/x86_64-pc-linux-gnu/11.3.0/:/usr/libexec/gcc/x86_64-pc-linux-gnu/11.3.0/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu/11.3.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/ библиотеки: =/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/lib/x86_64-pc-linux-gnu/11.3.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../x86_64-pc-linux-gnu/11.3.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../lib64/:/lib/x86_64-pc-linux-gnu/11.3.0/:/lib/../lib64/:/usr/lib/x86_64-pc-linux-gnu/11.3.0/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../:/lib/:/usr/lib/