5

I'm trying to build some third party libraries from source using Visual Studio 2015. I'm creating the solution file using cmake 3.2.3 and I'm using the ExternalProject_add module. I previously compiled and built this cmake code successfully in 32 bit Visual Studio 2012, but did not in 64 bit.

I'm now trying to build it in 64 bit Visual Studio 2015, and the IDE inexplicably hangs during the build process with both debug and release builds. Sometimes the build processes are still running, such as cl.exe, but nothing advances and I have to go into task manager and end all the processes associated with the build. I then try to build it again, and sometimes it builds successfully while other times it runs into the same error; freezing at different lines in the code depending on how far it got in the build.

I've gotten the same hanging issue when trying to build the solution in 32 bit as well.

I'm not sure if there is an issue with my Visual Studio 2015 installation, or if it is an issue with my cmake code that is causing this hanging. I don't know much about cmake outside of ExternalProject_add, so any and all help with cmake or visual studio is much appreciated.

Here's the external project code that initiates the build:

include(ExternalProject)

ExternalProject_Add(${3rdPartyLibraryName}
    DOWNLOAD_DIR ${3rdParty_CacheDir}
    URL ${3rdPartyURL}
    SOURCE_DIR ${3rdPartySourceDir}
    TMP_DIR ${3rdPartySourceDir}/${3rdPartyLibraryName}
    BUILD_COMMAND nmake /f makefile.vc MSVC_VER=${MSVC_VERSION} WIN64=YES INCDIR=${CMAKE_SOURCE_DIR}/../3rdParty/${3rdPartyLibraryName}/test/include
    BINARY_DIR ${3rdPartySourceDir}
    CMAKE_ARGS
      -DCMAKE_INSTALL_PREFIX:string=${3rdPartySourceDir}
    INSTALL_COMMAND ""
)

Edit

Additionally, I've tried building this from the command line set up with the VS 2015 environment and have gotten the same hanging issue.

aDrow
  • 115
  • 1
  • 7
  • Could you please add a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve)? Just guessing - because the cause could be anything - I don't think this is particularly related to CMake. Out of my experience there are two possible causes: 1. Out of memory/disk space (e.g. how many `cl.exe` processes are running when it hangs?) 2. Some background Visual Studio service does hang with multiple VS instances. – Florian May 11 '16 at 07:56
  • See e.g. [Why is msbuild and link.exe “hanging” during a build?](http://stackoverflow.com/questions/1080757/why-is-msbuild-and-link-exe-hanging-during-a-build) or even - like when using Jenkins - [Visual studio builds started by Jenkins fail with "Fatal error C1090" because mspdbsrv.exe gets killed](https://issues.jenkins-ci.org/browse/JENKINS-9104). – Florian May 11 '16 at 07:56
  • Thanks for the links Florian, I appreciate the help. Sorry about not posting the example earlier as I'm a stack overflow noob. There are no instances of cl.exe, one instance of MSBuild.exe, and two instances of nmake when the build hangs. Also the third party library I'm trying to build is gdal if that helps. – aDrow May 11 '16 at 13:37
  • This is almost always a wonky anti-malware problem. Disable it and try again. Especially Avast has been viral since the last few months, get rid of asap. – Hans Passant May 11 '16 at 13:55
  • Thanks for the suggestion Hans. I'm currently running McAfee as a virus scanner, though I'm building on a company machine and do not have the option of turning virus/malware scanning off. I personally have my doubts that it is the virus scanner because I had previously built this in VS 2012 with the scanner on. Still I'll keep it in mind. – aDrow May 11 '16 at 15:33

1 Answers1

5

It took a while and some research, but I think that I have reproduced your problem and found a solution. I found that cl.exe would seem to hang, but there was a process called "cvtres.exe" that was actually hanging. When I killed that process, the compilation would continue. There appears to be a known bug that KB3118401 seems to fix. I installed this patch and I haven't had the problem since. Hope this helps!

https://www.microsoft.com/en-us/download/details.aspx?id=51161

DiB
  • 554
  • 5
  • 19