-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deps: new dep "proj" fails to compile #49749
Comments
I'm confused because there's a conditional just before #ifdef HAVE_PTHREAD_MUTEX_RECURSIVE and my system most definitely has PTHREAD_MUTEX_RECURSIVE Is the build perhaps forgetting to run the |
ok I found what's amiss on my system, and CMake mistakenly tries to identify its availability using the following C code: int main(int argc, char** argv)
{
(void)argv;
#ifndef PTHREAD_MUTEX_RECURSIVE
return ((int*)(&PTHREAD_MUTEX_RECURSIVE))[argc];
#else
(void)argc;
return 0;
#endif
} ie it assumes that something is either a macro or an lvalue, and it doesn't consider enum tags. This is a bug in the CMake implementation, or perhaps even the CMakefile itself. For comparison, here's how RocksDB does it:
which is much better |
I could send a PR to manually edit |
(Instructions as to where's the upstream bug tracker so I can file the upstream issue are welcome) |
For reference the following diff fixes it: diff --git a/CMakeLists.txt b/CMakeLists.txt
index cde21f0c..5c7e7b51 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,9 +60,15 @@ find_package (Threads)
include(CheckIncludeFiles)
include(CheckSymbolExists)
-CHECK_SYMBOL_EXISTS(PTHREAD_MUTEX_RECURSIVE pthread.h HAVE_PTHREAD_MUTEX_RECURSIVE_DEFN)
-if (HAVE_PTHREAD_MUTEX_RECURSIVE_DEFN)
- add_definitions(-DHAVE_PTHREAD_MUTEX_RECURSIVE=1)
+
+CHECK_C_SOURCE_COMPILES("
+#include <pthread.h>
+int main() {
+ (void) PTHREAD_MUTEX_RECURSIVE;
+}
+" HAVE_PTHREAD_MUTEX_RECURSIVE)
+if(HAVE_PTHREAD_MUTEX_RECURSIVE)
+ add_definitions(-DHAVE_PTHREAD_MUTEX_RECURSIVE=1)
endif()
boost_report_value(PROJ_PLATFORM_NAME) |
we're pinned to an older version of PROJ (tracker here: https://github.com/OSGeo/PROJ) at 4.9.3, so not sure if they'll care. you can file a bug there. we'll probably have to fork this to make this work for you. i'll set that up shortly. |
nb: the _NP variants are obsolete as far as I can see
The text was updated successfully, but these errors were encountered: