ensure shapelib is found on linux and macos#762
Conversation
|
@Chrismarsh did you test this on macos and linux? After the merge, my linux build is unable to find |
|
I was only able to build Does |
|
How were you specifying |
|
It's possible shapelib was not being properly linked before. My understanding is that shapelib is a dependency we get from GDAL. When using your changes, I get the following Cmake error: I had to install the shapelib through Even with the dev library, I was unable to find the shapelibConfig.cmake files on my system, which should be using our 22.04 dependency script, so I was unable to set the shapelib_DIR path. |
|
I should add that prior to this merge, our team has been able to build properly on Linux without any issues. |
|
Ahhh ok I see somewhat what is going on:
Whereas, I build a GDAL that sets Oddly, the Debian build rules /don't/ seem to set that flag, which is further confusing. Maybe it isn't GDAL. It is unclear where this symbol is trickling in for you.
Odd it doesn't ship with that. I build from source using cmake so I get that file in the install (as expected). Does finding via the non |
|
I tried Project CMakeLists.txt Ninja CMakeLists.txt While I was able to build and install on Linux, I did not run the installation and properly test if the libraries were working. I wanted to reach out and see what was causing the discrepancy first. |
|
Ok that's good pkgconfig can find it. I think you should have the detection try both pkgconfig and the cmake config so-as not to break the cmake build of shapelib. If you wrap it manually into a target if found find pkgconfig, the |
|
You're proposing a workflow where we check for cmake config, and if that fails, then check for the pkgconfig. We'd have to add an additional step, which would be to check for shapelib through GDAL. I'm surprised this hasn't come up in the previous versions. For example, in the tagged 3.12.2 release, I don't believe the CMakeLists.txt references the shapelib library anywhere. Do you know why that might be the case? Without the find package, I'm unsure how the CMake has been identifying your shapelib library. |
|
I've poked around this:
But nothing links to a
The master U links against the libshp.so directly. The rest seem to have been statically linked somehow.
I think the answer is that WindNinja used to vendor a shapelib version that was removed which still exists in 3.12 tag Do you still have those files in your local tree? |
|
Good catch! My local files match what is in the master branch, which has commit c826023. Therefore, I don't have the WindNinja shapelib to use for my build. Not sure what makes the most sense for our build. Perhaps we should adjust our build process to build GDAL and Shapelib separately and find them separately in CMake. Any thoughts on this Chris? |
|
So, how is master linking for you if you don't have those files providing those symbol implimentations? Can you check your
|
|
My libgdal.so does have the shaplib symbols. My libninja.so has the symbol undefined. That implies to me that WindNinja is using the symbol packaged with GDAL. I agree that it would be better to use cmake to find gdal and shapelib directly. We could also vendor shapelib with WindNinja, like we did in the past. However, I could see potential cons with that method, for example, our developers having to maintain those files if shapelib updates in the future. |
|
Wild. Well, that explains that mystery. Why ubuntu ships gdal configured like this makes no sense. It seems like an uncommon configuration to rely on. Vendoring seems like a pain and also reduces flexibility if I wonder if you can use try_compile to test if the found gdal resolves the symbol, and if not, then go look for ShapeFile? |
|
I think using something like Thanks for all the investigation and help with this! I appreciate having some more insight into our CMake build process. |
This ensure that shapelib is found on macos and linux. Without there are a bunch of link time errors: