Bug#725383: FTBFS on kfreebsd-*: SYS_gettid is Linux-specific

Steven Chamberlain steven at pyro.eu.org
Fri Oct 4 21:33:11 UTC 2013


Source: osgearth
Version: 2.4.0+dfsg-5
Tags: patch
User: debian-bsd at lists.debian.org
Usertags: kfreebsd
X-Debbugs-Cc: debian-bsd at lists.debian.org
Severity: serious
Justification: fails to build from source (but built successfully in the
past)

Hi,

osgearth fails to build on kfreebsd-* because it tries to directly use a
Linux-specific syscall:

https://buildd.debian.org/status/package.php?p=osgearth&suite=sid
> cd /«BUILDDIR»/osgearth-2.4.0+dfsg/build/src/osgEarth && /usr/bin/c++   -DOSGEARTH_LIBRARY -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DTIXML_USE_STL -DosgEarth_EXPORTS -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -O3 -DNDEBUG -fPIC -isystem /usr/include/qt4 -isystem /usr/include/qt4/QtGui -isystem /usr/include/qt4/QtCore -I/«BUILDDIR»/osgearth-2.4.0+dfsg/src -I/usr/include/gdal -I/usr/include/curl    -o CMakeFiles/osgEarth.dir/ThreadingUtils.cpp.o -c /«BUILDDIR»/osgearth-2.4.0+dfsg/src/osgEarth/ThreadingUtils.cpp
> /«BUILDDIR»/osgearth-2.4.0+dfsg/src/osgEarth/ThreadingUtils.cpp: In function 'unsigned int osgEarth::Threading::getCurrentThreadId()':
> /«BUILDDIR»/osgearth-2.4.0+dfsg/src/osgEarth/ThreadingUtils.cpp:42:30: error: 'SYS_gettid' was not declared in this scope
>    return (unsigned)::syscall(SYS_gettid);
>                               ^

osgearth also knows how to use Windows and Mac OS X--specific syscalls
to get a thread ID.  This is not portable and there is nothing directly
equivalent on FreeBSD, see:
http://lists.freebsd.org/pipermail/freebsd-hackers/2010-June/031992.html

A workaround may be to use pthread_self(), except that the exported
getCurrentThreadId function has to return 'unsigned int'.  On
kfreebsd-amd64 a 64-bit pointer to a pthread_t is not absolutely
guaranteed to be unique if truncated to 32 bits, but it is extremely
likely, and certainly better than nothing...

Please refer to attached patch which fixes package build at least.  Thanks!

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 9.0-2-amd64-xenhvm
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fallback-getCurrentThreadId.diff
Type: text/x-patch
Size: 909 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grass-devel/attachments/20131004/b84df8c2/attachment.bin>


More information about the Pkg-grass-devel mailing list