v
v copied to clipboard
error: incompatible types for redefinition of 'memcpy' when use -freestanding
V version: V 0.2.4 dcdfdf4.b482c05 OS: linux, "ArcoLinux"
What did you do?
run v with command v run filename.v -freestanding
module main
import net
fn main() {
mut addr := net.AddrFamily.ip
mut ln := net.listen_tcp(addr, ":8081") or {
panic(err)
}
for {
mut conn := ln.accept() or {
panic(err)
}
go handle_connection(mut conn)
}
}
fn handle_connection(mut c &net.TcpConn){
hello := "hello world"
res := "HTTP/1.1 200 OK\r\nContent-Length: " + hello.len.str() + "\r\nConnection: close\r\n\r\n" + hello
c.write(res.bytes()) or {
}
c.close() or {
}
}
What did you expect to see? no error
What did you see instead?
In file included from /tmp/v_1000/vblog.861675596276695499.tmp.c:903:
In file included from /usr/include/sys/un.h:37:
/usr/include/string.h:44: error: incompatible types for redefinition of 'memcpy'
builder error:
==================
C error. This should never happen.
This is a compiler bug, please report it using `v bug file.v`.
I get the same error when trying to use SDL2:
jeff@jeffs-machine $ v -freestanding -cg .
In file included from /tmp/v_1000/project.11051791327570436486.tmp.c:730:
In file included from /usr/include/SDL2/SDL.h:32:
In file included from /usr/include/SDL2/SDL_main.h:25:
In file included from /usr/include/SDL2/SDL_stdinc.h:43:
In file included from /usr/include/stdio.h:36:
thirdparty/tcc/lib/tcc/include/stdarg.h:5: warning: va_start redefined
In file included from /tmp/v_1000/project.11051791327570436486.tmp.c:730:
In file included from /usr/include/SDL2/SDL.h:32:
In file included from /usr/include/SDL2/SDL_main.h:25:
In file included from /usr/include/SDL2/SDL_stdinc.h:43:
In file included from /usr/include/stdio.h:36:
thirdparty/tcc/lib/tcc/include/stdarg.h:6: warning: va_arg redefined
In file included from /tmp/v_1000/project.11051791327570436486.tmp.c:730:
In file included from /usr/include/SDL2/SDL.h:32:
In file included from /usr/include/SDL2/SDL_main.h:25:
In file included from /usr/include/SDL2/SDL_stdinc.h:43:
In file included from /usr/include/stdio.h:36:
thirdparty/tcc/lib/tcc/include/stdarg.h:7: warning: va_copy redefined
In file included from /tmp/v_1000/project.11051791327570436486.tmp.c:730:
In file included from /usr/include/SDL2/SDL.h:32:
In file included from /usr/include/SDL2/SDL_main.h:25:
In file included from /usr/include/SDL2/SDL_stdinc.h:43:
In file included from /usr/include/stdio.h:36:
thirdparty/tcc/lib/tcc/include/stdarg.h:8: warning: va_end redefined
In file included from /tmp/v_1000/project.11051791327570436486.tmp.c:730:
In file included from /usr/include/SDL2/SDL.h:32:
In file included from /usr/include/SDL2/SDL_main.h:25:
In file included from /usr/include/SDL2/SDL_stdinc.h:66:
/usr/include/string.h:44: error: incompatible types for redefinition of 'memcpy'
builder error:
==================
C error. This should never happen.
This is a compiler bug, please report it using `v bug file.v`.
https://github.com/vlang/v/issues/new/choose
You can also use #help on Discord: https://discord.gg/vlang