Bug #59475 CMAKE_HAVE_PTHREAD_H triggers a warning when using VS Express
Submitted: 13 Jan 2011 17:36 Modified: 30 Jul 2019 12:30
Reporter: Santo Leto Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5.9-rev.3238-bzr OS:Windows (Vista 32-bit)
Assigned to: CPU Architecture:Any
Tags: cmake, CMAKE_HAVE_PTHREAD_H

[13 Jan 2011 17:36] Santo Leto
Description:
CMAKE_HAVE_PTHREAD_H triggers a warning when using VS Express.

How to repeat:
* Test 1:

- open visual studio command prompt
- mkdir ofs-nmake-5.5.9-rev-3238-pthreadTest1-bis
- cd ofs-nmake-5.5.9-rev-3238-pthreadTest1-bis
- cmake -DBUILD_CONFIG=mysql_release -G "NMake Makefiles" ..\mysql-5.5

* Test 2 (if this is appropriate):

- download and unzip package "pthreads-w32-2-8-0"
- edit your "include" environment variable to include "C:\pthreads-w32-2-8-0\Pre-built.2\include"
- edit your "lib" environment variable to include "C:\pthreads-w32-2-8-0\Pre-built.2\lib"

continue like we did before:

- open visual studio command prompt (a new one)
- mkdir ofs-nmake-5.5.9-rev-3238-pthreadTest2
- cd ofs-nmake-5.5.9-rev-3238-pthreadTest2
- cmake -DBUILD_CONFIG=mysql_release -G "NMake Makefiles" ..\mysql-5.5

Output:

* Test 1:

cmake -DBUILD_CONFIG=mysql_release -G "NMake Makefiles" ..\mysql-5.5
-- The C compiler identification is MSVC
-- The CXX compiler identification is MSVC
-- Check for CL compiler version
-- Check for CL compiler version - 1600
-- Check if this is a free VC compiler
-- Check if this is a free VC compiler - no
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- 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.5.9
-- Disable authenticode signing for executables
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - not found.        <<<------ here
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Santo_Local/mysql-source/ofs-nmake-5.5.9-rev-3238-pthreadTest1-bis

* Test 2:

cmake -DBUILD_CONFIG=mysql_release -G "NMake Makefiles" ..\mysql-5.5
-- The C compiler identification is MSVC
-- The CXX compiler identification is MSVC
-- Check for CL compiler version
-- Check for CL compiler version - 1600
-- Check if this is a free VC compiler
-- Check if this is a free VC compiler - no
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- 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.5.9
-- Disable authenticode signing for executables
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found		<<<------ here
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found		<<<------ here
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found		<<<------ here
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no			<<<------ here
-- Found Threads: TRUE	
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Santo_Local/mysql-source/ofs-nmake-5.5.9-rev-3238-pthreadTest2
[13 Jan 2011 17:39] Santo Leto
I am pasting below the content of the files "CMakeError.log" for "Test 1" and "Test 2" so that you can see the details of the errors.

* Test 1:

Determining if files pthread.h exist failed with the following output:
Change Dir: D:/Santo_Local/mysql-source/ofs-nmake-5.5.9-rev-3238-pthreadTest1-bis/CMakeFiles/CMakeTmp

Run Build Command:nmake /NOLOGO  "cmTryCompileExec\fast"
	"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe" -f CMakeFiles\cmTryCompileExec.dir\build.make /nologo -L                  CMakeFiles\cmTryCompileExec.dir\build

	"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_report D:\Santo_Local\mysql-source\ofs-nmake-5.5.9-rev-3238-pthreadTest1-bis\CMakeFiles\CMakeTmp\CMakeFiles 1

Building C object CMakeFiles/cmTryCompileExec.dir/CheckIncludeFiles.c.obj

	C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe  @C:\Users\Santo\AppData\Local\Temp\nm922E.tmp

CheckIncludeFiles.c

D:\Santo_Local\mysql-source\ofs-nmake-5.5.9-rev-3238-pthreadTest1-bis\CMakeFiles\CMakeTmp\CheckIncludeFiles.c(2) : fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory

NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe' : return code '0x2'

Stop.

NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'

Stop.

Source:
/* */
#include <pthread.h>

int main(){return 0;}

* Test 2:

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: D:/Santo_Local/mysql-source/ofs-nmake-5.5.9-rev-3238-pthreadTest2/CMakeFiles/CMakeTmp

Run Build Command:nmake /NOLOGO  "cmTryCompileExec\fast"
	"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe" -f CMakeFiles\cmTryCompileExec.dir\build.make /nologo -L                  CMakeFiles\cmTryCompileExec.dir\build

	"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_report D:\Santo_Local\mysql-source\ofs-nmake-5.5.9-rev-3238-pthreadTest2\CMakeFiles\CMakeTmp\CMakeFiles 1

