strigi doesn't build anymore on FreeBSD

Jos van den Oever jvdoever at gmail.com
Fri Jan 1 22:36:16 CET 2010


2009/12/31 Raphael Kubo da Costa <kubito at gmail.com>:
> On Thursday 31 December 2009 10:32:39 Alexander Neundorf wrote:
>> Hi Jos, Raphael,
>>
>> since this patch:
>> http://websvn.kde.org/trunk/kdesupport/strigi/src/streamanalyzer/saxeventan
>> alyzer.cpp?r1=1067133&r2=1067134
>>
>> strigi does not build anymore on FreeBSD:
>> http://my.cdash.org/viewBuildError.php?buildid=43229
>>
>>
>> What can be done about this ?
>>
>> One thing which should be done, is to make this into a configure-check.
>> I think check_symbol_exists() (
>> http://www.cmake.org/cmake/help/cmake2.6docs.html#module:CheckSymbolExists
>> ) should work for that.
>>
>> Then it would not be a build error anymore, but a configure error, which is
>> at least slightly better.
>>
>> What needs to be done to make it build again ?
>>
>> Alex
>
> Libxml2 defines LIBXML_THREAD_ENABLED if _REENTRANT, __MT__ or _POSIX_C_SOURCE
> are defined. glibc always defined _POSIX_C_SOURCE, whereas FreeBSD's libc
> seems to define it conditionally (either it must be defined to some value by
> the user and then it's correctly set, or _XOPEN_SOURCE must be set -- see
> http://fxr.watson.org/fxr/source/sys/cdefs.h?v=FREEBSD8).
>
> I don't know the best solution here - we can either pass _REENTRANT or __MT__
> via CMake, but it looks a little awkward, or we can define _XOPEN_SOURCE in
> CMake or inside the code itself -- IIRC, kdelibs always defines _XOPEN_SOURCE
> to a certain minimum value, maybe strigi could do that too.
>

This problem occurred on Mac OS X as well and has been fixed by Till Adam:
  http://websvn.kde.org/?view=revision&revision=1068150

if(APPLE)
  ....
   # due to a bug in libxml2, we only get thread support if _REENTRANT
is defined
   add_definitions(-D_REENTRANT)
endif(APPLE)

It would be great if FindLibXml2.cmake had a boolean stating whether
thread support is available or in input variable that allow specifying
whether thread-safety is required.

We'd need the test in Strigi now anyway, since recently non-safe
versions have turned up causing random crashes. I tried this now, but
get a false negative on my system:

# thread-safe libxml2 is required by streamanalyzer and strigidaemon
find_package(LibXml2 REQUIRED)
include(CheckSymbolExists)
find_file(XMLVERSION_H libxml/xmlversion.h ${LIBXML2_INCLUDE_DIR})
SET(CMAKE_REQUIRED_FLAGS "-D_REENTRANT ")
CHECK_SYMBOL_EXISTS(LIBXML_THREAD_ENABLED ${XMLVERSION_H} LIBXML2THREADSAFE)
if (NOT LIBXML2THREADSAFE)
  message(FATAL_ERROR "libxml2 must be thread-safe
${LIBXML2_INCLUDE_DIR} ${XMLVERSION_H}")
endif (NOT LIBXML2THREADSAFE)

Cheers,
Jos


More information about the Kde-buildsystem mailing list