Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] opencv: fix sparc64 compile
@ 2016-04-03 11:09 Waldemar Brodkorb
  2016-04-04 19:40 ` Arnout Vandecappelle
  0 siblings, 1 reply; 4+ messages in thread
From: Waldemar Brodkorb @ 2016-04-03 11:09 UTC (permalink / raw)
  To: buildroot

This patch from Debian fixes following autobuild failure:
http://autobuild.buildroot.net/results/eda5c6c43da40a342e0f545a348d2f865eb5ccf2/

Tested with ARM build without a regression.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 package/opencv/0002-atomic.patch | 222 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 222 insertions(+)
 create mode 100644 package/opencv/0002-atomic.patch

diff --git a/package/opencv/0002-atomic.patch b/package/opencv/0002-atomic.patch
new file mode 100644
index 0000000..607d3fd
--- /dev/null
+++ b/package/opencv/0002-atomic.patch
@@ -0,0 +1,222 @@
+Bug#714923: opencv FTBFS on sparc64
+https://www.mail-archive.com/debian-bugs-dist at lists.debian.org/msg1393793.html
+
+diff -Nur opencv-2.4.12.3.orig/modules/core/include/opencv2/core/core.hpp opencv-2.4.12.3/modules/core/include/opencv2/core/core.hpp
+--- opencv-2.4.12.3.orig/modules/core/include/opencv2/core/core.hpp	2015-10-26 08:56:34.000000000 +0100
++++ opencv-2.4.12.3/modules/core/include/opencv2/core/core.hpp	2016-04-03 00:10:50.455774144 +0200
+@@ -1290,7 +1290,7 @@
+     operator const _Tp*() const;
+ 
+     _Tp* obj; //< the object pointer.
+-    int* refcount; //< the associated reference counter
++    _Atomic_word* refcount; //< the associated reference counter
+ };
+ 
+ template<typename T>
+@@ -1490,9 +1490,9 @@
+ public:
+     MatAllocator() {}
+     virtual ~MatAllocator() {}
+-    virtual void allocate(int dims, const int* sizes, int type, int*& refcount,
++    virtual void allocate(int dims, const int* sizes, int type, _Atomic_word*& refcount,
+                           uchar*& datastart, uchar*& data, size_t* step) = 0;
+-    virtual void deallocate(int* refcount, uchar* datastart, uchar* data) = 0;
++    virtual void deallocate(_Atomic_word* refcount, uchar* datastart, uchar* data) = 0;
+ };
+ 
+ /*!
+@@ -1985,7 +1985,7 @@
+ 
+     //! pointer to the reference counter;
+     // when matrix points to user-allocated data, the pointer is NULL
+-    int* refcount;
++    _Atomic_word* refcount;
+ 
+     //! helper fields used in locateROI and adjustROI
+     uchar* datastart;
+@@ -3408,7 +3408,7 @@
+     {
+         Hdr(int _dims, const int* _sizes, int _type);
+         void clear();
+-        int refcount;
++        _Atomic_word refcount;
+         int dims;
+         int valueOffset;
+         size_t nodeSize;
+diff -Nur opencv-2.4.12.3.orig/modules/core/include/opencv2/core/gpumat.hpp opencv-2.4.12.3/modules/core/include/opencv2/core/gpumat.hpp
+--- opencv-2.4.12.3.orig/modules/core/include/opencv2/core/gpumat.hpp	2015-10-26 08:56:34.000000000 +0100
++++ opencv-2.4.12.3/modules/core/include/opencv2/core/gpumat.hpp	2016-04-02 23:08:58.116874218 +0200
+@@ -301,7 +301,7 @@
+ 
+         //! pointer to the reference counter;
+         // when GpuMatrix points to user-allocated data, the pointer is NULL
+-        int* refcount;
++        _Atomic_word* refcount;
+ 
+         //! helper fields used in locateROI and adjustROI
+         uchar* datastart;
+diff -Nur opencv-2.4.12.3.orig/modules/core/include/opencv2/core/operations.hpp opencv-2.4.12.3/modules/core/include/opencv2/core/operations.hpp
+--- opencv-2.4.12.3.orig/modules/core/include/opencv2/core/operations.hpp	2015-10-26 08:56:34.000000000 +0100
++++ opencv-2.4.12.3/modules/core/include/opencv2/core/operations.hpp	2016-04-02 23:12:59.148385306 +0200
+@@ -2589,7 +2589,7 @@
+ {
+     if(obj)
+     {
+-        refcount = (int*)fastMalloc(sizeof(*refcount));
++        refcount = (_Atomic_word*)fastMalloc(sizeof(*refcount));
+         *refcount = 1;
+     }
+     else
+@@ -2628,7 +2628,7 @@
+ {
+     if (this != &_ptr)
+     {
+-      int* _refcount = _ptr.refcount;
++      _Atomic_word* _refcount = _ptr.refcount;
+       if( _refcount )
+           CV_XADD(_refcount, 1);
+       release();
+diff -Nur opencv-2.4.12.3.orig/modules/core/src/gpumat.cpp opencv-2.4.12.3/modules/core/src/gpumat.cpp
+--- opencv-2.4.12.3.orig/modules/core/src/gpumat.cpp	2015-10-26 08:56:34.000000000 +0100
++++ opencv-2.4.12.3/modules/core/src/gpumat.cpp	2016-04-02 23:14:38.894804300 +0200
+@@ -716,7 +716,7 @@
+         datastart = data = static_cast<uchar*>(devPtr);
+         dataend = data + nettosize;
+ 
+-        refcount = static_cast<int*>(fastMalloc(sizeof(*refcount)));
++        refcount = static_cast<_Atomic_word*>(fastMalloc(sizeof(*refcount)));
+         *refcount = 1;
+     }
+ }
+diff -Nur opencv-2.4.12.3.orig/modules/core/src/matrix.cpp opencv-2.4.12.3/modules/core/src/matrix.cpp
+--- opencv-2.4.12.3.orig/modules/core/src/matrix.cpp	2015-10-26 08:56:34.000000000 +0100
++++ opencv-2.4.12.3/modules/core/src/matrix.cpp	2016-04-02 23:59:53.405491031 +0200
+@@ -213,7 +213,7 @@
+         {
+             size_t totalsize = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount));
+             data = datastart = (uchar*)fastMalloc(totalsize + (int)sizeof(*refcount));
+-            refcount = (int*)(data + totalsize);
++            refcount = (_Atomic_word*)(data + totalsize);
+             *refcount = 1;
+         }
+         else
+@@ -228,7 +228,7 @@
+                 allocator = 0;
+                 size_t totalSize = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount));
+                 data = datastart = (uchar*)fastMalloc(totalSize + (int)sizeof(*refcount));
+-                refcount = (int*)(data + totalSize);
++                refcount = (_Atomic_word*)(data + totalSize);
+                 *refcount = 1;
+             }
+ #else
+diff -Nur opencv-2.4.12.3.orig/modules/core/src/system.cpp opencv-2.4.12.3/modules/core/src/system.cpp
+--- opencv-2.4.12.3.orig/modules/core/src/system.cpp	2015-10-26 08:56:34.000000000 +0100
++++ opencv-2.4.12.3/modules/core/src/system.cpp	2016-04-02 23:33:19.298905578 +0200
+@@ -892,7 +892,7 @@
+     void unlock() { LeaveCriticalSection(&cs); }
+ 
+     CRITICAL_SECTION cs;
+-    int refcount;
++    _Atomic_word refcount;
+ };
+ 
+ #ifndef __GNUC__
+@@ -920,7 +920,7 @@
+     void unlock() { OSSpinLockUnlock(&sl); }
+ 
+     OSSpinLock sl;
+-    int refcount;
++    _Atomic_word refcount;
+ };
+ 
+ #elif defined __linux__ && !defined ANDROID && !defined __LINUXTHREADS_OLD__
+@@ -935,7 +935,7 @@
+     void unlock() { pthread_spin_unlock(&sl); }
+ 
+     pthread_spinlock_t sl;
+-    int refcount;
++    _Atomic_word refcount;
+ };
+ 
+ #else
+@@ -950,7 +950,7 @@
+     void unlock() { pthread_mutex_unlock(&sl); }
+ 
+     pthread_mutex_t sl;
+-    int refcount;
++    _Atomic_word refcount;
+ };
+ 
+ #endif
+diff -Nur opencv-2.4.12.3.orig/modules/gpu/include/opencv2/gpu/gpu.hpp opencv-2.4.12.3/modules/gpu/include/opencv2/gpu/gpu.hpp
+--- opencv-2.4.12.3.orig/modules/gpu/include/opencv2/gpu/gpu.hpp	2015-10-26 08:56:34.000000000 +0100
++++ opencv-2.4.12.3/modules/gpu/include/opencv2/gpu/gpu.hpp	2016-04-02 23:16:19.737293785 +0200
+@@ -125,7 +125,7 @@
+     size_t step;
+ 
+     uchar* data;
+-    int* refcount;
++    _Atomic_word* refcount;
+ 
+     uchar* datastart;
+     uchar* dataend;
+diff -Nur opencv-2.4.12.3.orig/modules/ocl/include/opencv2/ocl/ocl.hpp opencv-2.4.12.3/modules/ocl/include/opencv2/ocl/ocl.hpp
+--- opencv-2.4.12.3.orig/modules/ocl/include/opencv2/ocl/ocl.hpp	2015-10-26 08:56:34.000000000 +0100
++++ opencv-2.4.12.3/modules/ocl/include/opencv2/ocl/ocl.hpp	2016-04-02 23:18:55.715331443 +0200
+@@ -404,7 +404,7 @@
+ 
+             //! pointer to the reference counter;
+             // when oclMatrix points to user-allocated data, the pointer is NULL
+-            int *refcount;
++            _Atomic_word *refcount;
+ 
+             //! helper fields used in locateROI and adjustROI
+             //datastart and dataend are not used in current version
+diff -Nur opencv-2.4.12.3.orig/modules/ocl/src/matrix_operations.cpp opencv-2.4.12.3/modules/ocl/src/matrix_operations.cpp
+--- opencv-2.4.12.3.orig/modules/ocl/src/matrix_operations.cpp	2015-10-26 08:56:34.000000000 +0100
++++ opencv-2.4.12.3/modules/ocl/src/matrix_operations.cpp	2016-04-02 23:19:23.633128033 +0200
+@@ -591,7 +591,7 @@
+         datastart = data = (uchar *)dev_ptr;
+         dataend = data + nettosize;
+ 
+-        refcount = (int *)fastMalloc(sizeof(*refcount));
++        refcount = (_Atomic_word *)fastMalloc(sizeof(*refcount));
+         *refcount = 1;
+     }
+ }
+diff -Nur opencv-2.4.12.3.orig/modules/python/src2/cv2.cpp opencv-2.4.12.3/modules/python/src2/cv2.cpp
+--- opencv-2.4.12.3.orig/modules/python/src2/cv2.cpp	2015-10-26 08:56:34.000000000 +0100
++++ opencv-2.4.12.3/modules/python/src2/cv2.cpp	2016-04-02 23:18:34.897991791 +0200
+@@ -157,12 +157,12 @@
+ static size_t REFCOUNT_OFFSET = (size_t)&(((PyObject*)0)->ob_refcnt) +
+     (0x12345678 != *(const size_t*)"\x78\x56\x34\x12\0\0\0\0\0")*sizeof(int);
+ 
+-static inline PyObject* pyObjectFromRefcount(const int* refcount)
++static inline PyObject* pyObjectFromRefcount(const _Atomic_word* refcount)
+ {
+     return (PyObject*)((size_t)refcount - REFCOUNT_OFFSET);
+ }
+ 
+-static inline int* refcountFromPyObject(const PyObject* obj)
++static inline _Atomic_word* refcountFromPyObject(const PyObject* obj)
+ {
+     return (int*)((size_t)obj + REFCOUNT_OFFSET);
+ }
+@@ -173,7 +173,7 @@
+     NumpyAllocator() {}
+     ~NumpyAllocator() {}
+ 
+-    void allocate(int dims, const int* sizes, int type, int*& refcount,
++    void allocate(int dims, const int* sizes, int type, _Atomic_word*& refcount,
+                   uchar*& datastart, uchar*& data, size_t* step)
+     {
+         PyEnsureGIL gil;
+@@ -206,7 +206,7 @@
+         datastart = data = (uchar*)PyArray_DATA((PyArrayObject*) o);
+     }
+ 
+-    void deallocate(int* refcount, uchar*, uchar*)
++    void deallocate(_Atomic_word* refcount, uchar*, uchar*)
+     {
+         PyEnsureGIL gil;
+         if( !refcount )
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] opencv: fix sparc64 compile
  2016-04-03 11:09 [Buildroot] [PATCH] opencv: fix sparc64 compile Waldemar Brodkorb
@ 2016-04-04 19:40 ` Arnout Vandecappelle
  2016-04-04 19:43   ` Waldemar Brodkorb
  0 siblings, 1 reply; 4+ messages in thread
From: Arnout Vandecappelle @ 2016-04-04 19:40 UTC (permalink / raw)
  To: buildroot

On 04/03/16 13:09, Waldemar Brodkorb wrote:
> This patch from Debian fixes following autobuild failure:
> http://autobuild.buildroot.net/results/eda5c6c43da40a342e0f545a348d2f865eb5ccf2/
>
> Tested with ARM build without a regression.
>
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> ---
>   package/opencv/0002-atomic.patch | 222 +++++++++++++++++++++++++++++++++++++++
>   1 file changed, 222 insertions(+)
>   create mode 100644 package/opencv/0002-atomic.patch
>
> diff --git a/package/opencv/0002-atomic.patch b/package/opencv/0002-atomic.patch
> new file mode 100644
> index 0000000..607d3fd
> --- /dev/null
> +++ b/package/opencv/0002-atomic.patch
> @@ -0,0 +1,222 @@
> +Bug#714923: opencv FTBFS on sparc64
> +https://www.mail-archive.com/debian-bugs-dist at lists.debian.org/msg1393793.html
> +

  You should sign off the patch. It is also missing a description of what is 
wrong and how it is fixed.

  Also please refer to the bug tracker itself rather than the mail archive:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=714923

  The first message there contains a nice description of the problem that you 
can reuse in the patch.

  Regards,
  Arnout

> +diff -Nur opencv-2.4.12.3.orig/modules/core/include/opencv2/core/core.hpp opencv-2.4.12.3/modules/core/include/opencv2/core/core.hpp
> +--- opencv-2.4.12.3.orig/modules/core/include/opencv2/core/core.hpp	2015-10-26 08:56:34.000000000 +0100
> ++++ opencv-2.4.12.3/modules/core/include/opencv2/core/core.hpp	2016-04-03 00:10:50.455774144 +0200
[snip]


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] opencv: fix sparc64 compile
  2016-04-04 19:40 ` Arnout Vandecappelle
