[Swan-dev] Bug#853947: libreswan FTBFS on mips and mipsel: error: "_ABI64" is not defined [-Werror=undef]

Paul Wouters paul at nohats.ca
Wed Feb 8 23:34:56 UTC 2017


On Wed, 8 Feb 2017, Daniel Kahn Gillmor wrote:

>>>  #if _MIPS_SIM == _ABI64
>>>                   ^~~~~~
>>> cc1: all warnings being treated as errors
>>> ../../../mk/depend.mk:28: recipe for target 'base64_rsa_pubkey.o' failed
>>
>> Would you know how NSS deals with this on MIPS?
>
> I don't know what to say about this, but nss itself builds fine on MIPS:
>
>  https://buildd.debian.org/status/logs.php?arch=&pkg=nss

Right, so this is the case that really matters because the error in
libreswan comes from working around:

https://bugzilla.mozilla.org/show_bug.cgi?id=1336487

So we have copied some code from NSS into libreswan to deal with that
bug. And that is the code that is failing.

> as do packages that depend on it, like ceph or systemtap:

Yes, because the function we need from NSS that isn't properly exported
uses some other internal-only functions and we needed to copy those as
well and that is were the problem is.

Interestingly, I found a page that seems to introduce the issue for nss:

https://www.linux-mips.org/archives/linux-mips/2004-10/msg00063.html

A snippet from that page:

 	+#include <sgidefs.h>
 	+
 	#define _MCOUNT_DECL(frompc,selfpc) \
 	static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)

 	@@ -81,10 +83,10 @@
 	# define CPRETURN
 	#endif

 	-#if defined _ABIN32 && _MIPS_SIM == _ABIN32
 	+#if _MIPS_SIM == _MIPS_SIM_NABI32
 	# define PTR_ADDU_STRING "add" /* no u */
 	# define PTR_SUBU_STRING "sub" /* no u */
 	-#elif defined _ABI64 && _MIPS_SIM == _ABI64
 	+#elif _MIPS_SIM == _MIPS_SIM_ABI64
 	# define PTR_ADDU_STRING "daddu"
 	# define PTR_SUBU_STRING "dsubu"
 	#else

I found a copy of sgidefs.h which has:

#ifndef _ABI64
# define _ABI64         3

So, try the attached patch, that basically does:

+#ifndef _ABIO32
+# define _ABIO32        1
+#endif
+
+#ifndef _ABIN32
+# define _ABIN32        2
+#endif
+
+#ifndef _ABI64
+# define _ABI64         3
+#endif

Paul
-------------- next part --------------
diff --git a/include/nss_copies.h b/include/nss_copies.h
index bd3478f..12c478c 100644
--- a/include/nss_copies.h
+++ b/include/nss_copies.h
@@ -18,3 +18,16 @@
 
 SECCertTimeValidity NSSCERT_CheckCrlTimes(CERTCrl *crl, PRTime t);
 SECComparison NSSCERT_CompareAVA(const CERTAVA *a, const CERTAVA *b);
+
+/* Workaround for MIPS */
+#ifndef _ABIO32
+# define _ABIO32        1
+#endif
+
+#ifndef _ABIN32
+# define _ABIN32        2
+#endif
+
+#ifndef _ABI64
+# define _ABI64         3
+#endif


More information about the Swan-dev mailing list