Opened 6 years ago

Closed 6 years ago

#914 closed defect (fixed)

cmake compile under mingw64 gcc 8.1

Reported by: robe Owned by: geos-devel@…
Priority: major Milestone: 3.8.0
Component: Build/Install (cmake) Version: main
Severity: Significant Keywords: mingw64 gcc 8.1
Cc:

Description

CMAke compile no longer works after I upgraded my gcc from 4.8.3 to 8.1, though now the autoconf way at least compiles

Your branch is up to date with 'origin/master'.
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: C:/ming64gcc81/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/ming64gcc81/mingw64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/ming64gcc81/mingw64/bin/g++.exe
-- Check for working CXX compiler: C:/ming64gcc81/mingw64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting C++ requirement to C++11
-- Setting GEOS version 3.7.0dev as port of JTS 1.13.0
-- Setting GEOS C API version 1.11.0
-- Setting GEOS build type - Debug
-- Forcing IEEE 754 using flag -ffloat-store - ON
-- Setting GEOS compilation with small functions inlining - NO
-- Setting GEOS compilation with assert() macro enabled - OFF
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found
-- Looking for include file ieeefp.h
-- Looking for include file ieeefp.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of int64_t
-- Check size of int64_t - done
-- Performing Test HAVE_STD_ISFINITE
-- Performing Test HAVE_STD_ISFINITE - Failed
-- Looking for isfinite
-- Looking for isfinite - not found
-- Found Git: C:/ming64gcc81/msys/usr/bin/git.exe (found version "2.17.1")
-- Generating GEOS C:/ming64gcc81/projects/geos/branches/build/geos_revision.h
-- Generating GEOS C:/ming64gcc81/projects/geos/branches/build/include/geos/platform.h
-- Generating GEOS C:/ming64gcc81/projects/geos/branches/build/include/geos/version.h
-- Generating GEOS C:/ming64gcc81/projects/geos/branches/build/capi/geos_c.h
-- Enable GEOS unit tests build - ON
-- Enable GEOS XML tests build - ON
-- Enable GEOS large geometry tests build - ON
-- Enable GEOS performance tests build - ON
-- CMake 3.7.2 successfully configured GEOS using MSYS Makefiles generator
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    HAVE_LONG_LONG_INT_64


-- Build files have been written to: C:/ming64gcc81/projects/geos/branches/build
Scanning dependencies of target geos
[  0%] Building CXX object src/CMakeFiles/geos.dir/algorithm/Angle.cpp.obj
[  0%] Building CXX object src/CMakeFiles/geos.dir/algorithm/BoundaryNodeRule.cpp.obj
[  0%] Building CXX object src/CMakeFiles/geos.dir/algorithm/CGAlgorithms.cpp.obj
[  0%] Building CXX object src/CMakeFiles/geos.dir/algorithm/Centroid.cpp.obj
[  0%] Building CXX object src/CMakeFiles/geos.dir/algorithm/CentroidArea.cpp.obj
[  0%] Building CXX object src/CMakeFiles/geos.dir/algorithm/CentroidLine.cpp.obj
[  0%] Building CXX object src/CMakeFiles/geos.dir/algorithm/CentroidPoint.cpp.obj
[  1%] Building CXX object src/CMakeFiles/geos.dir/algorithm/ConvexHull.cpp.obj
[  1%] Building CXX object src/CMakeFiles/geos.dir/algorithm/HCoordinate.cpp.obj
In file included from C:/ming64gcc81/projects/geos/branches/master/include/geos/geom/Coordinate.h:19,
                 from C:/ming64gcc81/projects/geos/branches/master/src/algorithm/HCoordinate.cpp:23:
C:/ming64gcc81/projects/geos/branches/master/src/algorithm/HCoordinate.cpp: In static member function 'static void geos::algorithm::HCoordinate::intersection(const geos::geom::Coordinate&, const geos::geom::Coordinate&, const geos::geom::Coordinate&, const geos::geom::Coordinate&, geos::geom::Coordinate&)':
C:/ming64gcc81/projects/geos/branches/build/include/geos/platform.h:70:23: error: 'finite' was not declared in this scope
 #    define FINITE(x) finite(x)
                       ^~~~~~