@ 2016-04-04 19:43   ` Waldemar Brodkorb
  2016-04-05  7:37     ` Arnout Vandecappelle
  0 siblings, 1 reply; 4+ messages in thread
From: Waldemar Brodkorb @ 2016-04-04 19:43 UTC (permalink / raw)
  To: buildroot

Hi Arnout,
Arnout Vandecappelle wrote,

> On 04/03/16 13:09, Waldemar Brodkorb wrote:
> >This patch from Debian fixes following autobuild failure:
> >http://autobuild.buildroot.net/results/eda5c6c43da40a342e0f545a348d2f865eb5ccf2/
> >
> >Tested with ARM build without a regression.
> >
> >Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> >---
> >  package/opencv/0002-atomic.patch | 222 +++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 222 insertions(+)
> >  create mode 100644 package/opencv/0002-atomic.patch
> >
> >diff --git a/package/opencv/0002-atomic.patch b/package/opencv/0002-atomic.patch
> >new file mode 100644
> >index 0000000..607d3fd
> >--- /dev/null
> >+++ b/package/opencv/0002-atomic.patch
> >@@ -0,0 +1,222 @@
> >+Bug#714923: opencv FTBFS on sparc64
> >+https://www.mail-archive.com/debian-bugs-dist at lists.debian.org/msg1393793.html
> >+
> 
>  You should sign off the patch. It is also missing a description of what is
> wrong and how it is fixed.

