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

Sebastiaan Couwenberg sebastic at xs4all.nl
Sat Oct 5 00:56:57 UTC 2013


Hi Steven,

On 10/04/2013 11:33 PM, Steven Chamberlain wrote:
> 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!

Thanks for the patch.

Another option I've looked at is to use the undocumented thr_self(2)
syscall, this was recommended over pthread_self() on freebsd-hackers@:
http://lists.freebsd.org/pipermail/freebsd-hackers/2010-June/031991.html

The attached patch is what I was working on, but it breaks the build
even worse than without it.

I'll have another go at making my patch work, otherwise I'll apply your
patch to at least get the package to build. I had changed the package to
linux-any since upstream doesn't support FreeBSD, but that's not really
a fix for the problem.

Kind Regards,

Bas

-- 
GnuPG: 0xE88D4AF1 (new) / 0x77A975AD (old)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kfreebsd-thread-id.patch
Type: text/x-patch
Size: 2856 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grass-devel/attachments/20131005/8365b2e3/attachment-0001.bin>


More information about the Pkg-grass-devel mailing list