0

I faced below error when I tried to install the flann library from the source on the ubuntu machine.

/flann-master/src [72] mkdir build

/flann-master/src [73] cd build

/flann-master/src/build [74] cmake ..

CMake Warning (dev) at cpp/CMakeLists.txt:3 (add_definitions): Policy CMP0005 is not set: Preprocessor definition values are now escaped automatically. Run "cmake --help-policy CMP0005" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Error at cpp/CMakeLists.txt:114 (install): install TARGETS given no LIBRARY DESTINATION for shared library target "flann_cpp".

CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.8)

should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000". This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!

/flann-master/src/build [75]

The solution to this was mentioned in another question. I should be in the root directory (containing bin, src, examples etc) and it solved. And there is another missing part in the documentation that I should run

make install

As I am sudoer on the remote machine, I need to install it on my home directory. So, I created a new directory outside of the flann (flanninstall) and I tried below command.

cmake -DCMAKE_INSTALL_PREFIX=/home/eson/matlab/flanninstall/ ..

I hope it helps me to generate the files in my home directory and I can copy or link them to matlab. However, I copy the files from this address to current directory that I am working on my script in matlab. I still get below error.

-> g++-4.4 -c -I/usr/local/MATLAB/2012a/extern/include -I/usr/local/MATLAB/2012a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O -DNDEBUG "nearest_neighbors.cpp"

nearest_neighbors.cpp:35: fatal error: flann/flann.h: No such file or directory compilation terminated.

mex: compile of ' "nearest_neighbors.cpp"' failed.

Error using mex (line 206) Unable to complete successfully.

Earlier @rayryeng helped me on the MEX setup but when I try to run below command I faced earlier problem.

mex -v -O nearest_neighbors.cpp

I appreciate your advice.

4

1 回答 1

0

我刚刚发现我需要在 linux 中为我的用户设置 LD_LIBRARY_PATH。命令将是:

导出 LD_LIBRARY_PATH="/home/eson/alg/matlab/flanninstall/lib:$LD_LIBRARY_PATH"

如果您在计算机上具有 root 访问权限或 sudo 访问权限,则该路径与您应该添加的正常路径不同。这将类似于以下行:

导出 LD_LIBRARY_PATH="/Your_build/build/lib:$LD_LIBRARY_PATH"

上面的路径不应该完全正确,因为它可能是以 /usr/local/ 或 /usr/include/ 开头的东西。如果我了解一般情况的确切路径或其他人有完整的答案,我会更新它。

于 2015-03-19T18:31:33.577 回答