wrong target in MSYS2 toolchain
-
- CodeLite Curious
- Posts: 6
- Joined: Fri May 17, 2019 2:54 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
wrong target in MSYS2 toolchain
I'm trying the clangd language server and I'm experiencing the same issue as described in #2499.
I checked the compile_commands.json and compile_flags.txt files and I noticed that the target is i686-pc-windows-gnu instead of x86_64-pc-windows-gnu. My toolchain is the last MINGW-64 bit with gcc 10.1.0 obtained from MSYS2 with pacman (only 64 bit ).
Is there a place in settings where to change the target?
Thanks.
OS: Windows 10
CodeLite: 14.0.1
I checked the compile_commands.json and compile_flags.txt files and I noticed that the target is i686-pc-windows-gnu instead of x86_64-pc-windows-gnu. My toolchain is the last MINGW-64 bit with gcc 10.1.0 obtained from MSYS2 with pacman (only 64 bit ).
Is there a place in settings where to change the target?
Thanks.
OS: Windows 10
CodeLite: 14.0.1
- eranif
- CodeLite Plugin
- Posts: 6133
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: wrong target in MSYS2 toolchain
The target is auto detect by CodeLite.
You need to make sure that the compiler you selected for the project is indeed 64 bit.
Project settings -> General page -> Compiler.
CodeLite does the following to determine if your compiler is 64 bit or not:
1. Get list of built-in macros from the compiler (instead of 'gcc' it will use the full path for your compiler):
2. Open /tmp/file and check for this line:
If it is defined, then the selected compiler is indeed 64 bit, else, 32
Eran
You need to make sure that the compiler you selected for the project is indeed 64 bit.
Project settings -> General page -> Compiler.
CodeLite does the following to determine if your compiler is 64 bit or not:
1. Get list of built-in macros from the compiler (instead of 'gcc' it will use the full path for your compiler):
Code: Select all
echo | gcc -dM -E - > /tmp/file
Code: Select all
#define _WIN64 1
Eran
Make sure you have read the HOW TO POST thread
- eranif
- CodeLite Plugin
- Posts: 6133
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: wrong target in MSYS2 toolchain
I installed GCC 9.1 on my MSYS2 terminal, and indeed the logic to detect whether if the compiler is 64 bit is not working for this compiler
Then I ran the command to list the built-in macros defined by this compiler, and indeed _WIN64 is not there
I could see however, that
I changed the code to tests for this macros as well
Code: Select all
pacman -S gcc
...
$ gcc --version
gcc (GCC) 9.1.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I could see however, that
Code: Select all
#define __x86_64__ 1
#define __amd64 1
#define __amd64__ 1
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 6
- Joined: Fri May 17, 2019 2:54 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: wrong target in MSYS2 toolchain
Ok these are the settings in a small project that compiles correctly:
https://ibb.co/Fb74GPN
these are the build settings:
https://ibb.co/yqLCqxC
this is the echo command output:
https://ibb.co/cLXN8tX
This is the content of compile_flags.txt:
-IE:\cstack\libs\math\cglm\include
-IE:\cstack\libs\img\stb
-IE:\cstack\wks\mylib\lea_gui\include
-DUNICODE
-D__USE_MINGW_ANSI_STDIO
-DGLEW_STATIC
-target
i686-pc-windows-gnu
Creating a new test project with the last TDM toolchain (9.2.0) compile_flags.txt has the compiler includes too:
-IE:\cstack\compilers\TDM-GCC-920-64\lib\gcc\x86_64-w64-mingw32\9.2.0\include\c++
-IE:\cstack\compilers\TDM-GCC-920-64\lib\gcc\x86_64-w64-mingw32\9.2.0\include\c++\x86_64-w64-mingw32
-IE:\cstack\compilers\TDM-GCC-920-64\lib\gcc\x86_64-w64-mingw32\9.2.0\include\c++\backward
-IE:\cstack\compilers\TDM-GCC-920-64\lib\gcc\x86_64-w64-mingw32\9.2.0\include
-IE:\cstack\compilers\TDM-GCC-920-64\include
-IE:\cstack\compilers\TDM-GCC-920-64\lib\gcc\x86_64-w64-mingw32\9.2.0\include-fixed
-IE:\cstack\compilers\TDM-GCC-920-64\x86_64-w64-mingw32\include
-IE:\cstack\wks\mylib\lea_gui\include
-DUNICODE
-D__USE_MINGW_ANSI_STDIO
-target
x86_64-pc-windows-gnu
I hope that these info can be useful.
Updated: I've read now your answer
https://ibb.co/Fb74GPN
these are the build settings:
https://ibb.co/yqLCqxC
this is the echo command output:
https://ibb.co/cLXN8tX
This is the content of compile_flags.txt:
-IE:\cstack\libs\math\cglm\include
-IE:\cstack\libs\img\stb
-IE:\cstack\wks\mylib\lea_gui\include
-DUNICODE
-D__USE_MINGW_ANSI_STDIO
-DGLEW_STATIC
-target
i686-pc-windows-gnu
Creating a new test project with the last TDM toolchain (9.2.0) compile_flags.txt has the compiler includes too:
-IE:\cstack\compilers\TDM-GCC-920-64\lib\gcc\x86_64-w64-mingw32\9.2.0\include\c++
-IE:\cstack\compilers\TDM-GCC-920-64\lib\gcc\x86_64-w64-mingw32\9.2.0\include\c++\x86_64-w64-mingw32
-IE:\cstack\compilers\TDM-GCC-920-64\lib\gcc\x86_64-w64-mingw32\9.2.0\include\c++\backward
-IE:\cstack\compilers\TDM-GCC-920-64\lib\gcc\x86_64-w64-mingw32\9.2.0\include
-IE:\cstack\compilers\TDM-GCC-920-64\include
-IE:\cstack\compilers\TDM-GCC-920-64\lib\gcc\x86_64-w64-mingw32\9.2.0\include-fixed
-IE:\cstack\compilers\TDM-GCC-920-64\x86_64-w64-mingw32\include
-IE:\cstack\wks\mylib\lea_gui\include
-DUNICODE
-D__USE_MINGW_ANSI_STDIO
-target
x86_64-pc-windows-gnu
I hope that these info can be useful.
Updated: I've read now your answer
- eranif
- CodeLite Plugin
- Posts: 6133
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: wrong target in MSYS2 toolchain
The problem is that TDM compiler *does* define the _WIN64, while the one that I have installed with pacman, does not.
This is already fixed in git master.
https://github.com/eranif/codelite/comm ... 469c4aR827
This is already fixed in git master.
https://github.com/eranif/codelite/comm ... 469c4aR827
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 6
- Joined: Fri May 17, 2019 2:54 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: wrong target in MSYS2 toolchain
Sorry for the long wait, I tried again but the issue seems not to be fixed.
OS: Windows 10
CodeLite: 14.0.4
compile_command.json of a simple test:
[{
"file": "E:\\cstack\\wks\\mylib\\test\\main.c",
"directory": "E:\\cstack\\wks\\mylib\\test",
"command": "clang -c E:\\cstack\\wks\\mylib\\test\\main.c -o E:\\cstack\\wks\\mylib\\test\\main.c.o -target i686-pc-windows-gnu -I. -I. -g -O0 -Wall"
}]
gcc --version
...
gcc.exe (Rev6, Built by MSYS2 project) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gcc -v
...
Target: x86_64-w64-mingw32
echo | gcc -E -dM -x c - | sort
...
#define __amd64 1
#define __amd64__ 1
...
#define __MINGW32__ 1
#define __MINGW64__ 1
...
#define __VERSION__ "10.2.0"
...
#define __WIN32 1
#define __WIN32__ 1
#define __WIN64 1
#define __WIN64__ 1
...
#define __x86_64 1
#define __x86_64__ 1
...
#define _WIN32 1
#define _WIN64 1
#define WIN32 1
#define WIN64 1
#define WINNT 1
The Msys2 compiler is correctly configured and projects build successfully.
OS: Windows 10
CodeLite: 14.0.4
compile_command.json of a simple test:
[{
"file": "E:\\cstack\\wks\\mylib\\test\\main.c",
"directory": "E:\\cstack\\wks\\mylib\\test",
"command": "clang -c E:\\cstack\\wks\\mylib\\test\\main.c -o E:\\cstack\\wks\\mylib\\test\\main.c.o -target i686-pc-windows-gnu -I. -I. -g -O0 -Wall"
}]
gcc --version
...
gcc.exe (Rev6, Built by MSYS2 project) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gcc -v
...
Target: x86_64-w64-mingw32
echo | gcc -E -dM -x c - | sort
...
#define __amd64 1
#define __amd64__ 1
...
#define __MINGW32__ 1
#define __MINGW64__ 1
...
#define __VERSION__ "10.2.0"
...
#define __WIN32 1
#define __WIN32__ 1
#define __WIN64 1
#define __WIN64__ 1
...
#define __x86_64 1
#define __x86_64__ 1
...
#define _WIN32 1
#define _WIN64 1
#define WIN32 1
#define WIN64 1
#define WINNT 1
The Msys2 compiler is correctly configured and projects build successfully.
-
- CodeLite Curious
- Posts: 6
- Joined: Fri May 17, 2019 2:54 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: wrong target in MSYS2 toolchain
does anyone else experience the problem described in the previous post?