GNOME Bugzilla – Bug 795510
SYS_gettid is not available on non-Linux system
Last modified: 2018-04-28 15:21:01 UTC
The man page of gettid says gettid is a Linux-specific system call and it is not portable to other operating systems. GIMP git master cannot be compiled on FreeBSD because gettid is not available: gmake[2]: Entering directory '/home/lantw44/gnome/build/gimp/libgimpbase' CC gimputils.lo /home/lantw44/gnome/source/gimp/libgimpbase/gimputils.c:1182:27: error: use of undeclared identifier 'SYS_gettid' long tid = syscall (SYS_gettid); ^ 1 error generated.
Thanks for the report. I searched the web and could not find a good replacement. Anyway that's a bit redundant information, so let's just skip this on FreeBSD. This should be fixed now. Could you check? commit 106fc9309f2884bb91f2c9c6a17a9aa3e67c359b (HEAD -> master, origin/master, origin/HEAD) Author: Jehan <jehan@girinstud.io> Date: Wed Apr 25 00:19:37 2018 +0200 Bug 795510 - SYS_gettid is not available on non-Linux system. I could not find for sure what to use on FreeBSD instead, so let's just not get this information there. It is quite useful information to know where thread traces were asked from, but it is more important to make sure the program can be compiled everywhere. Also we can just check which thread has gimp_stack_trace*() calls. Thus it can be seen as redundant information in any case. SYS_gettid is apparently defined as a macro, so let's simply check for it being defined. libgimpbase/gimputils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Thanks, GIMP can be compiled on FreeBSD now. By the way, I just found that there is a system call 'thr_self' which can return current thread ID on FreeBSD. https://www.freebsd.org/cgi/man.cgi?query=thr_self
(In reply to Ting-Wei Lan from comment #2) > Thanks, GIMP can be compiled on FreeBSD now. By the way, I just found that > there is a system call 'thr_self' which can return current thread ID on > FreeBSD. > > https://www.freebsd.org/cgi/man.cgi?query=thr_self We are going to release 2.10, so I'd prefer not to push a commit for BSD blindly (since I won't be actually able to test the patch) because I'd prefer not to break BSD compilation. But if you can provide a patch with some #if which works on BSD, I'll happily push it. :-)
Created attachment 371494 [details] [review] libgimpbase: Find thread ID on FreeBSD with thr_self This only works on FreeBSD. It seems that each BSD implements pthread differently so there is no generic solution.
Thanks. I pushed it. A small advice for the future: reopen the bug report when you add a patch (or even just if you think the bug fix is still not right yet). Otherwise we may forget about these later if we don't process them right away. Obviously none wants this. :-D commit 077036273cefd0206c73dc2df03c7d93b860c1a0 (HEAD -> master, origin/master, origin/HEAD) Author: Ting-Wei Lan <lantw@src.gnome.org> Date: Sat Apr 28 20:57:46 2018 +0800 libgimpbase: Find thread ID on FreeBSD with thr_self https://bugzilla.gnome.org/show_bug.cgi?id=795510 configure.ac | 3 ++- libgimpbase/gimputils.c | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-)