OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.9k stars 2.55k forks source link

Known Issue: Compile error with mingw-w64 5.3.1 on Linux Mint 18.3 64bit (Ubuntu 16.04 LTS Xenial) #1247

Closed miurahr closed 5 years ago

miurahr commented 5 years ago

Expected behavior and actual behavior.

Travis-CI mingw-w64 test (on trusty) is passed, but when I run a mingw-w64 cross compilation on Mint Linux 18.3 64bit (equivalent with Ubuntu Linux 16.04 LTS Xenial) using mingw-w64 5.3.1, it fails with error as follows.

/bin/bash /home/miurahr/projects/gdal-gnumake/gdal/libtool --mode=compile --silent --tag=CXX ccache x86_64-w64-mingw32-g++ -std=c++11 -I/home/miurahr/projects/gdal-gnumake/gdal/port -I/home/miurahr/projects/gdal-gnumake/gdal/gcore -I/home/miurahr/projects/gdal-gnumake/gdal/alg -I/home/miurahr/projects/gdal-gnumake/gdal/ogr -I/home/miurahr/projects/gdal-gnumake/gdal/ogr/ogrsf_frmts -I/home/miurahr/projects/gdal-gnumake/gdal/gnm -I/home/miurahr/projects/gdal-gnumake/gdal/apps -Weffc++ -Wold-style-cast -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2 -DSUPPORTS_WMAIN  -Wall -Wextra -Winit-self -Wunused-parameter -Wformat -Werror=format-security -Wno-format-nonliteral -Wlogical-op -Wshadow -Werror=vla -Wdate-time -Wfloat-conversion -Wmissing-declarations -Wnon-virtual-dtor -Woverloaded-virtual -fno-operator-names -Wzero-as-null-pointer-constant -Wsuggest-override  -DGNM_ENABLED -DDONT_DEPRECATE_SPRINTF -I/home/miurahr/projects/gdal-gnumake/gdal/port  -DGDAL_COMPILATION     -I/home/miurahr/projects/gdal-gnumake/gdal/ogr/ogrsf_frmts/geojson/libjson  -DINST_DATA=\"/usr/local/share/gdal\" -DHAVE_LIBZ -DUSE_ONLY_CRYPTODLL_ALG -c -o cpl_vsil_gzip.lo cpl_vsil_gzip.cpp
cpl_vsil_gzip.cpp:1205:10: error: 'mutex' in namespace 'std' does not name a type
     std::mutex         sMutex_{};
          ^
cpl_vsil_gzip.cpp: In static member function 'static void VSIGZipWriteHandleMT::DeflateCompress(void*)':
cpl_vsil_gzip.cpp:1479:25: error: 'mutex' is not a member of 'std'
         std::lock_guard<std::mutex> oLock(psJob->pParent_->sMutex_);
                         ^
cpl_vsil_gzip.cpp:1479:25: error: 'mutex' is not a member of 'std'
cpl_vsil_gzip.cpp:1479:35: error: template argument 1 is invalid
         std::lock_guard<std::mutex> oLock(psJob->pParent_->sMutex_);
                                   ^
cpl_vsil_gzip.cpp:1479:60: error: 'class VSIGZipWriteHandleMT' has no member named 'sMutex_'
         std::lock_guard<std::mutex> oLock(psJob->pParent_->sMutex_);
                                                            ^
cpl_vsil_gzip.cpp:1479:37: warning: unused variable 'oLock' [-Wunused-variable]
         std::lock_guard<std::mutex> oLock(psJob->pParent_->sMutex_);
                                     ^
cpl_vsil_gzip.cpp: In static member function 'static void VSIGZipWriteHandleMT::CRCCompute(void*)':
cpl_vsil_gzip.cpp:1497:25: error: 'mutex' is not a member of 'std'
         std::lock_guard<std::mutex> oLock(psJob->pParent_->sMutex_);
                         ^
cpl_vsil_gzip.cpp:1497:25: error: 'mutex' is not a member of 'std'
cpl_vsil_gzip.cpp:1497:35: error: template argument 1 is invalid
         std::lock_guard<std::mutex> oLock(psJob->pParent_->sMutex_);
                                   ^
