Open UNIcodeX opened 5 years ago
BTW, cross compilation of the same program from Linux to Windows also seems to break:
`"/home/simon/.vmodules/vlib/builtin.o"` not found
(.vmodules
is present, but no compiled modules are there).
If you have working cross-compiler Windows->Linux in PATH, for example x86_64-linux-gnu-gcc
, you can just call v --cc x86_64-linux-gnu-gcc fib_rec.v
That doesn't work for me.
> $ v --cc x86_64-w64-mingw32-gcc fibrec.v
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -ldl
collect2: error: ld returned 1 exit status
V error: C error. This should never happen. Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose
Incidentally, to test, since it's a similar project, I tried cross-compilation with Nim via nim c -d:release -d:mingw --opt:speed fib_rec.nim
and the resultant executable runs properly in both wine and on a test Windows 8 box.
This at least lets me know that my machine has the proper toolchain to build cross platform executables.
Yes, something broken for now, but here is the trick:
v -os windows -o fib_rec.c fib_rec.v
(-os windows
will do correct C preprocessing there)
x86_64-w64-mingw32-gcc fib_rec.c -o fib_rec.exe
That does work. Thanks for the elaboration.
EDIT: The executable is created, and can be executed, but never prints the output... :thinking:
output of ldd fib_rec.exe
$ ldd ./fib_rec.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff827db0000)
KERNEL32.DLL => /c/Windows/system32/KERNEL32.DLL (0x7ff827ab0000)
KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7ff825290000)
msvcrt.dll => /c/Windows/system32/msvcrt.dll (0x7ff826440000)
Known issue with msvcrt.dll, you need to configure mingw with gcc specs to link msvcr90 or later, or comment out _O_U8TEXT line in V code and rebuild (and obviously loose utf-8 support)
Alright. Thanks for the info.
BTW, cross compilation of the same program from Linux to Windows also seems to break:
`"/home/simon/.vmodules/vlib/builtin.o"` not found
(
.vmodules
is present, but no compiled modules are there).
I got the same issues, counld you share your idea?
Actual V (0.3.2) has another problem with this code, but with Clang compiler. Logged here - #17032
Can you try again?
V version: V 0.1.21 69b4594 OS: Windows 8
What did you do?
What did you expect to see? successful build of fib_rec program for Linux target.
What did you see instead?