#217 fails to build on GNU/Hurd

open
nobody
5
2013-02-14
2013-02-14
Pino Toscano
No

clucene 2.3.3.4 fails to compile on GNU/Hurd with the following error:
| In file included from SRCDIR/src/shared/CLucene/config/repl_tcstod.cpp:9:0:
| SRCDIR/src/shared/CLucene/util/Misc.h:70:22: error: 'static std::string lucene::util::Misc::toString(pthread_t)' cannot be overloaded
| SRCDIR/src/shared/CLucene/util/Misc.h:68:22: error: with 'static std::string lucene::util::Misc::toString(int32_t)'
this happens because pthread_t (whose actual definition is implementation-defined) is a typedef to int, and thus the conflict with int32_t.

The simplier solution is #ifndef __GNU__ the _LUCENE_THREADID_TYPE variat of toString (both the definition and the implementation), while a better solution could be to run a compile time test, defining something like _CL_PTHREAD_T_IS_COMPLEX, adding it to clucene-config.h and using it in Misc.{cpp,h}.

Discussion