[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#475767: [Fwd: Re: kde4libs vs qt4]



This should really fix the bug...
--- Begin Message ---
Hello Sune,

Sune Vuorela wrote:
I now hacked a bit and got stuff working on one of those cluster machines.
http://svn.debian.org/wsvn/pkg-kde/trunk/packages/qt4-
x11/debian/patches/72_generic_arch_atomic_header_fix.diff?op=file&rev=0&sc=0

This isn't the "real solution" though.

Qt4 has arch specific code for most archs (and a "generic" arch mostly used for bootstrapping of Qt), but no arch for linux/hppa, so we use the "generic" arch here.

The real solution involves some hppa assembler (which is way out of my league). There is a patch in the package by lamont about patching the hpux code, but I couldn't get taht to work with my quick tests.

Attached are the basic pieces which should get it working with the qt4-x11_4.4.0-3 source package. My machine is still compiling, but it seems OK so far...

First of all, I reused the "parisc" architecture code from the Trolls.
hppa and parisc are the same architectures, so why introduce something new? Furthermore the Qt code base has lots of "#ifdef QT_ARCH_PARISC", e.g. in src/corelib/thread/qbasicatomic.h, which would need to be duplicated for hppa. The nice effect is, that this way the parisc-atomic-headers will be used instead of the generic-locking-headers and it should fix a lot of following problems, e.g. with KDE.

This piece makes configure detect hppa as a parisc-architecture:

diff -up ./debian/patches/07_trust_dpkg-arch_over_uname-m.diff.org ./debian/patches/07_trust_dpkg-arch_over_uname-m.diff --- ./debian/patches/07_trust_dpkg-arch_over_uname-m.diff.org 2008-06-11 23:34:12.000000000 +0200 +++ ./debian/patches/07_trust_dpkg-arch_over_uname-m.diff 2008-06-11 23:34:23.000000000 +0200
@@ -22,7 +22,7 @@ Reported to trolltech as N180631 - and t
 +		UNAME_MACHINE="armv5tel"
 +	;;
 +	hppa)
-+		UNAME_MACHINE="parisc64"
++		UNAME_MACHINE="parisc"
 +	;;
 +	hurd-i386)
 +		UNAME_MACHINE="i686-AT386"


Not sure if it's needed, but it doesn't hurts either:
(I had some problems on my machine, that the Qt configure tests could not detect the endianess.)

diff -up ./debian/rules.org ./debian/rules
--- ./debian/rules.org	2008-06-10 23:50:44.000000000 +0200
+++ ./debian/rules	2008-06-11 23:36:26.000000000 +0200
@@ -65,6 +65,8 @@ ifeq ($(DEB_HOST_ARCH),hppa)
 		echo "Please update kernel and test again" ; \
 		exit 5 ; \
 	fi
+
+	EXTRA_CONFIGURE_OPTS += "-v -big-endian"
 endif

 	# Create mkspecs/glibc-g++ from mkspecs/linux-g++, needed by GNU/kFreeBSD



And this part replaces the debian patch "70_hppa_ldcw_fix.diff".
Maybe you could name this one "71_hppa_ldcw_fix.diff" and add it to the to-be-applied patches list? Benefit of my version is, that the q_ldcw() assembler statement will be inlined any will perform better than a call to an external funtion.

diff -up ./src/corelib/arch/parisc/arch.pri.org ./src/corelib/arch/parisc/arch.pri --- ./src/corelib/arch/parisc/arch.pri.org 2008-04-28 15:11:18.000000000 +0200
+++ ./src/corelib/arch/parisc/arch.pri	2008-06-10 00:19:10.000000000 +0200
@@ -1,5 +1,7 @@
 #
 # HP PA-RISC architecture
 #
