Package: opensips
Version: 2.1.2-2
Severity: important
Tags: sid + patch
Justification: FTBFS
User: [email protected]
Usertags: mips-patch
Hi,
Package opensips FTBFS on mips, mips64el and other architectures with following
error:
In file included from ../../pt.h:70:0,
from ../../dprint.h:402,
from ../../lock_ops.h:135,
from ../../locking.h:65,
from hslot.h:33,
from urecord.h:38,
from urecord.c:35:
../../statistics.h:144:8: error: unknown type name 'gen_lock_t'
extern gen_lock_t *stat_lock;
^
build logs:
https://buildd.debian.org/status/fetch.php?pkg=opensips&arch=mips&ver=2.1.2-2&stamp=1461374393
https://buildd.debian.org/status/fetch.php?pkg=opensips&arch=mips64el&ver=2.1.2-2&stamp=1466980139
https://buildd.debian.org/status/fetch.php?pkg=opensips&arch=arm64&ver=2.1.2-2&stamp=1461066695
https://buildd.debian.org/status/fetch.php?pkg=opensips&arch=hppa&ver=2.1.2-2&stamp=1466630442
https://buildd.debian.org/status/fetch.php?pkg=opensips&arch=m68k&ver=2.1.2-2&stamp=1469744676
https://buildd.debian.org/status/fetch.php?pkg=opensips&arch=s390x&ver=2.1.2-2&stamp=1461066886
https://buildd.debian.org/status/fetch.php?pkg=opensips&arch=sh4&ver=2.1.2-2&stamp=1469693984
The build fails when USE_SYSV_SEM and NO_ATOMIC_OPS flags are defined.
USE_SYSV_SEM is defined when the archiecture is not recognized by Makefile.defs
or hardware locking (FAST_LOCK) is not supported for target architecture.
The detection of mips (mips32) architecture is missing from Makefile.defs, there
is no check for _MIPS_ISA_MIPS32 or _MIPS_ARCH_MIPS32R2 compiler macros.
Mips64el can be recognized by Makefile but arch specific definitions are
missing for
this architecture.
For both, mips and mips64el, fast_lock is not used. USE_SYSV_SEM and
NO_ATOMIC_OPS
flags are defined.
The build fails because of the code uder USE_SYSV_SEM flag in lock_ops.h file.
Mipsel build passes because it is recognized as mips2 and fast_lock is enabled
for
that architecture.
For Linux, SYSV locking support is replaced with POSIX upstream.
The attached patch fixes the build by using posix locking support.
With this patch I was able to build opensips successfully for mips and mips64el.
It may fix the build for other architectures too.
Regards,
Daniel
--- opensips-2.1.2.orig/Makefile.defs
+++ opensips-2.1.2/Makefile.defs
@@ -1283,7 +1283,7 @@ ifeq ($(OS), linux)
-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
-DHAVE_TIMEGM
ifneq ($(found_lock_method), yes)
- DEFS+= -DUSE_SYSV_SEM # try posix sems
+ DEFS+= -DUSE_POSIX_SEM # try posix sems
found_lock_method=yes
endif
# check for >= 2.5.44
@@ -1499,6 +1499,13 @@ ifneq (,$(findstring CYGWIN, $(OS)))
endif
endif
+#if POSIX sems are to be used, be sure to link with ptread
+ifneq (,$(findstring USE_POSIX_SEM, $(DEFS)))
+ifeq (,$(findstring pthread, $(LIBS)))
+LIBS+= -pthread
+endif
+endif
+
#add libsctp if needed
ifneq ($(SCTP),)
LIBS+= -lsctp
--- opensips-2.1.2.orig/net/net_tcp.c
+++ opensips-2.1.2/net/net_tcp.c
@@ -838,7 +838,7 @@ static struct tcp_connection* tcpconn_ne
error:
if (c) {
- if (c->write_lock) lock_destroy(&c->write_lock);
+ lock_destroy(&c->write_lock);
shm_free(c);
}
return 0;