Hi, <br><br>I've downloaded the latest GDAL source code by i'm unable to produce a library. It is due to a link error : "undefined reference to `CPLCreateOrAcquireMutex"<br><br>I'm using Mingw with gcc 4.5.2. Here is what I do :<br>
<br>Unzip, go to Gdal root directory, and run configure:<br>- This generate a file cpl_config.h (under "port" directory) with this option :<br>#define CPL_MULTIPROC_PTHREAD 1<br><br>It seems to be very strange because this flag prevents the function CPLCreateOrAcquireMutex to be declared in the cpl_multiproc.cpp file. Actually, here is the file structure :<br>
<br>/******* FIRST PART DEFINITION *************/<br>#ifndef CPL_MULTIPROC_PTHREAD<br> int CPLCreateOrAcquireMutex( void **phMutex, double dfWaitInSeconds ) { .... }<br>#endif<br><br>.....<br><br><br>/******* SECOND PART DEFINITION *************/<br>
#if defined(CPL_MULTIPROC_STUB)<br> .....<br>#elif defined(CPL_MULTIPROC_WIN32)<br> ....<br>#elif defined(CPL_MULTIPROC_PTHREAD)<br> int CPLCreateOrAcquireMutex( void **phMutex, double dfWaitInSeconds ) { ...... }<br>
#endif<br><br>And CPLCreateOrAcquireMutex is used in CPLMutexHolder (which is not under precompilation directive, so it is compiled whenever CPL_MULTIPROC_STUB, CPL_MULTIPROC_WIN32 or CPL_MULTIPROC_PTHREAD are defined or not).<br>
<br>So, defining CPLCreateOrAcquireMutex seems to be absolutly necessary but in this case it cannot work because both CPL_MULTIPROC_WIN32 and CPL_MULTIPROC_PTHREAD are defined..... :<br>- CPL_MULTIPROC_WIN32 is defined in cpl_multiproc.h file : <br>
#if defined(WIN32) && !defined(CPL_MULTIPROC_STUB)<br> # define CPL_MULTIPROC_WIN32<br> #endif<br>- CPL_MULTIPROC_PTHREAD is defined in cpl_config.h, generated file, as I've already explained before....<br>
<br>The result : <br> 1) In the FIRST PART DEFINITION, code int CPLCreateOrAcquireMutex( .... is not build due to preprocessing directives, <br> 2) In the SECOND PART DEFINITION, the code after "#elif defined(CPL_MULTIPROC_WIN32)" is compiled, and " int CPLCreateOrAcquireMutex(..." is not build too....<br>
3) To conclude, this code is not available for the calling function.<br><br>It is quite strange that nobody already reported this problem, because compiling GDAL with CPL_MULTIPROC_PTHREAD support and under WIN32 is something really usual !!!!<br>
<br>What is wrong, please, with my way of doing ?<br><br>Thanks a lot for your answer.<br><br>Alexandre.<br><br><br>