33 posts
When I build through 4coder, Clang-cl cannot seem to find link.exe. The directory the linker is in my path, and 4coder is launched with this script

 1 2 3 4 5 6 7 8 call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -no_logo set path=[Redacted]\Documents\project920\code;%path% pushd [Redacted]\Documents\project920\code start C:\4coder\4ed.exe popd start devenv 

This is the directory for the linker in my path:
 1 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24728\bin\ 

But this is the error Clang-cl gives

 1 2 clang-cl.exe: error: unable to execute command: program not executable clang-cl.exe: error: linker command failed with exit code 1 (use -v to see invocation) 

The full error log can be found here : https://gist.github.com/anonymous/4f334a9a5051960331ea5d78d5a79407

It's not clear what exactly is the issue. Has anyone ran into this?
497 posts
does that directory end up in %path% after the call to VsDevCmd.bat?
Mārtiņš Možeiko
2265 posts / 2 projects
Edited by Mārtiņš Možeiko on
Who, from where and how calls clang-cl.exe ?
33 posts
Edited by Jesse on
ratchetfreak
does that directory end up in %path% after the call to VsDevCmd.bat?

Yes. I confirmed this by printing the %PATH% variable at the end of the startup script.

mmozeiko
Who, from where and how calls clang-cl.exe ?

My build.bat, which is inside my project/code directory. The actual line that gets ran is

 1 clang-cl %CommonCompilerFlags% [Redacted]\project\code\jesse.cpp /LD %CommonLinkerFlags% -PDB:jesse_%random%.pdb /EXPORT:GameUpdate 
497 posts
can you check that the %path% is properly propagated down to the build.bat?
33 posts
ratchetfreak
can you check that the %path% is properly propagated down to the build.bat?

Yup, it does.
Mārtiņš Možeiko
2265 posts / 2 projects
Are you able to run clang-cl.exe successfully (including linker) from .bat file that calls VsDevCmd? Without calling 4coder.
33 posts
mmozeiko
Are you able to run clang-cl.exe successfully (including linker) from .bat file that calls VsDevCmd? Without calling 4coder.

Hmm, there seems to be progress here.

 1 2 3 call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -no_logo clang-cl.exe: warning: unknown argument ignored in clang-cl: '-PDB:jesse_15885.pdb' [-Wunknown-argument] clang-cl.exe: error: no such file or directory: '/EXPORT:GameUpdate' 

But I don't know how to address these errors, because I don't know what's causing them.
Mārtiņš Možeiko
2265 posts / 2 projects
Edited by Mārtiņš Možeiko on
clang-cl.exe doesn't support exactly same arguments as cl.exe. There are differences: http://clang.llvm.org/docs/UsersManual.html#clang-cl

You probably would want to use clang native arguments - cl.exe compatible arguments cannot express all that clang supports. I think they are there only to make porting from cl.exe to clang a bit easier.
33 posts
Edited by Jesse on
Yes, I am aware of those. The plan is to eventually shift over, but I need to get it working with what I have first.

Do you have an idea why calling Clang-cl from within a batch file using 4coder doesn't seem to work?
Mārtiņš Možeiko
2265 posts / 2 projects
No idea. I don't use 4coder and have no idea how it works when calling external commands.

What happens if you put call to VsDevCmd.bat file inside build.bat?
33 posts
Interestingly that doesn't work. Same errors as before.
Mārtiņš Možeiko
2265 posts / 2 projects