v icon indicating copy to clipboard operation
v copied to clipboard

incompatible redefinition of 'size_t'

Open RednibCoding opened this issue 1 year ago • 0 comments

Describe the bug

I have this code:

// main.v
fn main() {
    areas := ['game', 'web', 'tools', 'science', 'systems',
              'embedded', 'drivers', 'GUI', 'mobile']
    for area in areas {
        println('Hello, ${area} developers!')
    }
}

And want to compile it on windows 11 with: v main.v -freestanding

Then i get the following error:

==================
C:/Users/user/AppData/Local/Temp/v_0/main.01HXD2AJXNBAZTECS0SAW0QYZD.tmp.c:450: error: incompatible redefinition of 'size_t'
...
==================
(Use `v -cg` to print the entire error message)

builder error:
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .

Reproduction Steps

Try to comile the following code:

// main.v
fn main() {
    areas := ['game', 'web', 'tools', 'science', 'systems',
              'embedded', 'drivers', 'GUI', 'mobile']
    for area in areas {
        println('Hello, ${area} developers!')
    }
}

as follows: v main.v -freestanding

Expected Behavior

Should produce a binary

Current Behavior

Errors out

Possible Solution

No response

Additional Information/Context

When i use the flag -prod together with -freestanding i get a different error:

error: msvc compiler does not support inline assembly
  332 | fn sys_call0(scn u64) u64 {
  333 |     mut res := u64(0)
  334 |     asm amd64 {
      |     ~~~~~~~~~~~
  335 |         syscall
  336 |         ; =a (res)
C:/Users/user/Documents/DEV/DEPS/v/vlib/builtin/linux_bare/linux_syscalls.v:344:2: error: msvc compiler does not support inline assembly
  342 | fn sys_call1(scn u64, arg1 u64) u64 {
  343 |     mut res := u64(0)
  344 |     asm amd64 {
      |     ~~~~~~~~~~~
  345 |         syscall
  346 |         ; =a (res)
C:/Users/user/Documents/DEV/DEPS/v/vlib/builtin/linux_bare/linux_syscalls.v:355:2: error: msvc compiler does not support inline assembly
  353 | fn sys_call2(scn u64, arg1 u64, arg2 u64) u64 {
  354 |     mut res := u64(0)
  355 |     asm amd64 {
      |     ~~~~~~~~~~~
  356 |         syscall
  357 |         ; =a (res)
C:/Users/user/Documents/DEV/DEPS/v/vlib/builtin/linux_bare/linux_syscalls.v:367:2: error: msvc compiler does not support inline assembly
  365 | fn sys_call3(scn u64, arg1 u64, arg2 u64, arg3 u64) u64 {
  366 |     mut res := u64(0)
  367 |     asm amd64 {
      |     ~~~~~~~~~~~
  368 |         syscall
  369 |         ; =a (res)
C:/Users/user/Documents/DEV/DEPS/v/vlib/builtin/linux_bare/linux_syscalls.v:380:2: error: msvc compiler does not support inline assembly
  378 | fn sys_call4(scn u64, arg1 u64, arg2 u64, arg3 u64, arg4 u64) u64 {
  379 |     mut res := u64(0)
  380 |     asm amd64 {
      |     ~~~~~~~~~~~
  381 |         mov r10, arg4
  382 |         syscall
C:/Users/user/Documents/DEV/DEPS/v/vlib/builtin/linux_bare/linux_syscalls.v:396:2: error: msvc compiler does not support inline assembly
  394 | fn sys_call5(scn u64, arg1 u64, arg2 u64, arg3 u64, arg4 u64, arg5 u64) u64 {
  395 |     mut res := u64(0)
  396 |     asm amd64 {
      |     ~~~~~~~~~~~
  397 |         mov r10, arg4
  398 |         mov r8, arg5
C:/Users/user/Documents/DEV/DEPS/v/vlib/builtin/linux_bare/linux_syscalls.v:415:2: error: msvc compiler does not support inline assembly
  413 | fn sys_call6(scn u64, arg1 u64, arg2 u64, arg3 u64, arg4 u64, arg5 i64, arg6 u64) u64 {
  414 |     mut res := u64(0)
  415 |     asm amd64 {
      |     ~~~~~~~~~~~
  416 |         mov r10, arg4
  417 |         mov r8, arg5
C:/Users/user/Documents/DEV/DEPS/v/vlib/builtin/linux_bare/linux_syscalls.v:435:1: error: msvc compiler does not support inline assembly
  433 | }
  434 |
  435 | asm amd64 {
      | ~~~~~~~~~~~
  436 |     .globl _start
  437 |     _start:

V version

V 0.4.5 d6d0f9b

Environment details (OS name and version, etc.)

Betriebsystemname Microsoft Windows 11 Enterprise Version 10.0.22621 Build 22621 Systemmodell Surface Pro 10 for Business Systemtyp x64-basierter PC Prozessor Intel(R) Core(TM) Ultra 7 165U, 2100 MHz, 12 Kern(e), 14 logische(r) Prozessor(en) Installierter physischer Speicher (RAM) 32,0 GB

[!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.

RednibCoding avatar May 08 '24 21:05 RednibCoding