cpl_vsil_gzip.cpp:1497:60: error: 'class VSIGZipWriteHandleMT' has no member named 'sMutex_'
         std::lock_guard<std::mutex> oLock(psJob->pParent_->sMutex_);
                                                            ^
cpl_vsil_gzip.cpp:1497:37: warning: unused variable 'oLock' [-Wunused-variable]
         std::lock_guard<std::mutex> oLock(psJob->pParent_->sMutex_);
                                     ^
cpl_vsil_gzip.cpp: In member function 'bool VSIGZipWriteHandleMT::ProcessCompletedJobs()':
cpl_vsil_gzip.cpp:1535:21: error: 'mutex' is not a member of 'std'
     std::lock_guard<std::mutex> oLock(sMutex_);
                     ^
cpl_vsil_gzip.cpp:1535:21: error: 'mutex' is not a member of 'std'
cpl_vsil_gzip.cpp:1535:31: error: template argument 1 is invalid
     std::lock_guard<std::mutex> oLock(sMutex_);
                               ^
cpl_vsil_gzip.cpp:1535:39: error: 'sMutex_' was not declared in this scope
     std::lock_guard<std::mutex> oLock(sMutex_);
                                       ^
cpl_vsil_gzip.cpp:1535:33: warning: unused variable 'oLock' [-Wunused-variable]
     std::lock_guard<std::mutex> oLock(sMutex_);
                                 ^
cpl_vsil_gzip.cpp: In member function 'VSIGZipWriteHandleMT::Job* VSIGZipWriteHandleMT::GetJobObject()':
cpl_vsil_gzip.cpp:1634:25: error: 'mutex' is not a member of 'std'
         std::lock_guard<std::mutex> oLock(sMutex_);
                         ^
cpl_vsil_gzip.cpp:1634:25: error: 'mutex' is not a member of 'std'
cpl_vsil_gzip.cpp:1634:35: error: template argument 1 is invalid
         std::lock_guard<std::mutex> oLock(sMutex_);
                                   ^
cpl_vsil_gzip.cpp:1634:43: error: 'sMutex_' was not declared in this scope
         std::lock_guard<std::mutex> oLock(sMutex_);
                                           ^
cpl_vsil_gzip.cpp:1634:37: warning: unused variable 'oLock' [-Wunused-variable]
         std::lock_guard<std::mutex> oLock(sMutex_);
                                     ^
cpl_vsil_gzip.cpp: In member function 'virtual size_t VSIGZipWriteHandleMT::Write(const void*, size_t, size_t)':
cpl_vsil_gzip.cpp:1664:37: error: 'mutex' is not a member of 'std'
                     std::lock_guard<std::mutex> oLock(sMutex_);
                                     ^
cpl_vsil_gzip.cpp:1664:37: error: 'mutex' is not a member of 'std'
cpl_vsil_gzip.cpp:1664:47: error: template argument 1 is invalid
                     std::lock_guard<std::mutex> oLock(sMutex_);
                                               ^
cpl_vsil_gzip.cpp:1664:55: error: 'sMutex_' was not declared in this scope
                     std::lock_guard<std::mutex> oLock(sMutex_);
                                                       ^
cpl_vsil_gzip.cpp:1664:49: warning: unused variable 'oLock' [-Wunused-variable]
                     std::lock_guard<std::mutex> oLock(sMutex_);
                                                 ^
../GDALmake.opt:683: recipe for target 'cpl_vsil_gzip.lo' failed
make: *** [cpl_vsil_gzip.lo] Error 1

Steps to reproduce the problem.

  1. Add PPA

    $ sudo add-apt-repository -y ppa:miurahr/gdal-dev-additions
  2. Install following standard and custom packages

    $ sudo apt-get install mingw-w64 libnpth-mingw-w64-dev libz-mingw-w64-dev  mingw-w64-tools 
    $ sudo apt-get install libgeos-mingw-w64-dev libproj-mingw-w64-dev
  3. run configure

    $ CC="ccache x86_64-w64-mingw32-gcc" CXX="ccache x86_64-w64-mingw32-g++" ./configure --host=x86_64-w64-mingw32

