Menu

GeographicLib in Qt

Anonymous
2019-12-13
2019-12-16
  • Anonymous

    Anonymous - 2019-12-13

    Good day,

    I am trying to use Geographic lib in a Qt project (Qt 5.13.0 MinGw 64-bit) but building the library with CMake is not working for me(I spent the last two days trying to figure it out) and I was wondering if Qt is stil supored and if there is another way to use the library in Qt(without having to build it using CMake). Maybe if someone can post commands that worked for them in Qt 5.13.0 that would be great.

    Thanks for your time

     
  • Charles Karney

    Charles Karney - 2019-12-13

    It's not clear to what extent your question is about the coupling for
    GeographicLib and Qt or is a problem with one or both of these packages
    separately. So here are two questions:

    • Can you build an application which uses Qt but not GeographicLib? If
      the answer is no, then you need to take the question to a forum which
      addresses Qt questions.

    • Can you build an application which uses GeographicLib but not Qt? If
      the answer is no, then I should be able to help you.

    If the answer to these questions is yes, and you still can't build an
    application which uses both, then you'll need to describe in detail
    how you set up the two libraries and how you're trying to link to them.

     
    • Anonymous

      Anonymous - 2019-12-13

      Sorry for not being clear.

      I am trying to build GeographicLib as described by this site so that I can use the library in Qt Creator (With the Desktop Qt 5.13.0 MinGw 64-bit kit). I cant build the GeographicLib library as described here using CMake.

      The way I understand it is that I should :
      1. Build the library as described here
      2. Add the library to my Qt Widgets Aplication.

      I am strugeling with step one(to build the library using CMake).

      These are the commands I enter in cyqwin

      cd C:/path/to/my/GeographicLib-1.50
      export PATH="`cygpath -m C:\Qt\Tools\mingw730_64\bin`:$PATH"
      rm -rf BUILD; mkdir BUILD; cd BUILD
      cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
      mingw32-make
      mingw32-make install
      

      The on;ey thing I changed from here is in stead of saying :

        mkdir BUILD
        cd BUILD
      

      I say

      rm -rf BUILD; mkdir BUILD; cd BUILD
      

      so that I dont have to "maunualy" delete the BUILD directory if there was a problem with CMake. The output I get is the following :

      user@computer $ /path/to/my/GeographicLib-1.50
      $ cd C://path/to/my/GeographicLib-1.50
      rm -rf BUILD; mkdir BUILD; cd BUILD
      cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
      mingw32-make
      
      user@computer $ /path/to/my/GeographicLib-1.50
      $ export PATH="`cygpath -m C:\Qt\Tools\mingw730_64\bin`:$PATH"
      
      user@computer $ /path/to/my/GeographicLib-1.50
      $ rm -rf BUILD; mkdir BUILD; cd BUILD
      
      user@computer $ /path/to/my/GeographicLib-1.50/BUILD
      $ cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
      -- The C compiler identification is unknown
      -- The CXX compiler identification is unknown
      -- Check for working C compiler: C:/MinGW/bin/gcc.exe
      -- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
      CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
        The C compiler
      
          "C:/MinGW/bin/gcc.exe"
      
        is not able to compile a simple test program.
      
        It fails with the following output:
      
          Change Dir: C:/path/to/my/GeographicLib-1.50/CMakeFiles/CMakeTmp
      
          Run Build Command(s):C:/Qt/Tools/mingw730_64/bin/mingw32-make.exe cmTC_35e47/fast && C:/Qt/Tools/mingw730_64/bin/mingw32-make.exe -f CMakeFiles\cmTC_35e47.dir\build.make CMakeFiles/cmTC_35e47.dir/build
          mingw32-make.exe[1]: Entering directory 'C:/path/to/my/GeographicLib-1.50/CMakeFiles/CMakeTmp'
          Building C object CMakeFiles/cmTC_35e47.dir/testCCompiler.c.obj
          C:\MinGW\bin\gcc.exe    -o CMakeFiles\cmTC_35e47.dir\testCCompiler.c.obj   -c C:/path/to/my/GeographicLib-1.50\CMakeFiles\CMakeTmp\testCCompiler.c
          mingw32-make.exe[1]: *** [CMakeFiles\cmTC_35e47.dir\build.make:65: CMakeFiles/cmTC_35e47.dir/testCCompiler.c.obj] Error 1
          mingw32-make.exe[1]: Leaving directory 'C:/path/to/my/eographicLib-1.50/CMakeFiles/CMakeTmp'
          mingw32-make.exe: *** [Makefile:120: cmTC_35e47/fast] Error 2
      
      
        CMake will not be able to correctly generate this project.
      Call Stack (most recent call first):
        CMakeLists.txt:1 (project)
      
      
      -- Configuring incomplete, errors occurred!
      See also "C:/path/to/my/GeographicLib-1.50/CMakeFiles/CMakeOutput.log".
      See also "C:/path/to/my/GeographicLib-1.50/CMakeFiles/CMakeError.log".
      
      user@computer  /cygdrive/c/path/to/my/GeographicLib-1.50/BUILD
      $ mingw32-make
      mingw32-make: *** No targets specified and no makefile found.  Stop.
      
      user@computer  /cygdrive/c/path/to/my/GeographicLib-1.50/BUILD
      $ mingw32-make install
      mingw32-make: *** No rule to make target 'install'.  Stop.
      

      To answer your questions I can build an application witch uses Qt and not geographic lib but I cant build the geographic lib library. So my question is how do you build the GeograhicLib library so that it can be used in Qt Creator.

      Thanks for your time
      Regards

       
  • Charles Karney

    Charles Karney - 2019-12-13

    Just taking a stab at your problem here... Try changing

    export PATH="`cygpath -m C:\Qt\Tools\mingw730_64\bin`:$PATH"
    

    to

    export PATH="`cygpath -m C:/Qt/Tools/mingw730_64/bin`:$PATH"
    

    This is what the documentation tells you to do!

     
  • Anonymous

    Anonymous - 2019-12-13

    I changed it like you said but I am still getting the same errors

     
  • Charles Karney

    Charles Karney - 2019-12-13

    Whoops, leave out the "-m" in cygpath! I'll fix the documentation.

     
  • Anonymous

    Anonymous - 2019-12-13

    I changed left out the "-m" in cygpath and changed the export path as you sugested but I am still getting errors. Do you think I maybe installed CMake or Cygwin incorrectley or might there be someting else wrong?

    Here are the errors:

    $ cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
    -- The C compiler identification is unknown
    -- The CXX compiler identification is unknown
    -- Check for working C compiler: C:/MinGW/bin/gcc.exe
    -- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
    CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
      The C compiler
    
        "C:/MinGW/bin/gcc.exe"
    
      is not able to compile a simple test program.
    
      It fails with the following output:
    
        Change Dir: C:/path/to/my/GeographicLib-1.50/CMakeFiles/CMakeTmp
    
        Run Build Command(s):C:/Qt/Tools/mingw730_64/bin/mingw32-make.exe cmTC_58e31/fast && C:/Qt/Tools/mingw730_64/bin/mingw32-make.exe -f CMakeFiles\cmTC_58e31.dir\build.make CMakeFiles/cmTC_58e31.dir/build
        mingw32-make.exe[1]: Entering directory 'C:/path/to/my/GeographicLib-1.50/CMakeFiles/CMakeTmp'
        Building C object CMakeFiles/cmTC_58e31.dir/testCCompiler.c.obj
        C:\MinGW\bin\gcc.exe    -o CMakeFiles\cmTC_58e31.dir\testCCompiler.c.obj   -c C:/path/to/my/GeographicLib-1.50/\CMakeFiles\CMakeTmp\testCCompiler.c
        mingw32-make.exe[1]: *** [CMakeFiles\cmTC_58e31.dir\build.make:65: CMakeFiles/cmTC_58e31.dir/testCCompiler.c.obj] Error 1
        mingw32-make.exe[1]: Leaving directory 'C:/path/to/my/GeographicLib-1.50//CMakeFiles/CMakeTmp'
        mingw32-make.exe: *** [Makefile:120: cmTC_58e31/fast] Error 2
    
    
    
    
    
      CMake will not be able to correctly generate this project.
    Call Stack (most recent call first):
      CMakeLists.txt:1 (project)
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:C:/path/to/my/GeographicLib-1.50/CMakeFiles/CMakeOutput.log".
    See also "C:/path/to/my/GeographicLib-1.50/CMakeFiles/CMakeError.log".
    
    user@computer  /cygdrive/c/path/to/my/GeographicLib-1.50/BUILD
    $ mingw32-make
    mingw32-make: *** No targets specified and no makefile found.  Stop.
    
    user@computer  /cygdrive/c/path/to/my/GeographicLib-1.50/BUILD
    $ mingw32-make install
    

    Sorry for asking all these questions I am new to CMake and Cygwin. And thanks for all your help

     
  • Charles Karney

    Charles Karney - 2019-12-13

    You may have messing up your PATH environment thoroughly. You need the
    command

    type gcc
    type g++
    

    to return the paths to the Qt versions of the compilers. If this isn't
    the case, start a new shell and try again. I don't have a MinGW version
    of Qt installed on my system. However I assume

    C:/Qt/Tools/mingw730_64/bin
    

    contains these compilers?

     
  • Anonymous

    Anonymous - 2019-12-13

    The commands return the following:

    $ type gcc
    gcc is /cygdrive/c/Qt/Tools/mingw730_64/bin/gcc
    
    $ type g++
    g++ is /cygdrive/c/Qt/Tools/mingw730_64/bin/g++
    

    so C:/Qt/Tools/mingw730_64/bin contains the compilers?

     
  • Charles Karney

    Charles Karney - 2019-12-13

    Please restart your shell, set your PATH, and verify with

    echo $PATH
    

    that it is sane. The presence of the double C: in

    See also "C:C:/path/to/my/GeographicLib-1.50/CMakeFiles/CMakeOutput.log".
    

    indicates that something is awry.

     
  • Anonymous

    Anonymous - 2019-12-13
    $ echo $PATH
    /cygdrive/c/Qt/Tools/mingw730_64/bin/mingw32-make.exe
    

    The path seems to be the same. I think the double C: might have been me when I pasted C:/path/to/my/GeographicLib-1.50 over the real path(just to make it easier to understand)

     
  • Anonymous

    Anonymous - 2019-12-13

    I deleted the GeographicLib file and extracted a new one in the same location witch changed the errors a bit:

    $ cd C:/Path/to/my/GeographicLib-1.50
    rm -rf BUILD; mkdir BUILD; cd BUILD
    cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
    mingw32-make
    mingw32-make install
    user@computer /cygdrive/c/Path/to/my/GeographicLib-1.50
    $ export PATH="`cygpath C:/Qt/Tools/mingw730_64/bin/mingw32-make.exe`:$PATH"
    
    user@computer /cygdrive/c/Path/to/my/GeographicLib-1.50
    $ rm -rf BUILD; mkdir BUILD; cd BUILD
    
    user@computer /cygdrive/c/Path/to/my/GeographicLib-1.50/BUILD
    $ cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
    CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeMinGWFindMake.cmake:12 (message):
      sh.exe was found in your PATH, here:
    
      C:/cygwin64/bin/sh.exe
    
      For MinGW make to work correctly sh.exe must NOT be in your path.
    
      Run cmake from a shell that does not have sh.exe in your PATH.
    
      If you want to use a UNIX shell, then use MSYS Makefiles.
    
    Call Stack (most recent call first):
      CMakeLists.txt:1 (project)
    
    
    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!
    
    user@computer /cygdrive/c/Path/to/my/GeographicLib-1.50/BUILD
    $ mingw32-make
    mingw32-make: *** No targets specified and no makefile found.  Stop.
    
    user@computer /cygdrive/c/Path/to/my/GeographicLib-1.50/BUILD
    $ mingw32-make install
    mingw32-make: *** No rule to make target 'install'.  Stop.
    
    user@computer /cygdrive/c/Path/to/my/GeographicLib-1.50/BUILD
    $ env PATH="$( echo $PATH | tr : '\n' |
    > while read d; do test -f "$d/sh.exe" || echo -n "$d:"; done |
    > sed 's/:$//' )" \
    > cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib" ..
    -- The C compiler identification is GNU 7.3.0
    -- The CXX compiler identification is GNU 7.3.0
    -- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe
    -- Check for working C compiler: C:/Qt/Tools/mingw730_64/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:/Qt/Tools/mingw730_64/bin/g++.exe
    -- Check for working CXX compiler: C:/Qt/Tools/mingw730_64/bin/g++.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Check size of long double
    -- Check size of long double - done
    -- Check size of double
    -- Check size of double - done
    -- Check if the system is big endian
    -- Searching 16 bit integer
    -- 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 unsigned short
    -- Check size of unsigned short - done
    -- Using unsigned short
    -- Check if the system is big endian - little endian
    -- Performing Test FLOAT_CONVERSION
    -- Performing Test FLOAT_CONVERSION - Success
    -- Performing Test CXX11_MATH
    -- Performing Test CXX11_MATH - Success
    -- Performing Test CXX11_STATIC_ASSERT
    -- Performing Test CXX11_STATIC_ASSERT - Success
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Path/to/my/GeographicLib-1.50/BUILD
    

    I am able to get an output now but the bin and lib files are emptey

     
  • Charles Karney

    Charles Karney - 2019-12-13

    You still need to do the steps:

    mingw32-make
    mingw32-make install
    
     
  • Anonymous

    Anonymous - 2019-12-16

    Sorry for replying so late. It worked Thanks for all your help I apreciate it!

     

Anonymous
Anonymous

Add attachments
Cancel