Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mingw can't create windows shared library #20445

Closed
kbkpbot opened this issue Jan 9, 2024 · 1 comment · Fixed by #20453
Closed

mingw can't create windows shared library #20445

kbkpbot opened this issue Jan 9, 2024 · 1 comment · Fixed by #20453
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Build V build error on any OS/CPU architecture. Status: Confirmed This bug has been confirmed to be valid by a contributor.

Comments

@kbkpbot
Copy link
Contributor

kbkpbot commented Jan 9, 2024

Describe the bug

When use mingw cross-compile windows shared library, it fail. Seems try to create a exe instead.

Reproduction Steps

library.v

module library

@[export: 'add_1']
pub fn add_1(x int, y int) int {
    name := 3
    println('hello from ${@FN} ${name}')
        return x + y
}

v -shared . -os windows

Expected Behavior

should create a .dll file

Current Behavior

Cross compiling for Windows...
/usr/bin/x86_64-w64-mingw32-ld: /usr/lib/gcc/x86_64-w64-mingw32/10-win32/../../../../x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-crt0_w.o): in function `wmain':
./build/x86_64-w64-mingw32-x86_64-w64-mingw32-crt/./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...

Possible Solution

Wrong cmd for creating shared libray?

Additional Information/Context

No response

V version

V full version: V 0.4.3 e30af86.10d738c

Environment details (OS name and version, etc.)

V full version: V 0.4.3 e30af86.10d738c
OS: linux, Ubuntu 22.04.3 LTS (WSL 2)
Processor: 16 cpus, 64bit, little endian, AMD Ryzen 7 7840H with Radeon 780M Graphics

getwd: /mnt/d/v/D2/test/dynamic_library_loader/modules/library
vexe: /home/lastgod/github/lang/v/v
vexe mtime: 2024-01-06 00:55:41

vroot: OK, value: /home/lastgod/github/lang/v
VMODULES: OK, value: /home/lastgod/.vmodules
VTMP: OK, value: /tmp/v_1001

Git version: git version 2.34.1
Git vroot status: weekly.2024.01.test2-19-g66d222cc-dirty (17 commit(s) behind V master)
.git/config present: true

CC version: cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3-dirty

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@kbkpbot kbkpbot added the Bug This tag is applied to issues which reports bugs. label Jan 9, 2024
@JalonSolov JalonSolov added the Status: Confirmed This bug has been confirmed to be valid by a contributor. label Jan 9, 2024
@JalonSolov
Copy link
Contributor

I get the same thing on Manjaro linux. I do have everything installed for cross-compiling, and it works fine when compiling an executable. Just not a dll.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Build V build error on any OS/CPU architecture. Status: Confirmed This bug has been confirmed to be valid by a contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants