-
Bug
-
Resolution: Fixed
-
Blocker
-
Update cmakebuilder-plugin to version 2
-
Powered by SuggestiMate
Problem:
After changing the usage from CMAKE_BUILD_TOOL to CMAKE_MAKE_PROGRAM, see https://issues.jenkins-ci.org/browse/JENKINS-29267) Visual Studio Builds do not work anymore.
Workaround:
Explicitly set CMAKE_MAKE_PROGRAM via commandline option:
For example:
-DCMAKE_MAKE_PROGRAM:PATH=C:\Progra~2\MSBuild\12.0\Bin\amd64\MSBuild.exe
Suggestions:
- Reenable the usage of cmake --build . as build step. This works on all plattforms and outsources the build step (calling the correct tools etc.) to cmake
- Fix the automatic recognition of Visual Studio/MSBuild Paths
[JENKINS-29329] Visual Studio/MSBuild projects can not be built implicitly anymore
Yes, I am on V 2.1 of the plugin. I am on CMake 3.3 and both `CMAKE_MAKE_PROGRAM` and `CMAKE_BUILD_TOOL` are not in the cache. Although they have a value, e.g. when I output them via `message(...)`. According to the docs I guess this intended behavior for Visual Studio.
Transcript from CMake docs: Visual Studio generators do not set `CMAKE_MAKE_PROGRAM` at generation time.
Possible Workaround
- For users: Add a build step that invokes `cmake --build`.
- Does not work with cmake < 3.x.
- Does not work because plugin v2.1 will fail the build earlier.
- This might fail when automatic cmake installation feature rolls out.
Solutions
- Allow users to choose between `Invoke cmake --build` and (current) `Invoke build tool` when adding a sub-buildstep to Cmake Build.
- Online help must state: `Invoke cmake --build` works only for cmake v 3.x.
- Online help should state: `Invoke build tool` does work for cmake < 3.0. ASAP
- Online help must state: `Invoke build tool` does not not work with generators that do not set `CMAKE_MAKE_PROGRAM` at generation time (like msbuild). ASAP
- Plugin must not parse cmake cache file (and fail the build) unless an `Invoke build tool` step is given. ASAP
- Plugin implements logic to auto-choose between `Invoke cmake --build` and (current) `Invoke build tool` when adding a sub-buildstep to Cmake Build.
- Con: Never ending maintenance task (concerning generators of the lazily-set-`CMAKE_MAKE_PROGRAM` kind get added to cmake)
- Pro: Convenient to users...
- Con: ... until logic fail due to changes in cmake.
Code changed in jenkins
User: 15knots
Path:
src/main/java/hudson/plugins/cmake/BuildToolStep.java
src/main/java/hudson/plugins/cmake/CmakeBuilder.java
src/main/resources/hudson/plugins/cmake/BuildToolStep/help-withCmake.html
src/test/java/hudson/plugins/cmake/JobBuildTest.java
http://jenkins-ci.org/commit/cmakebuilder-plugin/41b7f6f20d988787492a32a6f5f39f01f15108a8
Log:
JENKINS-29329 CMAKE_BUILD_TOOL: Fixed by implementing solution
#1
Compare: https://github.com/jenkinsci/cmakebuilder-plugin/compare/995633bce33e...41b7f6f20d98
Needs testing on windows before releasing.
Can someone test that with msbuild, please?
Snapshots are here:
https://jenkins.ci.cloudbees.com/job/plugins/job/cmakebuilder-plugin/org.jenkins-ci.plugins$cmakebuilder/lastSuccessfulBuild/artifact/org.jenkins-ci.plugins/cmakebuilder/2.2-SNAPSHOT/cmakebuilder-2.2-SNAPSHOT.hpi
No, does not work for me.
Plugin Version: 2.2-SNAPSHOT (private-43148708-jenkins)
Same error:
– Build files have been written to: C:/Jenkins/workspace/piratol/build
ERROR: Failed to get value for CMAKE_BUILD_TOOL from c:\Jenkins\workspace\piratol\build\CMakeCache.txt
Finished: SUCCESS
more log:
no change for https://chii.selfhost.eu/svn/piratol/trunk since the previous build
Cleaning build dir... c:\Jenkins\workspace\HorusEye\build
[build] $ cmake -G "Visual Studio 14 2015" -DHORUS_3RDPARTY_SILENT:BOOL=TRUE c:\Jenkins\workspace\piratol\source
– The C compiler identification is MSVC 19.0.23026.0
– The CXX compiler identification is MSVC 19.0.23026.0
– Check for working C compiler using: Visual Studio 14 2015
– Check for working C compiler using: Visual Studio 14 2015 – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working CXX compiler using: Visual Studio 14 2015
– Check for working CXX compiler using: Visual Studio 14 2015 – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Boost version: 1.59.0
– Found the following Boost libraries:
– filesystem
– system
– Configuring done
– Generating done
– Build files have been written to: C:/Jenkins/workspace/piratol/build
ERROR: Failed to get value for CMAKE_BUILD_TOOL from c:\Jenkins\workspace\piratol\build\CMakeCache.txt
Finished: SUCCESS
Thank you for testing on Windows!
Does your job actually invoke the build tool? (msbuild in this case.)
I would expect to sees something in the log like
{{-- Build files have been written to: /tmp/hudson5225684379901236121test/workspace/test0/build/debug
[debug] $ cmake --build /tmp/hudson5225684379901236121test/workspace/test0/build/debug --target all
Scanning dependencies of target theBuildArtifact
[100%] Building CXX object CMakeFiles/theBuildArtifact.dir/tester.cpp.o
Linking CXX executable theBuildArtifact
[100%] Built target theBuildArtifact
}}
NOTE: The log above comes from the unit test.
ahh sorry, Yes, it works now !!
I did not add the cmake build step in jenkins because of the same error log but I missed that the cmake config step was now successfull.
Thanks!
– Build files have been written to: C:/Jenkins/workspace/Piratol/build
ERROR: Failed to get value for CMAKE_BUILD_TOOL from c:\Jenkins\workspace\Piratol\build\CMakeCache.txt
[build] $ cmake --build c:\Jenkins\workspace\Piratol\build
Microsoft (R)-Buildmodul, Version 14.0.23107.0
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
Der Buildvorgang wurde am 25.08.2015 09:17:23 gestartet.
...
c:/Jenkins/workspace/Piratol/source/source/base/baselib/CMakeLists.txt
CMake does not need to re-run because C:\Jenkins\workspace\Piratol\build\source\base\baselib\CMakeFiles\generate.stamp is up-to-date.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /IC:\Jenkins\workspace\Piratol\build\source\base\baselib /Ic:\Jenkins\workspace\Piratol\source\source\base\baselib /Ic:\Jenkins\workspace\Piratol\source\source\base\baselib\src /Ic:\Jenkins\workspace\Piratol\source\source\base\baselib\include /I"c:\Jenkins\workspace\Piratol\3rdparty_3\3rdparty\x86\boost_1_59_0\include\boost-1_59" /I"c:\Jenkins\workspace\Piratol\3rdparty_3\3rdparty\x86\log4cpp-1.1.1" /Zi /nologo /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D UNICODE /D _UNICODE /D _CRT_SECURE_NO_WARNINGS /D BOOST_ALL_NO_LIB /D BOOST_LIB_DIAGNOSTIC /D "CMAKE_INTDIR=\"Debug\"" /D BaseLib_EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"BaseLib.dir\Debug
" /Fd"BaseLib.dir\Debug\vc140.pdb" /Gd /TP /wd4290 /wd4251 /wd4275 /wd4996 /analyze- /errorReport:queue
Link:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Jenkins\workspace\Piratol\build\build\debug\bin\BaseLibD.dll" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib "c:\Jenkins\workspace\Piratol\3rdparty_3\3rdparty\x86\boost_1_59_0\lib\boost_filesystem-vc140-mt-gd-1_59.lib" "c:\Jenkins\workspace\Piratol\3rdparty_3\3rdparty\x86\boost_1_59_0\lib\boost_system-vc140-mt-gd-1_59.lib"
...
FinalizeBuildStatus:
Die Datei "Service.dir\Debug\Service.tlog\unsuccessfulbuild" wird gel”scht.
Aktualisieren des Timestamps von "Service.dir\Debug\Service.tlog\Service.lastbuildstate".
Die Erstellung von Projekt "C:\Jenkins\workspace\Piratol\build\source\service\Service.vcxproj" ist abgeschlossen (Standardziele).
PrepareForBuild:
Das Verzeichnis "Win32\Debug\ALL_BUILD\" wird erstellt.
Das Verzeichnis "Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\" wird erstellt.
InitializeBuildStatus:
"Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\unsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
CustomBuild:
Building Custom Rule c:/Jenkins/workspace/Piratol/source/CMakeLists.txt
CMake does not need to re-run because C:\Jenkins\workspace\Piratol\build\CMakeFiles\generate.stamp is up-to-date.
FinalizeBuildStatus:
Die Datei "Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\unsuccessfulbuild" wird gel”scht.
Aktualisieren des Timestamps von "Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\ALL_BUILD.lastbuildstate".
Die Erstellung von Projekt "c:\Jenkins\workspace\Piratol\build\ALL_BUILD.vcxproj" ist abgeschlossen (Standardziele).
Der Buildvorgang wurde erfolgreich ausgef�hrt.
0 Warnung(en)
0 Fehler
Verstrichene Zeit 00:00:59.10
Finished: SUCCESS
Thank you for testing the snapshot version under windows.
So I will close this and JENKINS-29267 and publish the next release.
In my cache there is no `CMAKE_MAKE_PROGRAM` entry too.
Sorry, 'm confused now? Does that mean neither `CMAKE_MAKE_PROGRAM` nor `CMAKE_BUILD_TOOL` is set by cmake 3.x?
Which version of the plugin? V 2.1 now requires a `CMAKE_MAKE_PROGRAM` entry.
If the CMake docs state that `CMAKE_MAKE_PROGRAM` is set but cmake doesn´t set it, I would say it is a bug in cmake.