Thanks for the review.
I thought Signed-off-By is only used if I made the patch and not if
I copy the patch from some internet site.
 
>  Also please refer to the bug tracker itself rather than the mail archive:
> 
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=714923
> 
>  The first message there contains a nice description of the problem that you
> can reuse in the patch.

Okay,

Waldemar

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] opencv: fix sparc64 compile
  2016-04-04 19:43   ` Waldemar Brodkorb
@ 2016-04-05  7:37     ` Arnout Vandecappelle
  0 siblings, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2016-04-05  7:37 UTC (permalink / raw)
  To: buildroot



On 04/04/16 21:43, Waldemar Brodkorb wrote:
> Hi Arnout,
> Arnout Vandecappelle wrote,
>
>> On 04/03/16 13:09, Waldemar Brodkorb wrote:
>>> This patch from Debian fixes following autobuild failure:
>>> http://autobuild.buildroot.net/results/eda5c6c43da40a342e0f545a348d2f865eb5ccf2/
>>>
>>> Tested with ARM build without a regression.
>>>
>>> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
>>> ---
>>>   package/opencv/0002-atomic.patch | 222 +++++++++++++++++++++++++++++++++++++++
>>>   1 file changed, 222 insertions(+)
>>>   create mode 100644 package/opencv/0002-atomic.patch
>>>
>>> diff --git a/package/opencv/0002-atomic.patch b/package/opencv/0002-atomic.patch
>>> new file mode 100644
>>> index 0000000..607d3fd
>>> --- /dev/null
>>> +++ b/package/opencv/0002-atomic.patch
>>> @@ -0,0 +1,222 @@
>>> +Bug#714923: opencv FTBFS on sparc64
>>> +https://www.mail-archive.com/debian-bugs-dist at lists.debian.org/msg1393793.html
>>> +
>>
>>   You should sign off the patch. It is also missing a description of what is
>> wrong and how it is fixed.
>
> Thanks for the review.
> I thought Signed-off-By is only used if I made the patch and not if
> I copy the patch from some internet site.

 
https://buildroot.org/downloads/manual/manual.html#_format_and_licensing_of_the_package_patches

  Third paragraph.

  Regards,
  Arnout

>
>>   Also please refer to the bug tracker itself rather than the mail archive:
>>
>> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=714923
>>
>>   The first message there contains a nice description of the problem that you
>> can reuse in the patch.
>
> Okay,
>
> Waldemar
>

-- 
Arnout Vandecappelle      arnout dot vandecappelle at essensium dot com
Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile)
Essensium, Mind division . . . . . . . . . . . . . . http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium . . . . . BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-05  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-03 11:09 [Buildroot] [PATCH] opencv: fix sparc64 compile Waldemar Brodkorb
2016-04-04 19:40 ` Arnout Vandecappelle
2016-04-04 19:43   ` Waldemar Brodkorb
2016-04-05  7:37     ` Arnout Vandecappelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox