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

Cannot cross compile to freebsd, windows works fine #22333

Open
dy-tea opened this issue Sep 27, 2024 · 0 comments
Open

Cannot cross compile to freebsd, windows works fine #22333

dy-tea opened this issue Sep 27, 2024 · 0 comments
Labels
Bug This tag is applied to issues which reports bugs. OS: FreeBSD Bugs/feature requests, that are specific to FreeBSD OS.

Comments

@dy-tea
Copy link

dy-tea commented Sep 27, 2024

Describe the bug

I have a project that is written in V and only depends on standard V modules. I am on linux and cross-compilation to windows works fine but I get a linker error when trying the same with freebsd.

Reproduction Steps

Create the following file main.v

fn main() {
	println('Hello World!')
}

Linux on Linux:

# v -os linux main.v
# ./main
Hello World!

Windows on Linux:

# v -os windows main.v
Cross compiling for Windows...
/home/dylan/Repos/rr-dl/main.exe has been successfully cross compiled for windows.
# WINEDEBUG=-all wine main.exe
wine: using kernel write watches, use_kernel_writewatch 1.
wineserver: using server-side synchronization.
wine: using kernel write watches, use_kernel_writewatch 1.
wine: using kernel write watches, use_kernel_writewatch 1.
wine: using kernel write watches, use_kernel_writewatch 1.
wine: using kernel write watches, use_kernel_writewatch 1.
wine: using kernel write watches, use_kernel_writewatch 1.
wine: using kernel write watches, use_kernel_writewatch 1.
wine: using kernel write watches, use_kernel_writewatch 1.
wine: using kernel write watches, use_kernel_writewatch 1.
Hello World!

FreeBSD on Linux:

#  v -os freebsd main.v

See output below in Current Behavior section.

Expected Behavior

Should compile a FreeBSD executable.

Current Behavior

Cross compilation for FreeBSD failed (second step, lld).
builder error: LLD 18.1.8 (compatible with GNU linkers)
ld.lld: error: undefined symbol: __errno_location
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_debug_strdup)
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_debug_strndup)
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_strdup)
>>> referenced 26 more times

ld.lld: error: undefined symbol: pthread_getattr_np
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_get_main_stack_base)
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_get_stack_base)

ld.lld: error: undefined symbol: __isoc23_strtoul
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_parse_mem_size_arg)
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_linux_main_stack_base)
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_parse_version)
>>> referenced 1 more times

ld.lld: error: undefined symbol: __sigsetjmp
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_find_limit_with_bound)
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_pthread_start_inner)

ld.lld: error: undefined symbol: __ctype_b_loc
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_linux_main_stack_base)
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_linux_main_stack_base)
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_linux_main_stack_base)
>>> referenced 1 more times

ld.lld: error: undefined symbol: __pthread_register_cancel
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_pthread_start_inner)

ld.lld: error: undefined symbol: __pthread_unregister_cancel
>>> referenced by gc.c
>>>               /home/dylan/.vmodules/cache/4b/4b046f6828f71c4330c78912f143fcad.module.builtin.o:(GC_pthread_start_inner)

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.7 372a402

Environment details (OS name and version, etc.)

V full version: V 0.4.7 fd7986c.372a402
OS: linux, "CachyOS"
Processor: 12 cpus, 64bit, little endian, 13th Gen Intel(R) Core(TM) i5-1335U

getwd: /home/dylan/Repos/rr-dl
vexe: /home/dylan/Repos/v/v
vexe mtime: 2024-09-27 17:15:42

vroot: OK, value: /home/dylan/Repos/v
VMODULES: OK, value: /home/dylan/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.46.2
Git vroot status: weekly.2023.45.1-1895-g372a4021
.git/config present: true

CC version: cc (GCC) 14.2.1 20240910
thirdparty/tcc status: thirdparty-linux-amd64 a0799a5

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.

@dy-tea dy-tea added the Bug This tag is applied to issues which reports bugs. label Sep 27, 2024
@esquerbatua esquerbatua added the OS: FreeBSD Bugs/feature requests, that are specific to FreeBSD OS. label Sep 27, 2024
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. OS: FreeBSD Bugs/feature requests, that are specific to FreeBSD OS.
Projects
None yet
Development

No branches or pull requests

2 participants