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

compiler bug #20743

Closed
sanrentai opened this issue Feb 7, 2024 · 2 comments
Closed

compiler bug #20743

sanrentai opened this issue Feb 7, 2024 · 2 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@sanrentai
Copy link

sanrentai commented Feb 7, 2024

Describe the bug

In most cases, compile errors happen because the version of Clang installed is too old
(built by Brecht Sanders, r5) clang version 17.0.6
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: D:/mingw64/bin

Backend compiler error

Reproduction Steps

git clone https://github.com/vlang/v
cd v
make

Expected Behavior

v.exe

Current Behavior

PS D:\v> .\make.bat
Updating TCC

Syncing TCC from https://github.com/vlang/tccbin

Updating vc...

Sync with remote https://github.com/vlang/vc

Building V...

Attempting to build "./v_win_bootstrap.exe" (from v_win.c) with "thirdparty/tcc/tcc.exe"
Compiling "./v.exe" with "./v_win_bootstrap.exe"
C compiler cmd: "thirdparty/tcc/tcc.exe" "@C:\Users\曹春\AppData\Local\Temp\v_0\v_up.exe.tmp.c.rsp"
C compiler response file "C:\Users\曹春\AppData\Local\Temp\v_0\v_up.exe.tmp.c.rsp":
-Bthirdparty/tcc -fwrapv -g -o "D:\v\./v_up.exe" -Wl,-stack=16777216 -Werror=implicit-function-declaration -I "D:\v\thirdparty\stdatomic\win" "C:\Users\曹春\AppData\Local\Temp\v_0\v_up.exe.tmp.c" -std=c99 -D_DEFAULT_SOURCE -municode -bt25 -ldbghelp -lws2_32 -ladvapi32 -lshell32
C compiler cmd: gcc "@C:\Users\曹春\AppData\Local\Temp\v_0\v_up.exe.tmp.c.rsp"
C compiler response file "C:\Users\曹春\AppData\Local\Temp\v_0\v_up.exe.tmp.c.rsp":
-Bthirdparty/tcc -fwrapv -g -no-pie -o "D:\v\./v_up.exe" -Wl,-stack=16777216 -Werror=implicit-function-declaration -I "D:\v\thirdparty\stdatomic\win" "C:\Users\曹春\AppData\Local\Temp\v_0\v_up.exe.tmp.c" -std=c99 -D_DEFAULT_SOURCE -municode -ldbghelp -lws2_32 -ladvapi32 -lshell32
tcc: error: file 'C:\Users\曹春\AppData\Local\Temp\v_0\v_up.exe.tmp.c' not found
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

