OSGeo / libgeotiff

Official repository of the libgeotiff project
180 stars 69 forks source link

Windows compilation gives error #59

Closed Dave6954 closed 2 years ago

Dave6954 commented 2 years ago

Im getting a few errors and not sure if the build notes a clear enough.

Severity Code Description Project File Line Suppression State Error CMake Error at C:\Users\DAVID\Source\Repos\libgeotiff\libgeotiff\CMakeLists.txt:133 (MESSAGE): Failed to detect PROJ >= 6 GeoTIFF C:\Users\DAVID\Source\Repos\libgeotiff\libgeotiff\CMakeLists.txt 133

This occurs after installing PROJ.

Also after running

_C:\Users\DAVID\source\repos\libgeotiff\libgeotiff\build>cmake -G "Visual Studio 16 2019" .. -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="/WX" -DCMAKE_CXX_FLAGS="/WX" -DCMAKE_INSTALL_PREFIX="C:/Users/DAVID/source/repos/libgeotiff/libgeotiff/build/install" -DPROJ_INCLUDE_DIR="C:/Users/DAVID/source/repos/libgeotiff/libgeotiff/build/install/include" -DPROJ_LIBRARY="C:/Users/DAVID/source/repos/libgeotiff/libgeotiff/build/install/lib/proj.lib" -DCMAKE_TOOLCHAINFILE=C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake

I get the error:

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042. CMake Deprecation Warning at CMakeLists.txt:15 (CMAKE_MINIMUM_REQUIRED): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at CMakeLists.txt:58 (cmake_policy): The OLD behavior for policy CMP0022 will be removed from a future version of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.

CMake Deprecation Warning at CMakeLists.txt:59 (cmake_policy): The OLD behavior for policy CMP0042 will be removed from a future version of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.

-- Found PROJ: C:/Users/DAVID/source/repos/libgeotiff/libgeotiff/build/install/lib/proj.lib CMake Error at C:/Program Files/CMake/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR) Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) C:/Program Files/CMake/share/cmake-3.21/Modules/FindTIFF.cmake:124 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake:786 (_find_package) CMakeLists.txt:171 (FIND_PACKAGE)

CMake Warning (dev) in C:/Program Files/CMake/share/cmake-3.21/Modules/FindTIFF.cmake: Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH and POP. Run "cmake --help-policy CMP0011" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

The included script

C:/Program Files/CMake/share/cmake-3.21/Modules/FindTIFF.cmake

affects policy settings. CMake is implying the NO_POLICY_SCOPE option for compatibility, so the effects are applied to the including context. Call Stack (most recent call first): C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake:786 (_find_package) CMakeLists.txt:171 (FIND_PACKAGE) This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred! See also "C:/Users/DAVID/source/repos/libgeotiff/libgeotiff/build/CMakeFiles/CMakeOutput.log". See also "C:/Users/DAVID/source/repos/libgeotiff/libgeotiff/build/CMakeFiles/CMakeError.log".

mloskot commented 2 years ago

What you are seeing is build configuration failure, compilation not even started yet. And, the error should be clear enough:

Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)

if confronted with the https://github.com/OSGeo/libgeotiff#dependencies

Dave6954 commented 2 years ago

@mloskot thanks for the reply, but i've installed PROJ and LibTIFF so im not sure where im going wrong

mloskot commented 2 years ago

No idea what you mean by "I've installed libtiff", but the error message gives you suggestion what to do: tell CMake where you've installed it. You already do it with PROJ, so do the same with libtiff specifying TIFF_LIBRARY and TIFF_INCLUDE_DIR.

mloskot commented 2 years ago

You seem to be using vcpkg as you specify -DCMAKE_TOOLCHAIN_FILE=C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake, then simply install libtiff using vcpkg as it is done during CI build on Windows which is configured in .appveyor.yml file:

https://github.com/OSGeo/libgeotiff/blob/50b34af89b9a774a479037a34d1c187fc0321eef/.appveyor.yml#L29

Alternatively, if you manually deployed libtiff somewhere on your filesystem, tell CMake where it is:

cmake -DTIFF_LIBRARY=/path/to/libtiff.lib -DTIFF_INCLUDE_DIR=/path/to/folder/with/libtiff/headers
Dave6954 commented 2 years ago

@mloskot thanks for this. I will try and work through your suggestions. I am new to VS and understanding more about the repo contents. Can the appveyor file get run as a script to run the whole build? How is that acheived?

mloskot commented 2 years ago

Can the appveyor file get run as a script to run the whole build? How is that acheived?

The .appveyor.yml is a configuration file for the CI service at https://www.appveyor.com but they also offer https://www.appveyor.com/docs/server/running-builds-as-local-process/ which I have never tried myself.

In various projects, I usually refer users to read through .appveyor.yml and learn what commands a project runs on Windows to build and test a project, then reproduce the same commands locally to build.

Dave6954 commented 2 years ago

@mloskot im following the steps in your appveyor file, but when i go to build PROJ (line 53) i get the following errors

CMake Error at CMakeLists.txt:127 (message): sqlite3 dependency not found!

CMake Error at CMakeLists.txt:133 (message): sqlite3 >= 3.11 required!

I followed the steps to install sqlite3.

mloskot commented 2 years ago

The latest build jobs of master on AppVeyor using Visual Studio are green. So, I'd conclude the steps in the .appveyor.yml are sound.

Sorry, but it is hard to tell why it is not working for you. You may inspect CMakeError.log and CMakeOutput.log, perhaps CMake picks up SQLite from unexpected source (GnuWin32, one in PATH, etc.).

rouault commented 2 years ago

Closing as a very likely usage issue rather than an issue in libgeotiff