Package: openimageio Version: 1.1.10+dfsg0-2 Severity: important Tags: patch upstream User: debian-powerpc...@breakpoint.cc Usertags: powerpcspe
Hi, openimageio FTBFS on several architectures like this: ... /usr/bin/g++-4.7 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -O2 -g -Wl,-z,relro CMakeFiles/atomic_test.dir/atomic_test.cpp.o -o atomic_test -rdynamic libOpenImageIO.so.1.1.10 -lboost_filesystem-mt -lboost_regex-mt -lboost_system-mt -lboost_thread-mt -lpthread -ldl -lHalf -lIex -lImath -lIlmThread -lpthread -lpng -lz -ltiff -ljpeg -lz -ltiff -ljpeg -lIlmImf -Wl,-rpath,/«BUILDDIR»/openimageio-1.1.10+dfsg0/build/libOpenImageIO CMakeFiles/atomic_test.dir/atomic_test.cpp.o: In function `OpenImageIO::v1_1::atomic<long long>::operator++()': /«BUILDDIR»/openimageio-1.1.10+dfsg0/src/include/thread.h:250: undefined reference to `__sync_fetch_and_add_8' CMakeFiles/atomic_test.dir/atomic_test.cpp.o: In function `atomic_exchange_and_add': /«BUILDDIR»/openimageio-1.1.10+dfsg0/src/include/thread.h:250: undefined reference to `__sync_fetch_and_add_8' /«BUILDDIR»/openimageio-1.1.10+dfsg0/src/include/thread.h:250: undefined reference to `__sync_fetch_and_add_8' /«BUILDDIR»/openimageio-1.1.10+dfsg0/src/include/thread.h:250: undefined reference to `__sync_fetch_and_add_8' /«BUILDDIR»/openimageio-1.1.10+dfsg0/src/include/thread.h:250: undefined reference to `__sync_fetch_and_add_8' CMakeFiles/atomic_test.dir/atomic_test.cpp.o:/«BUILDDIR»/openimageio-1.1.10+dfsg0/src/include/thread.h:250: more undefined references to `__sync_fetch_and_add_8' follow CMakeFiles/atomic_test.dir/atomic_test.cpp.o: In function `atomic_compare_and_exchange': /«BUILDDIR»/openimageio-1.1.10+dfsg0/src/include/thread.h:300: undefined reference to `__sync_bool_compare_and_swap_8' CMakeFiles/atomic_test.dir/atomic_test.cpp.o: In function `atomic_exchange_and_add': /«BUILDDIR»/openimageio-1.1.10+dfsg0/src/include/thread.h:250: undefined reference to `__sync_fetch_and_add_8' /«BUILDDIR»/openimageio-1.1.10+dfsg0/src/include/thread.h:250: undefined reference to `__sync_fetch_and_add_8' collect2: error: ld returned 1 exit status make[4]: *** [libOpenImageIO/atomic_test] Error 1 make[4]: Leaving directory `/«BUILDDIR»/openimageio-1.1.10+dfsg0/build' ... Although #687612 was fixed with a new build dependency on g++-4.7, this doesn't work for some architectures because __sync_fetch_and_add_8 (i.e., the 64 bit atomic operation) is not generally available, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56300 __sync* is considered deprecated in favour of __atomic*, see attached patch. Includes build-dep on g++-4.8 (instead of g++-4.7) since full __atomic* support with library call fallback in case of missing lock free hardware support is only available there. Also, links with libatomic via debian/rules for the case of fallback library calls. You might want to limit this option ("-latomic") to archs which FTBFS for the above reason. Thanks in advance, Roland -- System Information: Debian Release: 7.0 APT prefers unreleased APT policy: (500, 'unreleased'), (500, 'unstable') Architecture: powerpcspe (ppc) Kernel: Linux 3.9.0-dirty (SMP w/2 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_GB.UTF-8) Shell: /bin/sh linked to /bin/dash
Index: openimageio-1.1.10+dfsg0/src/include/thread.h =================================================================== --- openimageio-1.1.10+dfsg0.orig/src/include/thread.h 2013-05-19 12:37:03.000000000 +0200 +++ openimageio-1.1.10+dfsg0/src/include/thread.h 2013-05-19 12:47:10.847718956 +0200 @@ -226,7 +226,7 @@ atomic_exchange_and_add (volatile int *at, int x) { #ifdef USE_GCC_ATOMICS - return __sync_fetch_and_add ((int *)at, x); + return __atomic_fetch_add ((int *)at, x, __ATOMIC_SEQ_CST); #elif USE_TBB atomic<int> *a = (atomic<int> *)at; return a->fetch_and_add (x); @@ -247,7 +247,7 @@ atomic_exchange_and_add (volatile long long *at, long long x) { #ifdef USE_GCC_ATOMICS - return __sync_fetch_and_add (at, x); + return __atomic_fetch_add (at, x, __ATOMIC_SEQ_CST); #elif USE_TBB atomic<long long> *a = (atomic<long long> *)at; return a->fetch_and_add (x); @@ -278,7 +278,7 @@ atomic_compare_and_exchange (volatile int *at, int compareval, int newval) { #ifdef USE_GCC_ATOMICS - return __sync_bool_compare_and_swap (at, compareval, newval); + return __atomic_compare_exchange_n (at, &compareval, newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); #elif USE_TBB atomic<int> *a = (atomic<int> *)at; return a->compare_and_swap (newval, compareval) == newval; @@ -297,7 +297,7 @@ atomic_compare_and_exchange (volatile long long *at, long long compareval, long long newval) { #ifdef USE_GCC_ATOMICS - return __sync_bool_compare_and_swap (at, compareval, newval); + return __atomic_compare_exchange_n (at, &compareval, newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); #elif USE_TBB atomic<long long> *a = (atomic<long long> *)at; return a->compare_and_swap (newval, compareval) == newval; --- openimageio-1.1.10+dfsg0/debian/control.orig 2013-05-19 15:26:34.037646462 +0200 +++ openimageio-1.1.10+dfsg0/debian/control 2013-05-19 13:43:32.160544134 +0200 @@ -6,7 +6,7 @@ Build-Depends: cmake, debhelper (>= 9), - g++-4.7, + g++-4.8, libboost-filesystem-dev, libboost-regex-dev, libboost-system-dev, --- openimageio-1.1.10+dfsg0/debian/rules.orig 2013-05-19 15:26:22.585645672 +0200 +++ openimageio-1.1.10+dfsg0/debian/rules 2013-05-19 14:44:15.345088609 +0200 @@ -1,8 +1,8 @@ #!/usr/bin/make -f export DH_OPTIONS export REPACK_SH=$(CURDIR)/debian/repack.sh -export CC=gcc-4.7 -export CXX=g++-4.7 +export CC=gcc-4.8 +export CXX=g++-4.8 INSTDIR=debian/tmp @@ -10,6 +10,8 @@ export DEB_CXXFLAGS_MAINT_APPEND := -fPIC endif +export DEB_LDFLAGS_MAINT_APPEND := -latomic + %: dh $@ --buildsystem=cmake \ --builddirectory=build \