OSGeo / grass

GRASS GIS - free and open-source geospatial processing engine
https://grass.osgeo.org
Other
828 stars 301 forks source link

[Bug] Fix PDAL support for OSGeo4W #1821

Open ninsbl opened 3 years ago

ninsbl commented 3 years ago

Describe the bug OSGeo4W ships PDAL version 2.3. When PDAL support is activated for OSGeo4W with a path to pdal-config, pdal-config is found, but GRASS complains that the PDAL library is not suitable Unable to locate suitable (>=1.7.1) PDAL library.

To Reproduce See: https://github.com/ninsbl/grass/runs/3408602894?check_suite_focus=true

Expected behavior It is important to have PDAL support on MS Windows too, so GRASS should be compiled with PDAL support on MS Windows as well. Would be great to have that working for 8.0 but I set the 8.2 milestone. Feel free to change if feasible to get it into 8.0...

System description (please complete the following information): GRASS OSGeo4W CI GRASS GIS version 7.9 / 8.0 preview

Additional context Here is how the PDAL packages for OSGeo4W are built: https://github.com/jef-n/OSGeo4W/blob/master/src/pdal/osgeo4w/package.sh

marisn commented 3 years ago

It just means compilation and linking to PDAL library has failed: https://github.com/OSGeo/grass/blob/9f853f0d3a396879d01f4a39a9769efc09e5b6d7/configure.in#L1020

Actual error is visible in the configure.log file. Content of that file might help to shed some light into the issue. As usual – if Windows users need PDAL support in GRASS, one of Windows users must step up and fix the issue. I could look into the issue if a link to a VM image with suitable environment is provided.

ninsbl commented 3 years ago

Fair enough. Here: https://github.com/ninsbl/grass/runs/3412192862?check_suite_focus=true is at least the config.log

marisn commented 3 years ago

Could you, please, provide the output of following commands: pdal-config --libs pdal-config --cxxflags pdal-config --includes The error seems to be wrong compilation options coming out of pdal-config. Is PDAL compiled with MSVC?

g++ -o conftest.exe    -I/c/OSGeo4W/include /DWIN32 /D_WINDOWS /W3 /GR /EHsc -std=c++11 -I/c/OSGeo4W/include -I/c/OSGeo4W/include -I/c/OSGeo4W/include/libxml2 -I/c/OSGeo4W/include   -Wl,--export-dynamic,--enable-runtime-pseudo-reloc  -L/c/OSGeo4W/lib -L/c/OSGeo4W/bin conftest.C  -L/c/OSGeo4W/lib -lpdalcpp 1>&5
g++.exe: error: C:/msys64/DWIN32: No such file or directory
g++.exe: error: C:/msys64/D_WINDOWS: No such file or directory
g++.exe: error: C:/msys64/W3: No such file or directory
g++.exe: error: C:/msys64/GR: No such file or directory
g++.exe: error: C:/msys64/EHsc: No such file or directory
ninsbl commented 3 years ago

Thanks for bearing with me here, @marisn

The content for pdal-config in OSGeo4W is here: https://gist.github.com/ninsbl/668db3cb3f1367d8f94c8b77c81f96e7

It seems that the returned cxxflags (/DWIN32 /D_WINDOWS /W3 /GR /EHsc -std=c++11) are CMake flags and do not work with g++. So I changed them - manually for now - to -DWIN32 -D_WINDOWS -std=c++11 No idea what g++ equivalents for /W3 /GR /EHsc would be...

With that change first winsock2.h is not found, and after adding the location of winsock2.h to the includepath for c++ configuration proceeds a bit further, but then fails to find stdlib.hwhich definately is on the include path.

Latest configure log is here: https://github.com/ninsbl/grass/runs/3429745293?check_suite_focus=true

And yes, I guess PDAL is compiled with MSVC. Here is the OSGeo4W build script: https://github.com/jef-n/OSGeo4W/blob/master/src/pdal/osgeo4w/package.sh which loads the vs2019env here: https://github.com/jef-n/OSGeo4W/blob/master/scripts/build-helpers

ninsbl commented 2 years ago

This likely depends on: #348 See also: https://github.com/jef-n/OSGeo4W/pull/3

HuidaeCho commented 1 year ago

Yes, unfortunately, OSGeo4W PDAL seems to be compiled with MSVC and there is no way to link against it using GCC.

configure:9427: x86_64-w64-mingw32-g++ -o conftest.exe -g -O2   -I/c/OSGeo4W/include -O2 -fPIC -std=c++11 -I/c/OSGeo4W/include -I/c/OSGeo4W/include -I/c/OSGeo4W/include/libxml2   -Wl,--export-dynamic,--enable-runtime-pseudo-reloc  -L/c/OSGeo4W/lib conftest.cpp  -L/c/OSGeo4W/bin -lpdalcpp >&5
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: warning: --export-dynamic is not supported for PE+ targets, did you mean --export-all-symbols?
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccxle6JS.o: in function `pdal::SimplePointTable::SimplePointTable(pdal::PointLayout&)':

Alternatively, using mingw-w64-x86_64-pdal seems to be overkill because it requires additional 108 packages, but if you really need it, you may try it. image