Package Details: flann 1.9.1-3

Git Clone URL: (read-only)
Package Base: flann
Description: FLANN is a library for performing fast approximate nearest neighbor searches in high dimensional spaces
Upstream URL:
Licenses: BSD
Submitter: None
Maintainer: racko (GPereira)
Last Packager: GPereira
Votes: 39
Popularity: 1.764910
First Submitted: 2011-04-05 02:06
Last Updated: 2018-05-09 09:14

Dependencies (7)

Required by (8)

Sources (1)

Latest Comments

wdna commented on 2018-05-23 06:28

@kartikmohta I wish to investigate this, It's clearly there's some kind of conflict between this patch and other packages. I've just got the feeling this is legacy related stuff and should be fixed somewhere else up the tree.

There's also an option to have another package flann-legacy or something. would you like that?

kartikmohta commented on 2018-05-13 19:34

I think the lz4 patch is still required. Using flann and system lz4 in a program causes a compile error:

/usr/include/flann/ext/lz4.h:196:57: error: typedef redefinition with different types ('struct LZ4_stream_t' vs 'union LZ4_stream_u')
typedef struct { long long table[LZ4_STREAMSIZE_U64]; } LZ4_stream_t;
/usr/include/lz4.h:238:28: note: previous definition is here
typedef union LZ4_stream_u LZ4_stream_t;   /* incomplete type (defined later) */

wdna commented on 2018-05-09 09:06

@jerry73204 I have a PKGBUILD that fixes this issue and also removes the lz4 patch. this does not require changes in sources uses sed instead.

# Maintainer: Tim Rakowski <>
# Contributor: Sven-Hendrik Haase <>
# Contributor: Javier Fuentes <>
# Contributor: Figo.zhang <>
# Contributor: hauptmech

pkgdesc="FLANN is a library for performing fast approximate nearest neighbor searches in high dimensional spaces"
arch=('i686' 'x86_64')
depends=('lz4' 'hdf5')
makedepends=('cmake' 'python2' 'texlive-core')
optdepends=('python2: python bindings'
            'cuda: cuda support')

prepare() {
  cd "$srcdir/flann-${pkgver}"

  sed -i "s|setup\.py install| install --root=$pkgdir --optimize=1|" src/python/CMakeLists.txt

  touch src/cpp/empty.cpp
  sed -i -e 's/flann_cpp SHARED \"\"/flann_cpp SHARED \"empty\.cpp\"/g' src/cpp/CMakeLists.txt
  sed -i -e 's/flann SHARED \"\"/flann SHARED \"empty\.cpp\"/g' src/cpp/CMakeLists.txt

build() {
  cd "$srcdir/flann-${pkgver}"

  #[[ -d build ]] && rm -r build
  mkdir -p build && cd build
  cmake .. \
      -DCMAKE_BUILD_TYPE=Release \
      -DPYTHON_EXECUTABLE=/usr/bin/python2 \
  make doc

package() {
  cd "$srcdir/flann-${pkgver}"

  cd build
  make DESTDIR="$pkgdir" install

  #install license file
  install -D -m644 ../COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

jerry73204 commented on 2018-05-07 16:24

My build ended up with the error message.

CMake Error at src/cpp/CMakeLists.txt:32 (add_library):
  No SOURCES given to target: flann_cpp`

Please add the patch to fix it up. It goes after system_lz4.patch. Thanks.

diff -Naur original/src/cpp/CMakeLists.txt patched/src/cpp/CMakeLists.txt
--- original/src/cpp/CMakeLists.txt 2018-05-08 00:18:24.009183841 +0800
+++ patched/src/cpp/CMakeLists.txt  2018-05-08 00:20:07.083178084 +0800
@@ -29,7 +29,7 @@

-    add_library(flann_cpp SHARED "")
+    add_library(flann_cpp SHARED "empty.cpp")
     set_target_properties(flann_cpp PROPERTIES LINKER_LANGUAGE CXX)
@@ -88,7 +88,7 @@

-        add_library(flann SHARED "")
+        add_library(flann SHARED "empty.cpp")
         set_target_properties(flann PROPERTIES LINKER_LANGUAGE CXX)
diff -Naur original/src/cpp/empty.cpp patched/src/cpp/empty.cpp
--- original/src/cpp/empty.cpp  1970-01-01 08:00:00.000000000 +0800
+++ patched/src/cpp/empty.cpp   2018-05-08 00:17:33.999112408 +0800
@@ -0,0 +1 @@
+/* empty */

GPereira commented on 2018-04-25 22:42

Hi, you need to add lz4 to the target_link_libraries. Can I comantain this package with you?

bartus commented on 2018-04-09 08:02

@racko: please update flans pkgconfig file (flann.pc) to include -llz4, it prevents successful building of openmvg-git package witch depends on pkgconfig for setting linker flags.

clynamen commented on 2018-03-25 21:31

the static libraries libflann_s.a and libflann_cpp.a are not copied in the built package

racko commented on 2018-03-06 21:49

Fixed. I messed up the library order in the target_link_libraries call. The linker would think that lz4 is unneeded. Since "--as-needed" is included in LDFLAGS in the default /etc/makepkg.conf, lz4 was removed.

I removed "--as-needed" a long time ago because some other AUR package messed up, so the error didn't occur on my main machine.

Thanks for bringing up the issue again.

racko commented on 2018-03-06 06:27

Hmm ... I can reproduce this now as well.

Even after building with make VERBOSE=1 and seeing (note -llz4)

c++ -fPIC -march=native -O3 -pipe -fstack-protector-strong -fopenmp -O3 -DNDEBUG -Wl,-O1,--sort-common,--as-needed,-z,relro -shared -Wl,-soname, -o ../../lib/  -llz4 -Wl,-whole-archive ../../lib/libflann_s.a -Wl,-no-whole-archive

the resulting still does not list an lz4 dependency :(

I am looking into it.

subhuman22 commented on 2018-03-06 03:20

The resulting still omits dependency on system liblz4

    $ ldd /usr/lib/ (0x00007ffe6fdf5000) => /usr/lib/ (0x00007f0554eb1000) => /usr/lib/ (0x00007f0554b65000) => /usr/lib/ (0x00007f0554937000) => /usr/lib/ (0x00007f0554720000) => /usr/lib/ (0x00007f0554369000)
    /usr/lib64/ (0x00007f0555978000) => /usr/lib/ (0x00007f0554165000) => /usr/lib/ (0x00007f0553f47000)

As a temporary fix, you can just use src/cpp/ext/lz4... by removing patch lines in PKGBUILD. Not sure this can be a problem in the future.

All comments