gnu: flann: Fix builds with CMake >= 3.11.
* gnu/packages/patches/flann-cmake-3.11.patch: New file. * gnu/packages/maths.scm (flann)[source]: Use it. * gnu/local.mk (dist_patch_DATA): Add it.
This commit is contained in:
parent
feed5194b1
commit
b5edc47912
|
@ -670,6 +670,7 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/file-CVE-2017-1000249.patch \
|
%D%/packages/patches/file-CVE-2017-1000249.patch \
|
||||||
%D%/packages/patches/findutils-localstatedir.patch \
|
%D%/packages/patches/findutils-localstatedir.patch \
|
||||||
%D%/packages/patches/findutils-test-xargs.patch \
|
%D%/packages/patches/findutils-test-xargs.patch \
|
||||||
|
%D%/packages/patches/flann-cmake-3.11.patch \
|
||||||
%D%/packages/patches/flint-ldconfig.patch \
|
%D%/packages/patches/flint-ldconfig.patch \
|
||||||
%D%/packages/patches/fltk-shared-lib-defines.patch \
|
%D%/packages/patches/fltk-shared-lib-defines.patch \
|
||||||
%D%/packages/patches/fltk-xfont-on-demand.patch \
|
%D%/packages/patches/fltk-xfont-on-demand.patch \
|
||||||
|
|
|
@ -3372,7 +3372,8 @@ in finite element programs.")
|
||||||
version "-src.zip"))
|
version "-src.zip"))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
"022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
|
"022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))
|
||||||
|
(patches (search-patches "flann-cmake-3.11.patch"))))
|
||||||
(build-system cmake-build-system)
|
(build-system cmake-build-system)
|
||||||
(outputs '("out"
|
(outputs '("out"
|
||||||
"octave")) ;46 MiB .mex file that pulls Octave
|
"octave")) ;46 MiB .mex file that pulls Octave
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
Fixes this issue:
|
||||||
|
<https://github.com/mariusmuja/flann/issues/369>.
|
||||||
|
Patch from Buildroot:
|
||||||
|
<https://github.com/buildroot/buildroot/commit/45a39b3e2ba42b72d19bfcef30db1b8da9ead51a>.
|
||||||
|
|
||||||
|
From fa5ec96a94646492a3f908e12905b3e48a8e800b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Romain Naour <romain.naour@gmail.com>
|
||||||
|
Date: Wed, 18 Apr 2018 20:24:13 +0200
|
||||||
|
Subject: [PATCH] src/cpp: fix cmake >= 3.11 build
|
||||||
|
|
||||||
|
CMake < 3.11 doesn't support add_library() without any source file
|
||||||
|
(i.e add_library(foo SHARED)). But flann CMake use a trick that use
|
||||||
|
an empty string "" as source list (i.e add_library(foo SHARED "")).
|
||||||
|
This look like a bug in CMake < 3.11.
|
||||||
|
|
||||||
|
With CMake >= 3.11, the new behaviour of add_library() break the
|
||||||
|
existing flann CMake code.
|
||||||
|
|
||||||
|
From CMake Changelog [1]:
|
||||||
|
"add_library() and add_executable() commands can now be called without
|
||||||
|
any sources and will not complain as long as sources are added later
|
||||||
|
via the target_sources() command."
|
||||||
|
|
||||||
|
Note: flann CMake code doesn't use target_sources() since no source file
|
||||||
|
are provided intentionally since the flann shared library is created by
|
||||||
|
linking with the flann_cpp_s static library with this line:
|
||||||
|
|
||||||
|
target_link_libraries(flann_cpp -Wl,-whole-archive flann_cpp_s -Wl,-no-whole-archive)
|
||||||
|
|
||||||
|
If you try to use "add_library(flann_cpp SHARED ${CPP_SOURCES})" (as it should
|
||||||
|
be normally done), the link fail due to already defined symbol.
|
||||||
|
|
||||||
|
They are building the shared version using the static library "to speedup the
|
||||||
|
build time" [3]
|
||||||
|
|
||||||
|
This issue is already reported upstream [2] with a proposed solution.
|
||||||
|
|
||||||
|
Upstream status: Pending
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
http://autobuild.buildroot.net/results/b2f/b2febfaf8c44ce477b3e4a5b9b976fd25e8d7454
|
||||||
|
|
||||||
|
[1] https://cmake.org/cmake/help/v3.11/release/3.11.html
|
||||||
|
[2] https://github.com/mariusmuja/flann/issues/369
|
||||||
|
[3] https://github.com/mariusmuja/flann/commit/0fd62b43be2fbb0b8d791ee36290791224dc030c
|
||||||
|
|
||||||
|
Signed-off-by: Romain Naour <romain.naour@gmail.com>
|
||||||
|
---
|
||||||
|
src/cpp/CMakeLists.txt | 4 ++--
|
||||||
|
src/cpp/empty.cpp | 1 +
|
||||||
|
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||||
|
create mode 100644 src/cpp/empty.cpp
|
||||||
|
|
||||||
|
diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
|
||||||
|
index b44a735..a816863 100644
|
||||||
|
--- a/src/cpp/CMakeLists.txt
|
||||||
|
+++ b/src/cpp/CMakeLists.txt
|
||||||
|
@@ -29,7 +29,7 @@ if (BUILD_CUDA_LIB)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
- add_library(flann_cpp SHARED "")
|
||||||
|
+ add_library(flann_cpp SHARED "empty.cpp")
|
||||||
|
set_target_properties(flann_cpp PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
|
target_link_libraries(flann_cpp -Wl,-whole-archive flann_cpp_s -Wl,-no-whole-archive)
|
||||||
|
|
||||||
|
@@ -85,7 +85,7 @@ if (BUILD_C_BINDINGS)
|
||||||
|
set_property(TARGET flann_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC)
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
- add_library(flann SHARED "")
|
||||||
|
+ add_library(flann SHARED "empty.cpp")
|
||||||
|
set_target_properties(flann PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
|
target_link_libraries(flann -Wl,-whole-archive flann_s -Wl,-no-whole-archive)
|
||||||
|
else()
|
||||||
|
diff --git a/src/cpp/empty.cpp b/src/cpp/empty.cpp
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..40a8c17
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/cpp/empty.cpp
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+/* empty */
|
||||||
|
--
|
||||||
|
2.14.3
|
Loading…
Reference in New Issue