Board index FlightGear Development Scenery

Terragear compilation problem - ubuntu 14.04

Questions and discussion about enhancing and populating the FlightGear world.

Terragear compilation problem - ubuntu 14.04

Postby slawekmikula » Sun Feb 26, 2017 5:57 pm

Good evening everyone. My first post in the forum, thus greetings to everybody and thanks for a great work with this project.

- I have problem with compiling Terragear from git source. I am using git sources. I've successfully compiled simgear, flightgear but with terragear i've some strange compilation error.
- I was looking at wiki page: http://wiki.flightgear.org/TerraGear, manual compilation from cmake also failed.

Cmake output:
Code: Select all
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- 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
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   system
--   thread
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE 
-- SimGear include directory: /mnt/media/loty/flightgear/source/fgbin/include
-- found SimGear version: 2017.2.0 (needed 3.1.0 or higher)
-- looking for static SimGear libraries
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- found SimGear libraries
-- Performing Test SIMGEAR_COMPILE_TEST
-- Performing Test SIMGEAR_COMPILE_TEST - Failed
CMake Error at CMakeModules/FindSimGear.cmake:222 (message):
  Oops, you have installed SimGear includes, however test compiling failed.
  Try removing 'CMakeCache.txt' and reconfigure with 'cmake'.
Call Stack (most recent call first):
  CMakeLists.txt:95 (find_package)


-- Configuring incomplete, errors occurred!
See also "/mnt/media/loty/flightgear/source/tgbuild/CMakeFiles/CMakeOutput.log".
See also "/mnt/media/loty/flightgear/source/tgbuild/CMakeFiles/CMakeError.log".


Simgear test log (from CMakeError.log):

Code: Select all

Performing C++ SOURCE FILE Test SIMGEAR_COMPILE_TEST failed with the following output:
Change Dir: /mnt/media/loty/flightgear/source/tgbuild/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec1235260834/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec1235260834.dir/build.make CMakeFiles/cmTryCompileExec1235260834.dir/build
make[1]: Wejscie do katalogu `/mnt/media/loty/flightgear/source/tgbuild/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /mnt/media/loty/flightgear/source/tgbuild/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec1235260834.dir/src.cxx.o
/usr/bin/c++   -DNO_OPENSCENEGRAPH_INTERFACE -DSIMGEAR_COMPILE_TEST -I/mnt/media/loty/flightgear/source/fgbin/include    -o CMakeFiles/cmTryCompileExec1235260834.dir/src.cxx.o -c /mnt/media/loty/flightgear/source/tgbuild/CMakeFiles/CMakeTmp/src.cxx
In file included from /usr/include/c++/4.8/cstdint:35:0,
                 from /mnt/media/loty/flightgear/source/fgbin/include/simgear/math/simd.hxx:25,
                 from /mnt/media/loty/flightgear/source/fgbin/include/simgear/math/SGVec2.hxx:26,
                 from /mnt/media/loty/flightgear/source/fgbin/include/simgear/math/SGMath.hxx:31,
                 from /mnt/media/loty/flightgear/source/tgbuild/CMakeFiles/CMakeTmp/src.cxx:3:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from /mnt/media/loty/flightgear/source/fgbin/include/simgear/math/SGVec2.hxx:26:0,
                 from /mnt/media/loty/flightgear/source/fgbin/include/simgear/math/SGMath.hxx:31,
                 from /mnt/media/loty/flightgear/source/tgbuild/CMakeFiles/CMakeTmp/src.cxx:3:
/mnt/media/loty/flightgear/source/fgbin/include/simgear/math/simd.hxx: In constructor ‘simd4_t<T, N>::simd4_t(T, T)’:
/mnt/media/loty/flightgear/source/fgbin/include/simgear/math/simd.hxx:144:40: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
     simd4_t(T x, T y) : simd4_t(x,y,0,0) {}
                                        ^
/mnt/media/loty/flightgear/source/fgbin/include/simgear/math/simd.hxx: In constructor ‘simd4_t<T, N>::simd4_t(T, T, T)’:
/mnt/media/loty/flightgear/source/fgbin/include/simgear/math/simd.hxx:145:45: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
     simd4_t(T x, T y, T z) : simd4_t(x,y,z,0) {}
                                             ^
make[1]: *** [CMakeFiles/cmTryCompileExec1235260834.dir/src.cxx.o] Blad 1
make[1]: Opuszczenie katalogu `/mnt/media/loty/flightgear/source/tgbuild/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec1235260834/fast] Blad 2