Building C object CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.obj

	C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe  @C:\Users\Santo\AppData\Local\Temp\nmDD8E.tmp

CheckFunctionExists.c

Linking C executable cmTryCompileExec.exe

	"C:\Program Files\CMake 2.8\bin\cmake.exe" -E vs_link_exe C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe  /nologo @CMakeFiles\cmTryCompileExec.dir\objects1.rsp @C:\Users\Santo\AppData\Local\Temp\nmDEA8.tmp

LINK : fatal error LNK1104: cannot open file 'pthreads.lib'

LINK failed. with 2

NMAKE : fatal error U1077: '"C:\Program Files\CMake 2.8\bin\cmake.exe"' : return code '0xffffffff'

Stop.

NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'

Stop.

Determining if the function pthread_create exists in the pthread failed with the following output:
Change Dir: D:/Santo_Local/mysql-source/ofs-nmake-5.5.9-rev-3238-pthreadTest2/CMakeFiles/CMakeTmp

Run Build Command:nmake /NOLOGO  "cmTryCompileExec\fast"
	"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe" -f CMakeFiles\cmTryCompileExec.dir\build.make /nologo -L                  CMakeFiles\cmTryCompileExec.dir\build

	"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_report D:\Santo_Local\mysql-source\ofs-nmake-5.5.9-rev-3238-pthreadTest2\CMakeFiles\CMakeTmp\CMakeFiles 1

Building C object CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.obj

	C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe  @C:\Users\Santo\AppData\Local\Temp\nmE2CC.tmp

CheckFunctionExists.c

Linking C executable cmTryCompileExec.exe

	"C:\Program Files\CMake 2.8\bin\cmake.exe" -E vs_link_exe C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe  /nologo @CMakeFiles\cmTryCompileExec.dir\objects1.rsp @C:\Users\Santo\AppData\Local\Temp\nmE4D0.tmp

LINK : fatal error LNK1104: cannot open file 'pthread.lib'

LINK failed. with 2

NMAKE : fatal error U1077: '"C:\Program Files\CMake 2.8\bin\cmake.exe"' : return code '0xffffffff'

Stop.

NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'

Stop.

Determining if compiler accepts -pthread failed with the following output:
Change Dir: D:/Santo_Local/mysql-source/ofs-nmake-5.5.9-rev-3238-pthreadTest2/CMakeFiles/CMakeTmp

Run Build Command:nmake /NOLOGO  "cmTryCompileExec\fast"
	"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe" -f CMakeFiles\cmTryCompileExec.dir\build.make /nologo -L                  CMakeFiles\cmTryCompileExec.dir\build

	"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_report D:\Santo_Local\mysql-source\ofs-nmake-5.5.9-rev-3238-pthreadTest2\CMakeFiles\CMakeTmp\CMakeFiles 1

Building C object CMakeFiles/cmTryCompileExec.dir/CheckForPthreads.c.obj

	C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe  @C:\Users\Santo\AppData\Local\Temp\nmE9FD.tmp

CheckForPthreads.c

C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\CheckForPthreads.c(3) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory

NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe' : return code '0x2'

Stop.

NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'

Stop.
[28 Apr 2011 8:23] Magnus BlÄudd
You don't need to download any pthread package to compile MySQL Server on Windows. AFAIK it's not even supported since MySQL Server uses a very slim built in pthread emulation layer on Windows.

The build system should not detect pthread on Windows. Is that what your bug report is trying to point out?
[10 May 2011 6:51] Santo Leto
Hi Magnus,

Thanks for your reply.
Yes, I was wondering why I see this warning and how to remove it

-- Looking for include files CMAKE_HAVE_PTHREAD_H - not found.  

If the build system should not detect pthread on Windows, then this bug is about avoiding that a (not necessary) warning is printed.

Thanks
[14 Nov 2011 11:46] MySQL Verification Team
Thank you for the bug report.

H:\mysql-5.5.17>cmake -DBUILD_CONFIG=mysql_release -G "NMake Makefiles" ..\mysql-5.5.17
-- The C compiler identification is MSVC
-- The CXX compiler identification is MSVC
-- Check for CL compiler version
-- Check for CL compiler version - 1500
-- Check if this is a free VC compiler
-- Check if this is a free VC compiler - no
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/cl.exe -- w
orks
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/cl.exe --
 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 - not found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void *
-- Check size of void * - done
-- MySQL 5.5.17
-- Disable authenticode signing for executables
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - not found.
[30 Jul 2019 12:30] Dyre Tjeldvoll
Posted by developer:
 
Officially supported compiler on Windows is VS2017/2016. Closing.