-SOURCES += $$QT_ARCH_CPP/q_ldcw.s \
-	   $$QT_ARCH_CPP/qatomic_parisc.cpp
+
+hpux*:	SOURCES += $$QT_ARCH_CPP/q_ldcw.s
+
+SOURCES += $$QT_ARCH_CPP/qatomic_parisc.cpp
diff -up ./src/corelib/arch/parisc/qatomic_parisc.cpp.org ./src/corelib/arch/parisc/qatomic_parisc.cpp --- ./src/corelib/arch/parisc/qatomic_parisc.cpp.org 2008-06-10 00:02:32.000000000 +0200 +++ ./src/corelib/arch/parisc/qatomic_parisc.cpp 2008-06-10 00:09:54.000000000 +0200
@@ -72,7 +72,21 @@ static int *align16(int *lock)

 extern "C" {

+#if defined(Q_OS_LINUX)
+    #if defined(__LP64__)
+	#define __LDCW  "ldcw,co"
+    #else
+	#define __LDCW  "ldcw"
+    #endif
+    #define q_ldcw(addr) ({					\
+	unsigned __ret;						\
+	__asm__ __volatile__(__LDCW " 0(%1),%0"			\
+				: "=r" (__ret) : "r" (addr));	\
+	__ret;							\
+	})
+#else /* for HP/UX */
     int q_ldcw(volatile int *addr);
+#endif

     void q_atomic_lock(int *lock)
     {


Full patch attached as well, just in case my mailer breaks the lines.
Could you test it ? Do you need more ?

Best regards,
Helge
diff -up ./debian/patches/07_trust_dpkg-arch_over_uname-m.diff.org ./debian/patches/07_trust_dpkg-arch_over_uname-m.diff
--- ./debian/patches/07_trust_dpkg-arch_over_uname-m.diff.org	2008-06-11 23:34:12.000000000 +0200
+++ ./debian/patches/07_trust_dpkg-arch_over_uname-m.diff	2008-06-11 23:34:23.000000000 +0200
@@ -22,7 +22,7 @@ Reported to trolltech as N180631 - and t
 +		UNAME_MACHINE="armv5tel"
 +	;;
 +	hppa)
-+		UNAME_MACHINE="parisc64"
++		UNAME_MACHINE="parisc"
 +	;;
 +	hurd-i386)
 +		UNAME_MACHINE="i686-AT386"
diff -up ./debian/rules.org ./debian/rules
--- ./debian/rules.org	2008-06-10 23:50:44.000000000 +0200
+++ ./debian/rules	2008-06-11 23:36:26.000000000 +0200
@@ -65,6 +65,8 @@ ifeq ($(DEB_HOST_ARCH),hppa)
 		echo "Please update kernel and test again" ; \
 		exit 5 ; \
 	fi
+
+	EXTRA_CONFIGURE_OPTS += "-v -big-endian"
 endif
 
 	# Create mkspecs/glibc-g++ from mkspecs/linux-g++, needed by GNU/kFreeBSD
diff -up ./src/corelib/arch/parisc/arch.pri.org ./src/corelib/arch/parisc/arch.pri
--- ./src/corelib/arch/parisc/arch.pri.org	2008-04-28 15:11:18.000000000 +0200
+++ ./src/corelib/arch/parisc/arch.pri	2008-06-10 00:19:10.000000000 +0200
@@ -1,5 +1,7 @@
 #
 # HP PA-RISC architecture
 #
-SOURCES += $$QT_ARCH_CPP/q_ldcw.s \
-	   $$QT_ARCH_CPP/qatomic_parisc.cpp
+
+hpux*:	SOURCES += $$QT_ARCH_CPP/q_ldcw.s
+
+SOURCES += $$QT_ARCH_CPP/qatomic_parisc.cpp
diff -up ./src/corelib/arch/parisc/qatomic_parisc.cpp.org ./src/corelib/arch/parisc/qatomic_parisc.cpp
--- ./src/corelib/arch/parisc/qatomic_parisc.cpp.org	2008-06-10 00:02:32.000000000 +0200
+++ ./src/corelib/arch/parisc/qatomic_parisc.cpp	2008-06-10 00:09:54.000000000 +0200
@@ -72,7 +72,21 @@ static int *align16(int *lock)
 
 extern "C" {
 
+#if defined(Q_OS_LINUX)
+    #if defined(__LP64__)
+	#define __LDCW  "ldcw,co"
+    #else
+	#define __LDCW  "ldcw"
+    #endif
+    #define q_ldcw(addr) ({					\
+	unsigned __ret;						\
+	__asm__ __volatile__(__LDCW " 0(%1),%0"			\
+				: "=r" (__ret) : "r" (addr));	\
+	__ret;							\
+	})
+#else /* for HP/UX */
     int q_ldcw(volatile int *addr);
+#endif
 
     void q_atomic_lock(int *lock)
     {

--- End Message ---

Reply to: