Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fontconfig fails to build on 10.4 G3 #28

Closed
theos911 opened this issue Apr 14, 2013 · 6 comments
Closed

fontconfig fails to build on 10.4 G3 #28

theos911 opened this issue Apr 14, 2013 · 6 comments

Comments

@theos911
Copy link

fontconfig (dependency for mplayer) does not build

https://gist.github.com/theos911/5384545

@mistydemeo
Copy link
Owner

Relevant part of the build:

/usr/bin/ld: Undefined symbols:
_OSAtomicCompareAndSwapPtrBarrier
collect2: ld returned 1 exit status

Not sure if this function is available in 10.4.

@mistydemeo
Copy link
Owner

From the manpage:

HISTORY
Most of these functions first appeared in Mac OS 10.4 (Tiger). The "Orig" forms of the boolean opera-
tions, the "int", "long" and "ptr" forms of compare-and-swap, and lockless enqueue/dequeue first
appeared in Mac OS 10.5 (Leopard).

So the function doesn't exist in Tiger. This will require a patch for fontconfig which can get the same functionality using functions available on Tiger.

@mistydemeo
Copy link
Owner

The function is used in this #define in src/fcatomic.h:

#define fc_atomic_ptr_cmpexch(P,O,N)    OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))

@mistydemeo
Copy link
Owner

@mistydemeo
Copy link
Owner

Since the 32-bit and 64-bit versions exist on Tiger, the #define could be done like this:

diff --git a/src/fcatomic.h b/src/fcatomic.h
index a764311..fc849b6 100644
--- a/src/fcatomic.h
+++ b/src/fcatomic.h
@@ -75,7 +75,13 @@ typedef int fc_atomic_int_t;
 #define fc_atomic_int_add(AI, V)   (OSAtomicAdd32Barrier ((V), &(AI)) - (V))

 #define fc_atomic_ptr_get(P)       (OSMemoryBarrier (), (void *) *(P))
-#define fc_atomic_ptr_cmpexch(P,O,N)   OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
+#if defined(OSAtomicCompareAndSwapPtrBarrier)
+ #define fc_atomic_ptr_cmpexch(P,O,N)  OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
+#elif defined(__LP64__)
+ #define fc_atomic_ptr_cmpexch(P,O,N)  OSAtomicCompareAndSwap64Barrier ((void *) (O), (void *) (N), (void **) (P))
+#else
+ #define fc_atomic_ptr_cmpexch(P,O,N)  OSAtomicCompareAndSwap32Barrier ((void *) (O), (void *) (N), (void **) (P))
+#endif


 #elif !defined(FC_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)

Built, testing it out to see if it works.

@mistydemeo
Copy link
Owner

Submitted a better version of the patch upstream, and included it in the formula.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants