RE: Bug#771556: x265: FTBFS on powerpc

Dejan Latinovic <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <[email protected]>


Hello Sebastian,

the patch is attached.

Please try it on ppc,
I hope that the condition for ppc arch is correct.


Here you can see related issue, with more info:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=748932

I had noticed that idba still FTBFS on ppc.
Could you also test my patch posted on #748932?

It is needed to update condition to cover pcc.
> #   if defined(__mips__) && !defined(__mips64)


Regards,
Dejan
use-atomic-for-mips-and-ppc.patch (text/x-patch, 2.1 KB)
diff -uNr x265-1.4.orig/debian/rules x265-1.4/debian/rules
--- x265-1.4.orig/debian/rules	2014-11-29 20:49:54.000000000 +0000
+++ x265-1.4/debian/rules	2014-12-03 17:17:49.000000000 +0000
@@ -11,7 +11,8 @@
 
 override_dh_auto_configure:
 	dh_auto_configure -- \
-		-DLIB_INSTALL_DIR=lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+		-DLIB_INSTALL_DIR=lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH) \
+		-DPLATFORM_LIBS=-latomic
 
 override_dh_auto_build-indep:
 	$(MAKE) -C doc/reST html
diff -uNr x265-1.4.orig/source/CMakeLists.txt x265-1.4/source/CMakeLists.txt
--- x265-1.4.orig/source/CMakeLists.txt	2014-12-03 17:15:20.000000000 +0000
+++ x265-1.4/source/CMakeLists.txt	2014-12-03 17:16:20.000000000 +0000
@@ -56,7 +56,7 @@
 endif()
 
 if(UNIX)
-    SET(PLATFORM_LIBS pthread)
+    SET(PLATFORM_LIBS ${PLATFORM_LIBS} pthread)
     find_library(LIBRT rt)
     if(LIBRT)
         set(PLATFORM_LIBS ${PLATFORM_LIBS} rt)
diff -uNr x265-1.4.orig/source/common/threading.h x265-1.4/source/common/threading.h
--- x265-1.4.orig/source/common/threading.h	2014-10-31 18:24:01.000000000 +0000
+++ x265-1.4/source/common/threading.h	2014-12-03 17:29:15.000000000 +0000
@@ -51,8 +51,15 @@
 
 #define CLZ32(id, x)                        id = (unsigned long)__builtin_clz(x) ^ 31
 #define CTZ64(id, x)                        id = (unsigned long)__builtin_ctzll(x)
+
+#if (defined(__mips__) && !defined(__mips64)) || (defined(__powerpc__) && !defined(__powerpc64__))
+#define ATOMIC_OR(ptr, mask)                __atomic_or_fetch(ptr, mask, __ATOMIC_SEQ_CST)
+#define ATOMIC_CAS(ptr, oldval, newval)     __atomic_compare_exchange(ptr, &oldval, &newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
+#else
 #define ATOMIC_OR(ptr, mask)                __sync_or_and_fetch(ptr, mask)
 #define ATOMIC_CAS(ptr, oldval, newval)     __sync_val_compare_and_swap(ptr, oldval, newval)
+#endif
+
 #define ATOMIC_CAS32(ptr, oldval, newval)   __sync_val_compare_and_swap(ptr, oldval, newval)
 #define ATOMIC_INC(ptr)                     __sync_add_and_fetch((volatile int32_t*)ptr, 1)
 #define ATOMIC_DEC(ptr)                     __sync_add_and_fetch((volatile int32_t*)ptr, -1)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.