Page 1 of 1

[SOLVED] Why won't my clang build compile?

Posted: Wed Jun 17, 2015 12:42 pm
by member7
I'm using codelite 8.0 on windows 7 and want to change the compiler to clang. I installed clang 3.6.1 compiler on windows and added it to codelite with the Build Settings. When I create a new clang project the examples compile and run but when I include string for example I got "undefined reference to '_Unwind_Resume'" errors from the linker.

So I built llvm with clang myself with MinGW 4.9.2 and it works just fine when I use it from the command line, it compiles and runs. However when I add my clang to codelite I get the same output for anything written in the source file at all:

Code: Select all

C:\Windows\system32\cmd.exe /C "D:/CodeBlocks/MinGW/bin/mingw32-make.exe -j2 SHELL=cmd.exe -e -f  Makefile"
"----------Building project:[ clangtest - Debug ]----------"
mingw32-make.exe[1]: Entering directory `C:/clangtest'
mingw32-make.exe[1]: *** [Debug/main.cpp.o.d] Error -1073741511
mingw32-make.exe: *** [All] Error 2
mingw32-make.exe[1]: Leaving directory `C:/clangtest'
1 errors, 0 warnings
I get the same result when I hotswap the clang++.exe from the installed clang with my own clang++.exe. From undefined reference to this output and I can't tell where it's failing exactly. Any clue what I'm doing wrong?

Re: Why won't my clang build compile?

Posted: Wed Jun 17, 2015 12:47 pm
by eranif
Try running CodeLite's command manually (from a CMD shell)
Sometimes, the CMD in the middle hides dialog boxes with error messages

The error you are getting is usually because exception support in clang for Windows is poor
Disclaimer: this was the case in clang 3.5, I don't know how far it got improved with 3.6...

Eran

Re: Why won't my clang build compile?

Posted: Wed Jun 17, 2015 8:20 pm
by member7
I played around with it for a bit. When I try to run the command in the shell I get the same output in all 3 cases; using mingw 4.9.2 which builds properly in codelite, clang with undefined references and clang which doesn't build. I configured my project and let codelite generate the makefile and called the same command each time but the output is the same:

Code: Select all

C:\workspace>c:/mingw-4.9.2/bin/mingw32-make.exe -j2 SHELL=cmd.exe -e -f Makefile
"----------Building project:[ project - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/workspace/project'
process_begin: CreateProcess(NULL, makedir Debug, ...) failed.
make (e=2): The system cannot find the file specified.
project.mk:82: recipe for target 'Debug/project' failed
mingw32-make.exe[1]: *** [Debug/project] Error 2
mingw32-make.exe[1]: Leaving directory 'C:/workspace/project'
Makefile:4: recipe for target 'All' failed
mingw32-make.exe: *** [All] Error 2
C:\workspace>
I don't know how to proceed from here.

Re: Why won't my clang build compile?

Posted: Wed Jun 17, 2015 8:55 pm
by eranif
Please paste your environment variables from: settings->environment variables
makedir is installed under the same folder as CodeLite so it should be available, unless you tempered with the environment variabels

Eran

Re: Why won't my clang build compile?

Posted: Wed Jun 17, 2015 10:09 pm
by member7
This is what I have under settings->environment variables:

Code: Select all

CodeLiteDir=D:\CodeLite7
PATH=C:\mingw-4.9.2\bin;$PATH
Within codelite makedir seems to work but when using the shell to test the command I get the makedir can't be found. Would I have to add makedir to the windows environment to run the command from the shell?

Re: Why won't my clang build compile?

Posted: Wed Jun 17, 2015 10:16 pm
by eranif
Yes, CodeLite does not modify your system settings.
Eran

Re: Why won't my clang build compile?

Posted: Tue Jun 23, 2015 1:18 pm
by member7
eranif wrote:Yes, CodeLite does not modify your system settings.
Eran
I managed to compile it when I removed code::blocks and removed a second codelite (an older version) folder from my machine.

Using "Scan computer for installed compilers" in the Build Settings crashed codelite for me with another codelite folder on the system.

I get the same compiler errors with my build but thanks to your hint I got it to compiler with the -fno-exceptions flag. I love asking questions here because you are so very helpful, thanks.