Hi,
As I try to build TB locally, suddenly the M-C/C-C tree updated in
December failed to compile
mozilla/nsprpub/pr/src/pthreads/ptthread.c
I am using Debian GNU/Linux.
$ uname -a
Linux ip030 5.14.0-4-amd64 #1 SMP Debian 5.14.16-1 (2021-11-03) x86_64
GNU/Linux
I am fetching testing repository files to access latest GCC, etc.
I have been building TB using GCC-10 for some time now successfully.
After the update of source tree late December (I had not done so for
three weeks or so due to daytime job),
the compiler barfed saying that |gettid()| is not declared.
(Implicit declaration is a compilation error in my local setting.)
TB used to compile and build without any issue before.
I investigated and eventually figured that something changed in glibc
or kernel header files and that
compiler failed to grok this portion of code very well.
https://searchfox.org/comm-central/source/mozilla/nsprpub/pr/src/pthreads/ptthread.c#36
||
|#ifdef _PR_NICE_PRIORITY_SCHEDULING |
|#undef _POSIX_THREAD_PRIORITY_SCHEDULING |
|#include <sys/resource.h> |
|#ifndef HAVE_GETTID |
|#define gettid() (syscall(SYS_gettid)) <--- line 36|
|#endif |
|#endif
I have found out that |configure| thinks |gettid| is available. So this
macro definition no longer happens in my setting.
Strange, but the way |configure| detects is a bit loose.
It simply calls |gettid()| in a source file and see if the source file
compiles.
|
|I suspect that proper file that defines |gettid| as correct macro is no
longer included in the new glibc or kernel header files when ptthread.c
is compiled in my Debian GNU/Linux installation.
In any case, under linux, |gettid()| is not a defined function, but
rather should be invoked as|
||(syscall(SYS_gettid)) or something to that effect.||
|||So I suspect that the code should be changed into something like the
following.
That is, macro definition should happen under linux after all no matter
what.
(Short of modifying |gettid| detection in configure.)|
#ifdef _PR_NICE_PRIORITY_SCHEDULING
#undef _POSIX_THREAD_PRIORITY_SCHEDULING
#include <sys/resource.h>
#ifndef HAVE_GETTID
#define gettid() (syscall(SYS_gettid))
#elif !defined (LINUX)
// Under linux, gettid is not a defined function, but has to be changed to
// a wrapper call via syscall.
#define gettid() (syscall(SYS_gettid))
#endif
#endif
Before submitting a patch, I wonder if other people have noticed this
|gettid| issue.
This may be Debian kernel or the new glibc specific (and latest testing
version at that), but the change proposed above ought to be valid for
any linux distribution old and new.
TIA
Chiaki
--
You received this message because you are subscribed to the Google Groups
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/253d511c-6e52-7fad-f74d-be942321920c%40yk.rim.or.jp.