[Evolution-hackers] evolution-data-server amd64 build trouble/fix



I am seeing problems compiling evolution-data-server 1.0.2 on FreeBSD/AMD64 5.3 Beta 7. The problem is a duplicate macro definition in libdb/dbinc/mutex.h. Has anyone else had this problem? From the looks of it any AMD64 OS could trip on this. The offending code starts on line 731.


/*********************************************************************
 * amd64/gcc assembly.
 *********************************************************************/
#ifdef HAVE_MUTEX_X86_64_GCC_ASSEMBLY
typedef unsigned char tsl_t;

#ifdef LOAD_ACTUAL_MUTEX_CODE
/*
 * For gcc/amd64, 0 is clear, 1 is set.
 */
#define  MUTEX_SET(tsl) ({           \
	register tsl_t *__l = (tsl);          \
	int __r;              \
	asm volatile("mov $1,%%rax; lock; xchgb %1,%%al; xor $1,%%rax"\
		: "=&a" (__r), "=m" (*__l)          \
		: "1" (*__l)            \
		);                \
	__r & 1;              \
})

#define  MUTEX_UNSET(tsl)  (*(tsl) = 0)
#define  MUTEX_INIT(tsl)   MUTEX_UNSET(tsl)
#endif
#endif

/*********************************************************************
 * x86_64/gcc assembly.
 *********************************************************************/
#ifdef HAVE_MUTEX_X86_64_GCC_ASSEMBLY
typedef unsigned char tsl_t;

#ifdef LOAD_ACTUAL_MUTEX_CODE
/*
 * For gcc/x86-64, 0 is clear, 1 is set.
 */
#define	MUTEX_SET(tsl) ({						\
	register tsl_t *__l = (tsl);					\
	int __r;							\
	asm volatile("movq $1,%%rax; lock; xchgb %1,%%al; xorq $1,%%rax"\
	    : "=&a" (__r), "=m" (*__l)					\
	    : "1" (*__l)						\
	    );								\
	__r & 1;							\
})

#define	MUTEX_UNSET(tsl)	(*(tsl) = 0)
#define	MUTEX_INIT(tsl)		MUTEX_UNSET(tsl)
#endif
#endif

The x86-64 code is triggered by the same macro as amd64, so the build fails due to the duplicate typedef/macro definition. Isn't x86-64 synonymous with amd64? It seems like the second would be unnecessary. Deleting the x86-64 section allows it to compile and function correctly. The second doesn't seem needed. Forgive me if I am wrong, but isn't x86-64 the same as amd64? I am not familiar with x86 assembly so I am not sure which assembly code is correct, but using the amd64 MUTEX_SET macro (with mov and xor rather than movq and xorq) I haven't had any problems, and I finally the addressbook feature in evolution 2 working.



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