Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake fails to "find" Visual C++ compiler

Tags:

I'm trying to build a C++ project test suite in Atlasian Bamboo on Windows using CMake and Visual Studio 2015 Community. CMake and VS work fine when running under my user account, but when running them via Bamboo I get the following error:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_CXX_COMPILER could be found.

I don't think I'm getting this error for the usual reason though. CMake seems to be able to find the compiler itself just fine. Rather, it seems that the resource compiler is the source of the error. In the CMakeFiles/CMakeError.log file, I have the following output:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe
  <<options removed> CMakeCCompilerId.c

C:\Windows\system32\config\systemprofile\AppData\Local\Temp\lnk{ECA1FDDF-C2EA-4
819-AFE3-6A5E06ECA59E}.tmp(1): error RC2135: file not found: C:\Windows\system3
2\config\systemprofile\AppData\Local\Temp\lnk{8A24DD6C-9300-41A6-9CAC-B48137E0E
056}.tmp [C:\bamboo\bamboo-agent-home\...\CMakeFiles\3.6.1\CompilerIdC\CompilerIdC.vcxproj]

I don't really understand the path reported for starters. Is that a symlink or something? Why is the resource compiler even involved? Anyone have any idea why it can't find the file?

like image 624
Jason Watkins Avatar asked Aug 12 '16 18:08

Jason Watkins


1 Answers

I have had this problem; it is a result of installing a Bamboo remote agent as a service, under Windows, with it running under a local user account (rather than a system account).

The issue appears to be that the TEMP and TMP environment variables are set to c:\windows\system32\config\systemprofile, which would be appropriate for a system account, but is not appropriate for a local user account. It can't access them and so cmake falls over.

A workaround is to edit $BAMBOO_AGENT_HOME\conf\wrapper.conf and add the lines

set.TEMP=c:/some/path
set.TMP=c:/some/path

As well as setting java's tmpdir by adding:

wrapper.java.additional.#=-Djava.io.tmpdir="C:/some/path"

Where '#' is the next number in the sequence of wrapper.java.additional values.

like image 157
James Picone Avatar answered Sep 23 '22 17:09

James Picone