#6457 closed defect (fixed)
MySQL driver build problems with Visual Studio 2015
Reported by: | Jeff McKenna | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 2.1.0 |
Component: | ConfigBuild | Version: | svn-trunk |
Severity: | normal | Keywords: | |
Cc: |
Description
Using Visual Studio 2015 compiler on Windows, attempts to build the MySQL driver fails with lots of errors. The following is for MySQL 5.7.12 (using the libs from http://dev.mysql.com/downloads/mysql/5.1.html#win32) with GDAL-trunk.
Note that older MySQL versions, that work with an old Visual Studio compiler, throw many errors with 2015 as well, so it seems to be caused by Visual Studio 2015 changes.
D:\build\gdal-trunk\ogr\ogrsf_frmts\mysql>nmake /f makefile.vc Microsoft (R) Program Maintenance Utility Version 14.00.23506.0 Copyright (C) Microsoft Corporation. All rights reserved. cl /nologo /MD /EHsc /Ox /FC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG /W4 /wd4127 /wd4251 /wd4275 /wd4786 /wd4100 /wd4245 /wd4206 /wd4611 /DHAVE_SSE_AT_COMPILE_TIME -I..\..\..\port -I..\..\..\ogr -I..\..\..\gcore -I..\..\..\alg -I..\..\..\ogr\ogrsf_frmts -I..\..\..\gnm -I..\..\..\gnm\gnm_frmts -I..\..\..\apps /DHAVE_AVX_AT_COMPILE_TIME -I.. -I..\.. -I"D:\build\gdal-trunk"\..\mysql-5.7.12-win32\include -DMYSQL_ENABLED -DOGR_ENABLED -DGDAL_COMPILATION /c ogrmysqldriver.cpp ogrmysqldatasource.cpp ogrmysqllayer.cpp ogrmysqltablelayer.cpp ogrmysqlresultlayer.cpp ogrmysqldriver.cpp ogrmysqldatasource.cpp ogrmysqllayer.cpp ogrmysqltablelayer.cpp ogrmysqlresultlayer.cpp D:\build\mysql-5.7.12-win32\include\my_global.h(676): error C2011: 'timespec': 'struct' type redefinition (compiling source file ogrmysqltablelayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqltablelayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(708): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqltablelayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(708): error C2227: left of '->max_timeout_msec' must point to class/struct/union/generic type (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqltablelayer.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(676): error C2011: 'timespec': 'struct' type redefinition (compiling source file ogrmysqldatasource.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqltablelayer.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldatasource.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqltablelayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldatasource.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqldatasource.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(708): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldatasource.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqltablelayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldatasource.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(708): error C2227: left of '->max_timeout_msec' must point to class/struct/union/generic type (compiling source file ogrmysqldatasource.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldatasource.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqltablelayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldatasource.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqltablelayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldatasource.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldatasource.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(676): error C2011: 'timespec': 'struct' type redefinition (compiling source file ogrmysqlresultlayer.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(676): error C2011: 'timespec': 'struct' type redefinition (compiling source file ogrmysqldriver.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqlresultlayer.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldriver.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqlresultlayer.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldriver.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(676): error C2011: 'timespec': 'struct' type redefinition (compiling source file ogrmysqllayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqlresultlayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldriver.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqllayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqlresultlayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqldriver.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqllayer.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqlresultlayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqllayer.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqldriver.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqllayer.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(708): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqlresultlayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(708): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldriver.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(703): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqllayer.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqlresultlayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldriver.cpp)D:\build\mysql-5.7.12-win32\include\thr_cond.h(67): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldatasource.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(708): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqllayer.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(708): error C2227: left of '->max_timeout_msec' must point to class/struct/union/generic type (compiling source file ogrmysqlresultlayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldatasource.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqllayer.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(708): error C2227: left of '->max_timeout_msec' must point to class/struct/union/generic type (compiling source file ogrmysqldriver.cpp) D:\build\mysql-5.7.12-win32\include\thr_cond.h(67): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(708): error C2227: left of '->max_timeout_msec' must point to class/struct/union/generic type (compiling source file ogrmysqllayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqlresultlayer.cpp)D:\build\mysql-5.7.12-win32\include\thr_cond.h(67): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqldatasource.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqlresultlayer.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldriver.cpp)D:\build\mysql-5.7.12-win32\include\thr_cond.h(77): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldatasource.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqllayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqlresultlayer.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldriver.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldatasource.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqllayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqlresultlayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqldriver.cpp) D:\build\mysql-5.7.12-win32\include\thr_cond.h(77): error C2227: left of '->max_timeout_msec' must point to class/struct/union/generic type (compiling source file ogrmysqldatasource.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqllayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqldriver.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(734): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqllayer.cpp)D:\build\mysql-5.7.12-win32\include\thr_cond.h(78): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldatasource.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldatasource.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqlresultlayer.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldriver.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqllayer.cpp) D:\build\mysql-5.7.12-win32\include\thr_cond.h(78): error C2227: left of '->max_timeout_msec' must point to class/struct/union/generic type (compiling source file ogrmysqldatasource.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldriver.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqlresultlayer.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqllayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqldriver.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqlresultlayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqllayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqldriver.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqlresultlayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(736): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqllayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqlresultlayer.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqldriver.cpp)D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2027: use of undefined type 'timespec' (compiling source file ogrmysqllayer.cpp) c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqlresultlayer.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqldriver.cpp)c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec' (compiling source file ogrmysqllayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqlresultlayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqldriver.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2227: left of '->tv' must point to class/struct/union/generic type (compiling source file ogrmysqllayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqlresultlayer.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqldriver.cpp) D:\build\mysql-5.7.12-win32\include\my_global.h(748): error C2228: left of '.i64' must have class/struct/union (compiling source file ogrmysqllayer.cpp) NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"' : return code '0x2' Stop.
Attachments (1)
Change History (6)
by , 8 years ago
Attachment: | timespec.patch added |
---|
comment:1 by , 8 years ago
I've attached a patch to set "HAVE_STRUCT_TIMESPEC", which solves the build problem.
comment:2 by , 8 years ago
Jeff, does the following variation, which tests the compiler version, work ? (you have to build with MSVC_VER=1900 in nmake.local or with nmake /f makefile.vc MSVC_VER=1900)
Index: ogr/ogrsf_frmts/mysql/makefile.vc =================================================================== --- ogr/ogrsf_frmts/mysql/makefile.vc (revision 33943) +++ ogr/ogrsf_frmts/mysql/makefile.vc (working copy) @@ -8,6 +8,11 @@ EXTRAFLAGS = -I.. -I..\.. -I$(MYSQL_INC_DIR) +!IF $(MSVC_VER) >= 1900 +# Visual Studio 2015 has timespec structure, so we should prevent my_global.h (in mysql 5.7.12 e.g) from redefining it +EXTRAFLAGS = $(EXTRAFLAGS) -HAVE_STRUCT_TIMESPEC +!ENDIF + default: $(OBJ) clean:
comment:3 by , 8 years ago
You missed the "-D" part though in "-DHAVE_STRUCT_TIMESPEC". With that change it works.
comment:4 by , 8 years ago
Component: | default → ConfigBuild |
---|---|
Milestone: | → 2.1.0 |
Resolution: | → fixed |
Status: | new → closed |
Set "-DHAVE_STRUCT_TIMESPEC" in makefile