v icon indicating copy to clipboard operation
v copied to clipboard

Cross compilation with shared argument fails

Open zt64 opened this issue 1 year ago • 0 comments

Describe the bug

Attempting to cross compile a project using the -shared seems to ignore that and compile like a regular program.

Expected Behavior

The compiler should have finished without any errors, and a dll should be produced.

Current Behavior

With the command v -os windows -shared .

The following error is produced:

/usr/lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld: /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_w.o): in function `wmain':
/build/mingw-w64-crt/src/mingw-w64-v10.0.0/mingw-w64-crt/crt/crt0_w.c:23: undefined reference to `wWinMain'
collect2: error: ld returned 1 exit status
Cross compilation for Windows failed. Make sure you have mingw-w64 installed.
Try `sudo apt install -y mingw-w64` on Debian based distros, or `sudo pacman -S mingw-w64-gcc` on Arch, etc...

It fails to find a main function, which it should not be even looking for it as it should be a shared library.

Reproduction Steps

v -os windows -shared .

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.3.3 f02b423

Environment details (OS name and version, etc.)

OS: linux, "Arch Linux" Processor: 12 cpus, 64bit, little endian, Intel(R) Core(TM) i5-10600K CPU @ 4.10GHz CC version: cc (GCC) 12.2.1 20230201

getwd: /home/nick vmodules: /home/nick/.vmodules vroot: /home/nick/.local/share/v vexe: /home/nick/.local/share/v/v vexe mtime: 2023-03-11 22:18:19 is vroot writable: true is vmodules writable: true V full version: V 0.3.3 1a48d08.f02b423

Git version: git version 2.39.2 Git vroot status: weekly.2023.05-177-gf02b423f .git/config present: true thirdparty/tcc status: thirdparty-linux-amd64 12f392c3

zt64 avatar Mar 11 '23 22:03 zt64