Bug #58313 CMake stops with VS Express if -DBUILD_CONFIG=mysql_release
Submitted: 19 Nov 2010 1:42 Modified: 23 Jul 2011 10:05
Reporter: Santo Leto Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5-bzr OS:Microsoft Windows (7)
Assigned to: Vladislav Vaintroub CPU Architecture:Any
Tags: cmake, mysql_release, signtool.exe
Triage: Needs Triage: D4 (Minor) / R1 (None/Negligible)

[19 Nov 2010 1:42] Santo Leto
Description:
When using Express Edition of Visual Studio 10 to compile MySQL 5.5 using the build configuration "mysql_release", if SDK is not installed on the system, CMake stops because it does not find the tool signtool.exe.

How to repeat:
Execute:
cmake -DBUILD_CONFIG=mysql_release -G "Visual Studio 10"

Note: signtool.exe is included in the Windows Platform SDK. If for some other reasons you installed SDK, please make sure you don't have it in your system path, otherwise you won't be able to reproduce the bug (for example, in my machine I get the bug if I remove from my path variable "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin").

Output:
D:\build3>cmake -DBUILD_CONFIG=mysql_release -G "Visual Studio 10"
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void *
-- Check size of void * - done
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10
-- Check for working CXX compiler using: Visual Studio 10 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at cmake/install_macros.cmake:158 (MESSAGE):
  signtool is not found.  Signing executables not possible
Call Stack (most recent call first):
  CMakeLists.txt:138 (INCLUDE)
  
-- Configuring incomplete, errors occurred!

Suggested fix:
The problem is that BUILD_CONFIG=mysql_release sets SIGNCODE parameter (default is OFF) and hence CMake fails because it does not find signtool.exe which is not included in the Express Edition of VS.

But SIGNCODE could be ignored actually, or else make the build not fail for someone who is trying to build with VC Express.

After short conversation with Vladislav, we think it's better to fix this error instead of requiring users to install Windows SDK.

Workaround:
If you provide the extra parameter -DSIGNCODE=0, CMake will not stop:

D:\build3>cmake -DBUILD_CONFIG=mysql_release -G "Visual Studio 10" -DSIGNCODE=0
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - not found.
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: D:/build3
[19 Nov 2010 23:21] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/124527

3129 Vladislav Vaintroub	2010-11-20
      Bug#58313: CMake stops with VS Express if -DBUILD_CONFIG=mysql_release.cmake
      
      Bug : -DBUILD_CONFIG=mysql_release sets SIGNCODE parameter which requires 
      singtool.exe (part of Windows SDK)  in order to be able to sign the binaries (
      only if valid certificate is found). However singtool is not a part of the SDK shipped
      with Visual Studio Express, so the build fails claiming missing singtools.exe
      
      Fix: Do not  use SIGNCODE  wiith VC Express.
      
      Also, fix broken nmake build (*.rc files could not be compiled due to ADD_DEFINITIONS
      contaning C/C++ compiler specific flags)
[5 Dec 2010 12:38] Bugs System
Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (version source revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (merge vers: 5.6.1) (pib:23)
[12 Dec 2010 5:31] Paul Dubois
Noted in 5.5.8 changelog.

When configuring the build with -DBUILD_CONFIG=mysql_release and
building with Visual Studio Express, the build failed if signtool.exe
was not present.
[16 Dec 2010 22:26] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (version source revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (merge vers: 5.5.9) (pib:24)
[23 Jul 2011 4:49] Shane Bester
I see this also, on todays mysql-trunk and VC 2010 Express with all updates.

E:\builds\bzr\mysql-trunk>cmake . -DBUILD_CONFIG=mysql_release -G "Visual Studio 10"
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10
-- Check for working CXX compiler using: Visual Studio 10 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void *
-- Check size of void * - done
-- MySQL 5.6.3-m5
CMake Error at cmake/install_macros.cmake:155 (MESSAGE):
  signtool is not found.  Signing executables not possible
Call Stack (most recent call first):
  CMakeLists.txt:148 (INCLUDE)

-- Configuring incomplete, errors occurred!
[23 Jul 2011 4:54] Shane Bester
meh, -DSIGNCODE=0 workaround works here...
[23 Jul 2011 10:05] Davi Arnaut
It is only skipped automatically when CMake flags the build as using the (free) Visual C++ Express compiler. The problem is that CMake only detects it under a few circumstances, which does not include various express editions and configurations, such as when the build is done within the IDE.

In conclusion, when using mysql_release.cmake on Windows without a file signing tool, use -DSIGNCODE=0.