C:/ming64gcc81/projects/geos/branches/master/src/algorithm/HCoordinate.cpp:74:9: note: in expansion of macro 'FINITE'
  if ( (!FINITE(xInt)) || (!FINITE(yInt)) )
         ^~~~~~
C:/ming64gcc81/projects/geos/branches/build/include/geos/platform.h:70:23: note: suggested alternative: 'finitef'
 #    define FINITE(x) finite(x)
                       ^~~~~~
C:/ming64gcc81/projects/geos/branches/master/src/algorithm/HCoordinate.cpp:74:9: note: in expansion of macro 'FINITE'
  if ( (!FINITE(xInt)) || (!FINITE(yInt)) )
         ^~~~~~
C:/ming64gcc81/projects/geos/branches/master/src/algorithm/HCoordinate.cpp: In member function 'double geos::algorithm::HCoordinate::getX() const':
C:/ming64gcc81/projects/geos/branches/build/include/geos/platform.h:70:23: error: 'finite' was not declared in this scope
 #    define FINITE(x) finite(x)
                       ^~~~~~
C:/ming64gcc81/projects/geos/branches/master/src/algorithm/HCoordinate.cpp:151:8: note: in expansion of macro 'FINITE'
  if ( !FINITE(a) ) {
        ^~~~~~
C:/ming64gcc81/projects/geos/branches/build/include/geos/platform.h:70:23: note: suggested alternative: 'finitef'
 #    define FINITE(x) finite(x)
                       ^~~~~~
C:/ming64gcc81/projects/geos/branches/master/src/algorithm/HCoordinate.cpp:151:8: note: in expansion of macro 'FINITE'
  if ( !FINITE(a) ) {
        ^~~~~~
C:/ming64gcc81/projects/geos/branches/master/src/algorithm/HCoordinate.cpp: In member function 'double geos::algorithm::HCoordinate::getY() const':
C:/ming64gcc81/projects/geos/branches/build/include/geos/platform.h:70:23: error: 'finite' was not declared in this scope
 #    define FINITE(x) finite(x)
                       ^~~~~~
C:/ming64gcc81/projects/geos/branches/master/src/algorithm/HCoordinate.cpp:162:8: note: in expansion of macro 'FINITE'
  if ( !FINITE(a) ) {
        ^~~~~~
C:/ming64gcc81/projects/geos/branches/build/include/geos/platform.h:70:23: note: suggested alternative: 'finitef'
 #    define FINITE(x) finite(x)
                       ^~~~~~
C:/ming64gcc81/projects/geos/branches/master/src/algorithm/HCoordinate.cpp:162:8: note: in expansion of macro 'FINITE'
  if ( !FINITE(a) ) {
        ^~~~~~
make[2]: *** [src/CMakeFiles/geos.dir/build.make:264: src/CMakeFiles/geos.dir/algorithm/HCoordinate.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:202: src/CMakeFiles/geos.dir/all] Error 2
make: *** [Makefile:139: all] Error 2


Change History (14)

comment:1 by robe, 6 years ago

Hmm but compiles on the svn-3.6 branch and all tests pass so must be something we changed in 3.7

Checking out files: 100% (895/895), done.
Switched to branch 'svn-3.6'
Your branch is up to date with 'origin/svn-3.6'.
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: C:/ming64gcc81/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/ming64gcc81/mingw64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/ming64gcc81/mingw64/bin/g++.exe
-- Check for working CXX compiler: C:/ming64gcc81/mingw64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting GEOS version 3.6.4dev as port of JTS 1.13.0
-- Setting GEOS C API version 1.10.4
-- Setting GEOS build type - Debug
-- Forcing IEEE 754 using flag -ffloat-store - ON
-- Setting GEOS compilation with small functions inlining - NO
-- Setting GEOS compilation with assert() macro enabled - OFF
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found
-- Looking for include file ieeefp.h
-- Looking for include file ieeefp.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of int64_t
-- Check size of int64_t - done
-- Performing Test HAVE_STD_ISFINITE
-- Performing Test HAVE_STD_ISFINITE - Failed
-- Looking for isfinite
-- Looking for isfinite - found
-- Generating GEOS C:/ming64gcc81/projects/geos/branches/build/include/geos/platform.h
-- Generating GEOS C:/ming64gcc81/projects/geos/branches/build/include/geos/version.h
-- Generating GEOS C:/ming64gcc81/projects/geos/branches/build/capi/geos_c.h
-- Enable GEOS Unit Tests build - ON
-- Enable GEOS XML Tester build - ON
-- Enable GEOS large geometry tests build - ON
-- CMake 3.7.2 successfully configured GEOS using MSYS Makefiles generator
-- Configuring done
-- Generating done
-- Build files have been written to: C:/ming64gcc81/projects/geos/branches/build

:
:
Scanning dependencies of target bug234
[100%] Building CXX object tests/bigtest/CMakeFiles/bug234.dir/bug234.cpp.obj
[100%] Linking CXX executable ../../bin/bug234.exe
[100%] Built target bug234
Scanning dependencies of target TestSweepLineSpeed
[100%] Building CXX object tests/bigtest/CMakeFiles/TestSweepLineSpeed.dir/TestSweepLineSpeed.cpp.obj
[100%] Building CXX object tests/bigtest/CMakeFiles/TestSweepLineSpeed.dir/GeometryTestFactory.cpp.obj
[100%] Linking CXX executable ../../bin/TestSweepLineSpeed.exe
[100%] Built target TestSweepLineSpeed



comment:2 by robe, 6 years ago

first difference I see is in 3.7, it can't detect my isfinite function but in 3.6 it can.

Other difference is in 3.7 we must have taken out this switch

 CMake Warning:
  Manually-specified variables were not used by the project:

    HAVE_LONG_LONG_INT_64

cause I get the warning on 3.7 but not 3.6

comment:3 by cvvergara, 6 years ago

I dont have problems

 cmake ..
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting C++ requirement to C++11
-- Setting GEOS version 3.7.0dev as port of JTS 1.13.0
-- Setting GEOS C API version 1.11.0
-- Setting GEOS C API soversion 1
-- Setting GEOS build type - Debug
-- Forcing IEEE 754 using flag -ffloat-store - ON
-- Setting GEOS compilation with small functions inlining - ON
-- Setting GEOS compilation with assert() macro enabled - OFF
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found
-- Looking for include file ieeefp.h
-- Looking for include file ieeefp.h - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of int64_t
-- Check size of int64_t - done
-- Performing Test HAVE_STD_ISNAN
-- Performing Test HAVE_STD_ISNAN - Failed
-- Looking for isnan
-- Looking for isnan - found
-- Performing Test HAVE_STD_ISFINITE
-- Performing Test HAVE_STD_ISFINITE - Failed
-- Looking for isfinite
-- Looking for isfinite - found
-- Found Git: /usr/bin/git (found version "2.7.4") 
-- Generating GEOS /home/vicky/potree/geos/vicky/build/geos_revision.h
-- Generating GEOS /home/vicky/potree/geos/vicky/build/include/geos/platform.h
-- Generating GEOS /home/vicky/potree/geos/vicky/build/include/geos/version.h
-- Generating GEOS /home/vicky/potree/geos/vicky/build/capi/geos_c.h
-- Enable GEOS unit tests build - ON
-- Enable GEOS XML tests build - ON
-- Enable GEOS large geometry tests build - ON
-- Enable GEOS performance tests build - ON
-- CMake 3.5.1 successfully configured GEOS using Unix Makefiles generator
-- Configuring done
-- Generating done
-- Build files have been written to:

....
[ 42%] Building CXX object src/CMakeFiles/geos.dir/algorithm/HCoordinate.cpp.o
[ 42%] Building CXX object src/CMakeFiles/geos.dir/algorithm/LineIntersector.cpp.o
[ 42%] Building CXX object src/CMakeFiles/geos-static.dir/algorithm/HCoordinate.cpp.o
[ 42%] Building CXX object src/CMakeFiles/geos.dir/algorithm/RobustDeterminant.cpp.o
[ 42%] Building CXX object src/CMakeFiles/geos-static.dir/algorithm/LineIntersector.cpp.o
[ 42%] Building CXX object src/CMakeFiles/geos.dir/simplify/TopologyPreservingSimplifier.cpp.o

comment:4 by robe, 6 years ago

Weird - well on winnie I see the same:

 CMake Warning:
  Manually-specified variables were not used by the project:

    HAVE_LONG_LONG_INT_64

-- Looking for isfinite - not found

But she compiles fine.

If I take out the

https://git.osgeo.org/gitea/geos/geos/src/branch/master/CMakeLists.txt#L34

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

gcc 8.1 mingw64 compiles and make checks fine. Not sure why those lines are making it go crazy.

comment:5 by cvvergara, 6 years ago

Maybe because on C++11 cmath is standard, and then checking for isfinite on cmath is useless.

Since C++11, isfinite shoud exist when using include <cmath>:

https://en.cppreference.com/w/cpp/numeric/math/isfinite

same applies to isnan

https://en.cppreference.com/w/cpp/numeric/math/isnan

comment:6 by cvvergara, 6 years ago

Forgot to mention that on C++11 and CheckPrototypeExists.cmake does not work for templates

Last edited 6 years ago by cvvergara (previous) (diff)

comment:7 by robe, 6 years ago

how come your

-- Looking for isfinite - found

works then or is it picking up the one in cmath. Also is <cmath> and math.h the same thing.

Looks like we have:

check_symbol_exists(isfinite math.h HAVE_ISFINITE)

is that the way you check for cmath?

comment:8 by cvvergara, 6 years ago

I have a master slave relationship between gcc and g++ Maybe gcc version 8 is not installed

this is the script I use when I change linux version

sudo apt-get update && \
    sudo apt-get install build-essential software-properties-common -y && \
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
    sudo apt-get update && \
    sudo apt-get install gcc-snapshot -y

sudo apt-get update && \
    sudo apt-get install gcc-4.8 g++-4.8 -y && \
    sudo apt-get install gcc-4.9 g++-4.9 -y && \
    sudo apt-get install gcc-5 g++-5 -y && \
    sudo apt-get install gcc-6 g++-6 -y && \
    sudo apt-get install gcc-7 g++-7 -y && \
    sudo apt-get install gcc-8 g++-8 -y

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8     60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 && \
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9 && \
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5   60 --slave /usr/bin/g++ g++ /usr/bin/g++-5 && \
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6   60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7   60 --slave /usr/bin/g++ g++ /usr/bin/g++-7 && \
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8   60 --slave /usr/bin/g++ g++ /usr/bin/g++-8;
sudo update-alternatives --config gcc

comment:9 by Regina Obe <lr@…>, 6 years ago

In 195dba5/git:

Take out the C++11 enforcement causing issue with finite - see #914. Also take out dev from pathc, its already in there

comment:10 by robe, 6 years ago

I tried vicky's patch

https://git.osgeo.org/gitea/cvvergara/geos/commit/d2bc840dc20067cdf7cc2a7ef4c6cfb036b79548

and that works too (and with keeping c+11 enforced).

I'd rather not enforce until 3.8 which is when we had originally planned to enforce c+11.

Though we may have code that requires it already I guess since I haven't tested on gcc 4.7.

K'm going to close this out for now since issue is solved by 195dba5/git

comment:11 by robe, 6 years ago

Resolution: fixed
Status: newclosed

comment:12 by robe, 6 years ago

Resolution: fixed
Status: closedreopened

unfortunately taking out the require c11 breaks travis and winnie, so I'll change to go with vicky's solution as it seems we really do require c11 now.

comment:13 by robe, 6 years ago

Milestone: 3.7.03.8.0

comment:14 by Regina Obe <lr@…>, 6 years ago

Resolution: fixed
Status: reopenedclosed

In 9ed254c/git:

Apply Vicky's remove unnecessary cmake stuff no longer needed for c+11
Closes #914 for GEOS 3.8

Note: See TracTickets for help on using tickets.