Hi Larry! Hi list!

On 13/04/2012 07:20, Larry Gritz wrote:
With this patch, and the knowledge that you should build with
USE_TBB=0 (until we perhaps make that the default), where are we now
with Debian builds?  Does this take care of things, or are there
still outstanding issues?

Now OIIO builds fine on both Debian GNU/kFreeBSD 32/64, where at [1] you can find an example of the kFreeBSD64 build-log.

Since we aim to dominate the entire world, I've now moved to the other remaining architectures (10 to go) and ARM{el|hf} is giving me issues about:

CMakeFiles/atomic_test.dir/atomic_test.cpp.o: In function `do_int64_math()':
atomic_test.cpp:(.text+0x298): undefined reference to `__sync_fetch_and_add_8'

I was pointed by some Debian Developers (DD) to the attached patch that solved a similar problem on rsyslog package. It would be great if you OIIO guys could give it a look and see if it maybe fix ARM build error.

Thanks a lot for your efforts in helping me with OIIO in Debian! ;-)

Cheers.



[1] http://debomatic-kbsd64.debian.net/unstable/pool/openimageio_1.0.2+dfsg0-1/openimageio_1.0.2+dfsg0-1.buildlog

--
Matteo F. Vescovi
Debian Sponsored Maintainer
GnuPG KeyID: 83B2CF7A
commit f8769ca19da2eff26dd80ca3b6217d078db1a59f
Author: Rainer Gerhards <[email protected]>
Date:   Wed Dec 1 18:13:40 2010 +0100

    bugfix: fixed build problems on some platforms
    
    namely those that have 32bit atomic operations but not 64 bit ones

diff --git a/runtime/atomic.h b/runtime/atomic.h
index 790cb1c..c022035 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -208,4 +208,31 @@
 
 #endif
 
+/* we need to handle 64bit atomics seperately as some platforms have 
+ * 32 bit atomics, but not 64 biot ones... -- rgerhards, 2010-12-01
+ */
+#ifdef HAVE_ATOMIC_BUILTINS_64BIT
+#      define ATOMIC_INC_uint64(data, phlpmut) ((void) 
__sync_fetch_and_add(data, 1))
+#      define ATOMIC_DEC_unit64(data, phlpmut) ((void) 
__sync_sub_and_fetch(data, 1))
+
+#      define DEF_ATOMIC_HELPER_MUT64(x)
+#      define INIT_ATOMIC_HELPER_MUT64(x)
+#      define DESTROY_ATOMIC_HELPER_MUT64(x) 
+#else
+#      define ATOMIC_INC_uint64(data, phlpmut)  { \
+               pthread_mutex_lock(phlpmut); \
+               ++(*(data)); \
+               pthread_mutex_unlock(phlpmut); \
+       }
+#      define ATOMIC_DEC_uint64(data, phlpmut)  { \
+               pthread_mutex_lock(phlpmut); \
+               --(*(data)); \
+               pthread_mutex_unlock(phlpmut); \
+       }
+
+#      define DEF_ATOMIC_HELPER_MUT64(x)  pthread_mutex_t x
+#      define INIT_ATOMIC_HELPER_MUT64(x) pthread_mutex_init(&(x), NULL)
+#      define DESTROY_ATOMIC_HELPER_MUT64(x) pthread_mutex_destroy(&(x))
+#endif /* #ifdef HAVE_ATOMIC_BUILTINS_64BIT */
+
 #endif /* #ifndef INCLUDED_ATOMIC_H */
diff --git a/runtime/statsobj.h b/runtime/statsobj.h
index 7447cde..44c26be 100644
--- a/runtime/statsobj.h
+++ b/runtime/statsobj.h
@@ -99,19 +99,19 @@ PROTOTYPEObj(statsobj);
  */
 #define STATSCOUNTER_DEF(ctr, mut) \
        intctr_t ctr; \
-       DEF_ATOMIC_HELPER_MUT(mut);
+       DEF_ATOMIC_HELPER_MUT64(mut);
 
 #define STATSCOUNTER_INIT(ctr, mut) \
-       INIT_ATOMIC_HELPER_MUT(mut); \
+       INIT_ATOMIC_HELPER_MUT64(mut); \
        ctr = 0;
 
 #define STATSCOUNTER_INC(ctr, mut) \
        if(GatherStats) \
-               ATOMIC_INC(&ctr, &mut);
+               ATOMIC_INC_uint64(&ctr, &mut);
 
 #define STATSCOUNTER_DEC(ctr, mut) \
        if(GatherStats) \
-               ATOMIC_DEC(&ctr, mut);
+               ATOMIC_DEC_uint64(&ctr, mut);
 
 /* the next macro works only if the variable is already guarded
  * by mutex (or the users risks a wrong result). It is assumed 
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to