Attempting to build "./v_win_bootstrap.exe" (from v_win.c) with Clang
./vc/v_win.c:37200:15: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'HANDLE'
(aka 'void ') [-Wint-conversion]
37200 | CloseHandle(l->fd);
| ^~~~~
D:/mingw64/x86_64-w64-mingw32/include/handleapi.h:19:49: note: passing argument to parameter 'hObject' here
19 | WINBASEAPI WINBOOL WINAPI CloseHandle (HANDLE hObject);
| ^
./vc/v_win.c:37215:8: error: incompatible pointer to integer conversion assigning to 'int' from 'voidptr' (aka 'void ') [-Wint-conversion]
37215 | l->fd = fd;
| ^ ~~
./vc/v_win.c:37235:8: error: incompatible pointer to integer conversion assigning to 'int' from 'voidptr' (aka 'void ') [-Wint-conversion]
37235 | l->fd = fd;
| ^ ~~
./vc/v_win.c:42925:85: error: incompatible pointer to integer conversion passing 'voidptr' (aka 'void ') to parameter
of type 'intptr_t' (aka 'long long') [-Wint-conversion]
42925 | ...if (!(!atomic_compare_exchange_weak_ptr(((voidptr
)(&ch->adr_written)), &nulladr, ((voidptr)(-1))))) break;
| ^~~~~~~~~~~~~~~
./vc/v_win.c:1357:42: note: expanded from macro 'atomic_compare_exchange_weak_ptr'
1357 | #define atomic_compare_exchange_weak_ptr atomic_compare_exchange_weak
| ^
./vc/v_win.c:1315:54: note: expanded from macro 'atomic_compare_exchange_weak'
1315 | atomic_compare_exchange_strong(object, expected, desired)
| ^~~~~~~
./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
./vc/v_win.c:42995:81: error: incompatible pointer to integer conversion passing 'void ' to parameter of type
'intptr_t' (aka 'long long') [-Wint-conversion]
42995 | if (atomic_compare_exchange_strong_ptr(((voidptr
)(&ch->write_adr)), &wradr, ((void
)0))) {
| ^~~~~~~~~~./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
./vc/v_win.c:42999:88: error: incompatible pointer to integer conversion passing 'voidptr' (aka 'void ') to parameter
of type 'intptr_t' (aka 'long long') [-Wint-conversion]
42999 | ...if (!(!atomic_compare_exchange_weak_ptr(((voidptr
)(&ch->adr_written)), &nulladr, wradr))) break;
| ^~~~~
./vc/v_win.c:1357:42: note: expanded from macro 'atomic_compare_exchange_weak_ptr'
1357 | #define atomic_compare_exchange_weak_ptr atomic_compare_exchange_weak
| ^
./vc/v_win.c:1315:54: note: expanded from macro 'atomic_compare_exchange_weak'
1315 | atomic_compare_exchange_strong(object, expected, desired)
| ^~~~~~~
./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
./vc/v_win.c:43035:80: error: incompatible pointer to integer conversion passing 'void ' to parameter of type
'intptr_t' (aka 'long long') [-Wint-conversion]
43035 | ...if (atomic_compare_exchange_strong_ptr(((voidptr
)(&ch->read_adr)), &src2, ((void
)0))) {
| ^~~~~~~~~~
./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
./vc/v_win.c:43055:80: error: incompatible pointer to integer conversion passing 'void ' to parameter of type
'intptr_t' (aka 'long long') [-Wint-conversion]
43055 | ...if (atomic_compare_exchange_strong_ptr(((voidptr
)(&ch->adr_read)), &src2, ((void
)0))) {
| ^~~~~~~~~~
./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
./vc/v_win.c:43076:97: error: incompatible pointer to integer conversion passing 'void ' to parameter of type
'intptr_t' (aka 'long long') [-Wint-conversion]
43076 | ...if (have_swapped || atomic_compare_exchange_strong_ptr(((voidptr
)(&ch->adr_read)), &src2, ((void*)0))) {
| ^~~~~~~~~~
./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
./vc/v_win.c:43085:96: error: incompatible pointer to integer conversion passing 'void ' to parameter of type
'intptr_t' (aka 'long long') [-Wint-conversion]
43085 | ...if (have_swapped || atomic_compare_exchange_strong_ptr(((voidptr
)(&ch->adr_read)), &src2, ((void*)0))) {
| ^~~~~~~~~~
./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
./vc/v_win.c:43186:81: error: incompatible pointer to integer conversion passing 'void ' to parameter of type
'intptr_t' (aka 'long long') [-Wint-conversion]
43186 | ...if (atomic_compare_exchange_strong_ptr(((voidptr
)(&ch->read_adr)), &rdadr, ((void*)0))) {
| ^~~~~~~~~~
./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
./vc/v_win.c:43190:86: error: incompatible pointer to integer conversion passing 'voidptr' (aka 'void ') to parameter
of type 'intptr_t' (aka 'long long') [-Wint-conversion]
43190 | ...if (!(!atomic_compare_exchange_weak_ptr(((voidptr
)(&ch->adr_read)), &nulladr, rdadr))) break;
| ^~~~~
./vc/v_win.c:1357:42: note: expanded from macro 'atomic_compare_exchange_weak_ptr'
1357 | #define atomic_compare_exchange_weak_ptr atomic_compare_exchange_weak
| ^
./vc/v_win.c:1315:54: note: expanded from macro 'atomic_compare_exchange_weak'
1315 | atomic_compare_exchange_strong(object, expected, desired)
| ^~~~~~~
./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
./vc/v_win.c:43281:82: error: incompatible pointer to integer conversion passing 'void ' to parameter of type
'intptr_t' (aka 'long long') [-Wint-conversion]
43281 | ...if (atomic_compare_exchange_strong_ptr(((voidptr
)(&ch->write_adr)), &dest2, ((void*)0))) {
| ^~~~~~~~~~
./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
./vc/v_win.c:43302:83: error: incompatible pointer to integer conversion passing 'void ' to parameter of type
'intptr_t' (aka 'long long') [-Wint-conversion]
43302 | if (atomic_compare_exchange_strong_ptr(((voidptr
)(&ch->adr_written)), &dest2, ((void*)0))) {
| ^~~~~~~~~~
./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
./vc/v_win.c:43325:99: error: incompatible pointer to integer conversion passing 'void ' to parameter of type
'intptr_t' (aka 'long long') [-Wint-conversion]
43325 | ...if (have_swapped || atomic_compare_exchange_strong_ptr(((voidptr
)(&ch->adr_written)), &dest2, ((void*)0))) {
| ^~~~~~~~~~
./vc/v_win.c:1303:59: note: passing argument to parameter 'desired' here
1303 | intptr_t desired)
| ^
15 errors generated.
In most cases, compile errors happen because the version of Clang installed is too old
(built by Brecht Sanders, r5) clang version 17.0.6
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: D:/mingw64/bin

Backend compiler error

Possible Solution

MinGW has many version . Which version should I choose?
Should I try Visual Studio ?

改变环境变量
image
Temp变量中不能有中文,否则某些编译器就把路径变成乱码了,导致找不到文件

Additional Information/Context

In most cases, compile errors happen because the version of Clang installed is too old
(built by Brecht Sanders, r5) clang version 17.0.6
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: D:/mingw64/bin

Backend compiler error

Exiting from error
ERROR: please follow the instructions in https://github.com/vlang/v/wiki/Installing-a-C-compiler-on-Windows

V version

latest

Environment details (OS name and version, etc.)

windows 11

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.

@sanrentai sanrentai added the Bug This tag is applied to issues which reports bugs. label Feb 7, 2024
@JalonSolov
Copy link
Contributor

JalonSolov commented Feb 7, 2024

People have had the most success with gcc/clang downloaded from https://winlibs.com - not the standard mingw with msys.

One possibility is that tcc, the default compiler that V uses, does NOT like non-ASCII characters in paths. Try cloning V to a path with only ASCII characters, and see if it succeeds.

@sanrentai
Copy link
Author

People have had the most success with gcc/clang downloaded from https://winlibs.com - not the standard mingw with msys.

One possibility is that tcc, the default compiler that V uses, does NOT like non-ASCII characters in paths. Try cloning V to a path with only ASCII characters, and see if it succeeds.

thank you

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.
Projects
None yet
Development

No branches or pull requests

2 participants