Return value: 1
Source file was:
#include <cstdio>
    #include "simgear/version.h"
    #include "simgear/math/SGMath.hxx"

    #define xstr(s) str(s)
    #define str(s) #s

    #define MIN_MAJOR 3
    #define MIN_MINOR 1
    #define MIN_MICRO 0

    int main() {
        int major, minor, micro;

        /* printf(%d.%d.%d or greater, , MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
        printf("found %s ... ", xstr(SIMGEAR_VERSION));

        sscanf( xstr(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, &micro );

        if ( (major < MIN_MAJOR) ||
             (major == MIN_MAJOR && minor < MIN_MINOR) ||
             (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
         return -1;
        }

        return 0;
    }


It seems that it cannot link the pthread library. What can be wrong ? Thanks for help.
slawekmikula
 
Posts: 128
Joined: Sun Feb 19, 2017 10:31 am

Re: Terragear compilation problem - ubuntu 14.04

Postby elgaton » Sun Feb 26, 2017 10:13 pm

Hi and welcome!

The cause of the failed compilation is this error message:
slawekmikula wrote in Sun Feb 26, 2017 5:57 pm:
Code: Select all
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^



Since a few months ago, FlightGear has begun to require C++11 support; that feature requires an additional compile switch which, apparently, was not added to TerraGear.

I guess you are compiling the "scenery/ws2.0" branch; in that case:
  1. copy and paste the following code to ~/terragear_c++11.patch:
    Code: Select all
    diff --git a/CMakeLists.txt b/CMakeLists.txt
    index 7d7e410..3e64939 100644
    --- a/CMakeLists.txt
    +++ b/CMakeLists.txt
    @@ -6,6 +6,11 @@ include (CheckCXXSourceCompiles)
     include (CheckIncludeFile)
     include (CPack)
     
    +# let's use & require C++11 - note these are only functional with CMake 3.1
    +# we do manual fallbacks for CMake 3.0 in the compilers section
    +set(CMAKE_CXX_STANDARD 11)
    +set(CMAKE_CXX_STANDARD_REQUIRED YES)
    +
     project(TerraGear)
     
     # read 'version' file into a variable (stripping any newlines or spaces)
    @@ -27,7 +32,6 @@ if(NOT CMAKE_BUILD_TYPE)
           FORCE)
     endif(NOT CMAKE_BUILD_TYPE)
     
    -
     if (MSVC)
       GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_SOURCE_DIR} PATH)
       if (CMAKE_CL_64)
    @@ -126,6 +130,10 @@ set(PKGDATADIR ${CMAKE_INSTALL_PREFIX}/share/TerraGear)
     
     if(CMAKE_COMPILER_IS_GNUCXX)
         set(WARNING_FLAGS -Wall)
    +
    +    if (CMAKE_VERSION VERSION_LESS 3.1)
    +       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    +    endif()
     endif(CMAKE_COMPILER_IS_GNUCXX)
     
     if(WIN32)
  2. open a terminal, cd into the TerraGear source directory and issue the following command: patch -p1 < ~/terragear_c++11.patch;
  3. try compiling TerraGear again.

Please tell me if this solution works: should that be the case, I'll submit it to the TerraGear repository.
NIATCA 2nd admin, regular ATC at LIPX and creator of the LIPX custom scenery
elgaton
 
Posts: 1106
Joined: Tue Mar 19, 2013 5:58 pm
Callsign: I-ELGA/LIPX_TW
Version: Git
OS: Windows + Arch Linux

Re: Terragear compilation problem - ubuntu 14.04

Postby slawekmikula » Mon Feb 27, 2017 1:19 pm

Thanks for Your reply. I was trying since then to compile it. Only this patch is not enough. The same error still exists. After Your tip I was looking in the cmake scripts (i have no experience in cmake, sorry) and finally build it successfully.

Quick & Dirty hack for successful cmake configuration. Unfortunately it is not a final solution, but I can't propose better.
Code: Select all
diff --git a/CMakeModules/FindSimGear.cmake b/CMakeModules/FindSimGear.cmake
index 41f0e8a..1d210b8 100644
--- a/CMakeModules/FindSimGear.cmake
+++ b/CMakeModules/FindSimGear.cmake
@@ -187,6 +187,11 @@
 
 # disable OSG dependencies for test-compiling
 set(CMAKE_REQUIRED_DEFINITIONS "-DNO_OPENSCENEGRAPH_INTERFACE")
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED YES)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+
 check_cxx_source_runs(
     "#include <cstdio>
     #include \"simgear/version.h\"


After this cmake can create make scripts. There is needed another patch for sgstream.hxx location (simgear has changed):

Code: Select all
diff --git a/src/Airports/GenAirports850/main.cxx b/src/Airports/GenAirports850/main.cxx
index 6a162e4..3375f21 100644
--- a/src/Airports/GenAirports850/main.cxx
+++ b/src/Airports/GenAirports850/main.cxx
@@ -20,7 +20,7 @@

 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/sg_path.hxx>
-#include <simgear/misc/sgstream.hxx>
+#include <simgear/io/iostreams/sgstream.hxx>
 #include <simgear/misc/strutils.hxx>

 #include <Include/version.h>
diff --git a/src/Airports/GenAirports850/parser.cxx b/src/Airports/GenAirports850/parser.cxx
index 0b9d35a..5bdb59c 100644
--- a/src/Airports/GenAirports850/parser.cxx
+++ b/src/Airports/GenAirports850/parser.cxx
@@ -1,7 +1,7 @@
 #include <ctime>

 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/sgstream.hxx>
+#include <simgear/io/iostreams/sgstream.hxx>
 #include <simgear/timing/timestamp.hxx>

 #include "parser.hxx"
diff --git a/src/Airports/GenAirports850/scheduler.cxx b/src/Airports/GenAirports850/scheduler.cxx
index 2c1e69e..58b185f 100644
--- a/src/Airports/GenAirports850/scheduler.cxx
+++ b/src/Airports/GenAirports850/scheduler.cxx
@@ -6,7 +6,7 @@
 #include <cstring>

 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/sgstream.hxx>
+#include <simgear/io/iostreams/sgstream.hxx>

 #include "airport.hxx"
 #include "parser.hxx"
diff --git a/src/BuildTiles/Main/priorities.cxx b/src/BuildTiles/Main/priorities.cxx
index 64ff4b5..3474395 100644
--- a/src/BuildTiles/Main/priorities.cxx
+++ b/src/BuildTiles/Main/priorities.cxx
@@ -20,7 +20,7 @@

 #include <simgear/compiler.h>
 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/sgstream.hxx>
+#include <simgear/io/iostreams/sgstream.hxx>

 #include <fstream>
 #include <vector>
diff --git a/src/BuildTiles/Main/usgs.cxx b/src/BuildTiles/Main/usgs.cxx
index 4ff4dea..d193855 100644
--- a/src/BuildTiles/Main/usgs.cxx
+++ b/src/BuildTiles/Main/usgs.cxx
@@ -20,7 +20,7 @@

 #include <simgear/compiler.h>
 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/sgstream.hxx>
+#include <simgear/io/iostreams/sgstream.hxx>

 #include <fstream>
 #include <string>
diff --git a/src/Lib/Array/array.cxx b/src/Lib/Array/array.cxx
index 47f28b5..ee8e31b 100644
--- a/src/Lib/Array/array.cxx
+++ b/src/Lib/Array/array.cxx
@@ -26,7 +26,7 @@
 #include <cstring>

 #include <simgear/compiler.h>
-#include <simgear/misc/sgstream.hxx>
+#include <simgear/io/iostreams/sgstream.hxx>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/strutils.hxx>
 #include <simgear/misc/sg_path.hxx>
diff --git a/src/Lib/Array/array.hxx b/src/Lib/Array/array.hxx
index e2f404c..654d8ad 100644
--- a/src/Lib/Array/array.hxx
+++ b/src/Lib/Array/array.hxx
@@ -26,7 +26,7 @@
 #include <simgear/compiler.h>
 #include <simgear/bucket/newbucket.hxx>
 #include <simgear/math/sg_types.hxx>
-#include <simgear/misc/sgstream.hxx>
+#include <simgear/io/iostreams/sgstream.hxx>

 class TGArray {

diff --git a/src/Lib/DEM/dem.hxx b/src/Lib/DEM/dem.hxx
index a692312..c0ee257 100644
--- a/src/Lib/DEM/dem.hxx
+++ b/src/Lib/DEM/dem.hxx
@@ -34,7 +34,7 @@

 #include <simgear/compiler.h>
 #include <simgear/bucket/newbucket.hxx>
-#include <simgear/misc/sgstream.hxx>
+#include <simgear/io/iostreams/sgstream.hxx>

 #define DEM_SIZE 1200
 #define DEM_SIZE_1 1201
diff --git a/src/Utils/poly2ogr/poly2ogr.cxx b/src/Utils/poly2ogr/poly2ogr.cxx
index a5f99b0..089a08b 100644
--- a/src/Utils/poly2ogr/poly2ogr.cxx
+++ b/src/Utils/poly2ogr/poly2ogr.cxx
@@ -41,7 +41,7 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/io/sg_binobj.hxx>
 #include <simgear/math/sg_geodesy.hxx>
-#include <simgear/misc/sgstream.hxx>
+#include <simgear/io/iostreams/sgstream.hxx>
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/misc/sg_dir.hxx>



On ubuntu 14.04 i had to install libgdal2 from

Code: Select all
ppa: sudo add-apt-repository ppa:ubuntugis/ppa


and fight some time with dependecies. I suppose in ubuntu 16.04+ libgdal2 packages wil be there.

After that I can compile terragear.

Thanks a lot for a tip !
slawekmikula
 
Posts: 128
Joined: Sun Feb 19, 2017 10:31 am

Re: Terragear compilation problem - ubuntu 14.04

Postby rleibner » Fri May 19, 2017 8:33 pm

Hi guys,
I have the same problem that you to compile Terragear. ( I have Ubuntu 16.04)
After reading your suggestions I've run the 3 patches and tryied again: The list of errors is so much short but the report ends like this:
Code: Select all
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rodolfo/terragear
make: *** No se especificó ningún objetivo y no se encontró ningún makefile.  Alto.
make: *** No hay ninguna regla para construir el objetivo 'install'.  Alto.

download_and_compile.sh has finished to work

In plain english:
Code: Select all
make: *** No targets specified and no makefile found.  Stop.
make: *** There is no rule to build the target 'install'.  Stop.


What I am missing?
User avatar
rleibner
 
Posts: 269
Joined: Fri May 19, 2017 8:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: next
OS: Ubuntu 18.04.4

Re: Terragear compilation problem - ubuntu 14.04

Postby slawekmikula » Sat May 20, 2017 8:00 am

hm, from first sight dunno. If configuration went all OK (without any dependency errors) there should be no problem to compile it. Below is my code for building automation. It fetches new version from git, configure it and compile. Maybe this helps. Terragear is source directory, tgbuild is directory for building.

Code: Select all
#!/bin/bash

cd terragear
git pull
cd ..

rm -rf ./tgbuild
mkdir tgbuild
cd tgbuild


cmake ../terragear -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH="../fgbin"
make -j2 install
slawekmikula
 
Posts: 128
Joined: Sun Feb 19, 2017 10:31 am

Re: Terragear compilation problem - ubuntu 14.04

Postby rleibner » Mon May 22, 2017 8:35 pm

slawekmikula wrote in Sat May 20, 2017 8:00 am:... Below is my code for building automation. It fetches new version from git, configure it and compile. Maybe this helps. Terragear is source directory, tgbuild is directory for building.
...

Hi slawekmikula,
I've tryed your bash and got the fwg output:
Code: Select all
Already up-to-date.
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   thread
--   chrono
--   date_time
--   atomic
-- SimGear include directory: /usr/local/include
-- found SimGear version: 2017.2.0 (needed 3.1.0 or higher)
-- looking for static SimGear libraries
-- found SimGear libraries
-- Performing Test SIMGEAR_COMPILE_TEST
-- Performing Test SIMGEAR_COMPILE_TEST - Success
-- Found CGAL 4.7
-- Build type: Release
-- USING CXXFLAGS = '-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -frounding-math -std=c++11 -O3 -DNDEBUG'
-- USING EXEFLAGS = ' -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed '
-- Targetting Unix Makefiles
-- Using /usr/bin/c++ compiler.
-- Requested component: Core
-- Requested component: MPFR
-- Requested component: GMP
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rodolfo/terragear
make: *** No hay ninguna regla para construir el objetivo 'install'.  Alto.

Again: *** There is no rule to build the target 'install'. Stop. :cry:
Rodolfo
*************************
Non-shared knowledge is lost knowledge
User avatar
rleibner
 
Posts: 269
Joined: Fri May 19, 2017 8:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: next
OS: Ubuntu 18.04.4

Re: Terragear compilation problem - ubuntu 14.04

Postby slawekmikula » Tue May 23, 2017 10:36 am

Sorry, no idea. With my script I have one directory (terragear) for git source and next directory (tgbuild) for compilation results. In this directory I have following structure (after cmake preparation):
Code: Select all
/tgbuild$ ls -l
razem 68
-rw-rw-r-- 1 zorba zorba 23736 maj 21 20:36 CMakeCache.txt
drwxrwxr-x 5 zorba zorba  4096 maj 23 11:32 CMakeFiles
-rw-rw-r-- 1 zorba zorba  1576 maj 21 20:36 cmake_install.cmake
-rw-rw-r-- 1 zorba zorba   825 maj 21 20:36 cmake_uninstall.cmake
-rw-r--r-- 1 zorba zorba  3179 maj 21 20:36 CPackConfig.cmake
-rw-r--r-- 1 zorba zorba  3609 maj 21 20:36 CPackSourceConfig.cmake
-rw-rw-r-- 1 zorba zorba   964 maj 21 20:39 install_manifest.txt
-rw-rw-r-- 1 zorba zorba 15549 maj 21 20:36 Makefile
drwxrwxr-x 9 zorba zorba  4096 maj 21 20:36 src


Versions:
cmake version 3.2.2
GNU Make 3.81

Makefile is 15kB and have install target. Don't know why Your code is not generated correctly.
slawekmikula
 
Posts: 128
Joined: Sun Feb 19, 2017 10:31 am


Return to Scenery

Who is online

Users browsing this forum: No registered users and 8 guests