Compilation errors: 'SYS_gettid' undeclared, expected ')' before 'sigev_value'

Hi! I’m trying to compile Percona-XtraDB-Cluster-5.6.20-68.0

# uname -mrs
FreeBSD 9.3-RELEASE amd64
# gcc --version
gcc (GCC) 4.2.1 20070831 patched [FreeBSD]

But I get the following errors:

[ 13%] Built target strings
[ 13%] Building C object mysys/CMakeFiles/mysys.dir/posix_timers.c.o
/home/user/Percona-XtraDB-Cluster-5.6.20-68.0/mysys/posix_timers.c:44: error: expected ')' before 'sigev_value'
/home/user/Percona-XtraDB-Cluster-5.6.20-68.0/mysys/posix_timers.c: In function 'timer_notify_thread':
/home/user/Percona-XtraDB-Cluster-5.6.20-68.0/mysys/posix_timers.c:71: error: 'SYS_gettid' undeclared (first use in this function)
/home/user/Percona-XtraDB-Cluster-5.6.20-68.0/mysys/posix_timers.c:71: error: (Each undeclared identifier is reported only once
/home/user/Percona-XtraDB-Cluster-5.6.20-68.0/mysys/posix_timers.c:71: error: for each function it appears in.)
/home/user/Percona-XtraDB-Cluster-5.6.20-68.0/mysys/posix_timers.c:82: warning: implicit declaration of function 'timer_notify_function'
*** [mysys/CMakeFiles/mysys.dir/posix_timers.c.o] Error code 1
cat /usr/include/sys/syscall.h | grep SYS_gettid

shows nothing, so I’ve added this:

#ifndef SYS_gettid
// i386: 224, ia64: 1105, amd64: 186, sparc 143
#ifdef __ia64__
#define SYS_gettid 1105
#elif __i386__
#define SYS_gettid 224
#elif __amd64__
#define SYS_gettid 186
#elif __sparc__
#define SYS_gettid 143
#else
#error define gettid for the arch
#endif
#endif

But there is still an issue with expected ‘)’ before ‘sigev_value’.
Can anybody help me with that?

I finally managed to solve the problem by changing /usr/include/sys/signal.h:
Before:

union sigval {
/* Members as suggested by Annex C of POSIX 1003.1b. */
int sival_int;
void *sival_ptr;
/* 6.0 compatibility */
int sigval_int;
void *sigval_ptr;
};

After:

typedef union sigval {
/* Members as suggested by Annex C of POSIX 1003.1b. */
int sival_int;
void *sival_ptr;
/* 6.0 compatibility */
int sigval_int;
void *sigval_ptr;
} sigval_t;

Maybe it will help somebody.