got

GDAL is now configured for x86_64-w64-mingw32

  Installation directory:    /usr/local
  C compiler:                ccache x86_64-w64-mingw32-gcc -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2
  C++ compiler:              ccache x86_64-w64-mingw32-g++ -std=c++11 -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2 -DSUPPORTS_WMAIN
  C++14 support:             no

  LIBTOOL support:           yes

  LIBZ support:              external
  LIBLZMA support:           no
  ZSTD support:              no
  cryptopp support:          no
  crypto/openssl support:    no
  GRASS support:             no
  CFITSIO support:           no
  PCRaster support:          internal
  LIBPNG support:            internal
  DDS support:               no
  GTA support:               no
  LIBTIFF support:           internal (BigTIFF=yes)
  LIBGEOTIFF support:        internal
  LIBJPEG support:           internal
  12 bit JPEG:               yes
  12 bit JPEG-in-TIFF:       yes
  LIBGIF support:            internal
  JPEG-Lossless/CharLS:      no
  OGDI support:              yes
  HDF4 support:              no
  HDF5 support:              no
  Kea support:               yes
  NetCDF support:            no
  Kakadu support:            no
  JasPer support:            no
  OpenJPEG support:          no
  ECW support:               no
  MrSID support:             no
  MrSID/MG4 Lidar support:   no
  JP2Lura support:           no
  MSG support:               no
  GRIB support:              yes
  EPSILON support:           no
  WebP support:              no
  cURL support (wms/wcs/...):no
  PostgreSQL support:        no
  MRF support:               yes
  LERC support:              yes
  MySQL support:             no
  Ingres support:            no
  Xerces-C support:          no
  NAS support:               no
  Expat support:             no
  libxml2 support:           no
  Google libkml support:     no
  ODBC support:              no
  PGeo support:              no
  FGDB support:              no
  MDB support:               no
  PCIDSK support:            internal
  OCI support:               no
  GEORASTER support:         no
  SDE support:               no
  Rasdaman support:          no
  DODS support:              no
  SQLite support:            no
  PCRE support:              no
  SpatiaLite support:        no
  RasterLite2 support:       no
  Teigha (DWG and DGNv8):    no
  INFORMIX DataBlade support:no
  GEOS support:              no
  SFCGAL support:            no
  QHull support:             internal
  Poppler support:           no
  Podofo support:            no
  PDFium support:            no
  OpenCL support:            no
  Armadillo support:         no
  FreeXL support:            no
  SOSI support:              no
  MongoDB support:           no
  MongoCXX v3 support:       no
  HDFS support:              no
  userfaultfd support:       no

  SWIG Bindings:             no

  Statically link PROJ:      no
  enable GNM building:       yes
  enable pthread support:    yes
  enable POSIX iconv support:no, consider installing GNU libiconv
  hide internal symbols:     no
  1. make
    $ make -j3

Operating system

Mint Linux 18.3 64bit (equivalent with Ubuntu 16.04 64 bit)

GDAL version and provenance

master(449b5ce7eca)

rouault commented 5 years ago

This is a defect of mingw, at least in that version, that doesn't fully implement C++11 (the threading part). I believe there's a workaround by using the i686-w64-mingw32-gcc-5.3-posix variant (or the other way round i686-w64-mingw32-gcc-5.3-win32) I believe @robe hit that issue with a native mingw build. Perhaps she remembers the solution ?

miurahr commented 5 years ago

Thank you for information.

Because mingw-w64 5.3.1 is a standard version on Ubuntu 16.04 LTS, Iit is better to add it in documentation, but who use mingw would be developer so ticket here is enough. I'd like to close here as known issue.

miurahr commented 5 years ago

It is resolved by specifing

 $  CXX="x86_64-w64-mingw32-g++-posix"  CC="x86_64-w64-mingw32-gcc-posix" ./configure