diff --git a/eigen3-3.1.3-memalign.patch b/eigen3-3.1.3-memalign.patch new file mode 100644 index 0000000..5c87abb --- /dev/null +++ b/eigen3-3.1.3-memalign.patch @@ -0,0 +1,41 @@ +# HG changeset patch +# User Gael Guennebaud +# Date 1372279754 -7200 +# Node ID 21273ebd6b4d9137d29663c0ece1b683db7d3cc1 +# Parent a72dae9e2650eac6f9b5be1c4e506560f8e2eb17 +Fix bug 554: include unistd.h before checking the presence of posix_memalign. + +diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h +--- a/Eigen/src/Core/util/Memory.h ++++ b/Eigen/src/Core/util/Memory.h +@@ -53,9 +53,16 @@ + #endif + +-#if ((defined __QNXNTO__) || (defined _GNU_SOURCE) || ((defined _XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600))) \ +- && (defined _POSIX_ADVISORY_INFO) && (_POSIX_ADVISORY_INFO > 0) +- #define EIGEN_HAS_POSIX_MEMALIGN 1 +-#else ++// See bug 554 (http://eigen.tuxfamily.org/bz/show_bug.cgi?id=554) ++// It seems to be unsafe to check _POSIX_ADVISORY_INFO without including unistd.h first. ++// Currently, let's include it only on unix systems: ++#if defined(__unix__) || defined(__unix) ++ #include ++ #if ((defined __QNXNTO__) || (defined _GNU_SOURCE) || ((defined _XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600))) && (defined _POSIX_ADVISORY_INFO) && (_POSIX_ADVISORY_INFO > 0) ++ #define EIGEN_HAS_POSIX_MEMALIGN 1 ++ #endif ++#endif ++ ++#ifndef EIGEN_HAS_POSIX_MEMALIGN + #define EIGEN_HAS_POSIX_MEMALIGN 0 + #endif + +@@ -209,7 +216,7 @@ + if(posix_memalign(&result, 16, size)) result = 0; + #elif EIGEN_HAS_MM_MALLOC + result = _mm_malloc(size, 16); +-#elif defined(_MSC_VER) && (!defined(_WIN32_WCE)) ++ #elif defined(_MSC_VER) && (!defined(_WIN32_WCE)) + result = _aligned_malloc(size, 16); + #else + result = handmade_aligned_malloc(size); + diff --git a/eigen3.spec b/eigen3.spec index a19fa38..5e119d7 100644 --- a/eigen3.spec +++ b/eigen3.spec @@ -1,6 +1,6 @@ Name: eigen3 Version: 3.1.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A lightweight C++ template library for vector and matrix math Group: Development/Libraries @@ -10,6 +10,10 @@ URL: http://eigen.tuxfamily.org/index.php?title=Main_Page # Renamed source file so it's not just a version number Source0: eigen-%{version}.tar.bz2 Patch0: eigen3_unused-typedefs.patch +# Fix for Upstream bug 554: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=554 +# Derived from hg changeset https://bitbucket.org/eigen/eigen/commits/21273ebd6b4d/ +# Should fix rhbz 978971 +Patch1: eigen3-3.1.3-memalign.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -43,6 +47,7 @@ Provides: %{name}-static = %{version}-%{release} %prep %setup -q -n eigen-eigen-2249f9c22fe8 %patch0 -p1 +%patch1 -p1 %build mkdir %{_target_platform} @@ -70,6 +75,9 @@ rm -rf %{buildroot} %{_datadir}/pkgconfig/* %changelog +* Sat Jun 29 2013 Rich Mattes - 3.1.3-2 +- Add upstream patch to fix malloc/free bugs (rhbz#978971) + * Fri Apr 19 2013 Sandro Mani - 3.1.3-1 - Update to release 3.1.3 - Add patch for unused typedefs warning with gcc4.8