简体   繁体   English

法兰对Matlab的依赖-MEX

[英]flann dependency to matlab - MEX

I faced below error when I tried to install the flann library from the source on the ubuntu machine. 当我尝试从ubuntu机器上的源代码安装flann库时,遇到以下错误。

/flann-master/src [72] mkdir build / flann-master / src [72] mkdir构建

/flann-master/src [73] cd build / flann-master / src [73]光盘生成

/flann-master/src/build [74] cmake .. / 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. 位于cpp / CMakeLists.txt:3(add_definitions)的CMake警告(dev):未设置策略CMP0005:预处理程序定义值现在自动转义。 Run "cmake --help-policy CMP0005" for policy details. 运行“ cmake --help-policy CMP0005”以获取策略详细信息。 Use the cmake_policy command to set the policy and suppress this warning. 使用cmake_policy命令设置策略并禁止显示此警告。 This warning is for project developers. 此警告是针对项目开发人员的。 Use -Wno-dev to suppress it. 使用-Wno-dev禁止它。

CMake Error at cpp/CMakeLists.txt:114 (install): install TARGETS given no LIBRARY DESTINATION for shared library target "flann_cpp". 在cpp / CMakeLists.txt:114上的CMake错误:(安装):为共享库目标“ flann_cpp”提供没有库目标的安装目标。

CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. CMakeLists.txt中的CMake警告(dev):不存在cmake_minimum_required命令。 A line of code such as 一行代码,例如

cmake_minimum_required(VERSION 2.8) cmake_minimum_required(版本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. 如果您希望此项目支持较旧的CMake版本,则指定的版本可能会更低。 For more information run "cmake --help-policy CMP0000". 有关更多信息,请运行“ cmake --help-policy CMP0000”。 This warning is for project developers. 此警告是针对项目开发人员的。 Use -Wno-dev to suppress it. 使用-Wno-dev禁止它。

-- Configuring incomplete, errors occurred! -配置不完整,发生错误!

/flann-master/src/build [75] / 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. 我应该在根目录中(包含bin,src,examples等),它已经解决了。 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. 因此,我在flann(flanninstall)之外创建了一个新目录,并尝试使用以下命令。

cmake -DCMAKE_INSTALL_PREFIX=/home/eson/matlab/flanninstall/ .. 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. 我希望它可以帮助我在主目录中生成文件,并且可以将其复制或链接到matlab。 However, I copy the files from this address to current directory that I am working on my script in matlab. 但是,我将文件从该地址复制到正在使用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" -> 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-指针-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. 最近的邻居:cpp:35:致命错误:flann / flann.h:没有终止此类文件或目录的编译。

mex: compile of ' "nearest_neighbors.cpp"' failed. 混合:编译““ nearest_neighbors.cpp””失败。

Error using mex (line 206) Unable to complete successfully. 使用mex时出错(第206行)无法成功完成。

Earlier @rayryeng helped me on the MEX setup but when I try to run below command I faced earlier problem. 较早的@rayryeng帮助我进行了MEX设置,但是当我尝试在命令下运行时,遇到了较早的问题。

mex -v -O nearest_neighbors.cpp 混合-v -O最近的邻居.cpp

I appreciate your advice. 感谢您的建议。

I just found out that I need to set the LD_LIBRARY_PATH in linux for my user. 我刚刚发现我需要在Linux中为我的用户设置LD_LIBRARY_PATH。 The command will be : 该命令将是:

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

This is different path that normal path that you should add if you have root access or sudo access on your machine. 如果您在计算机上具有root用户访问权限或sudo访问权限,则此路径与应添加的常规路径不同。 That would be something similar to below line: 那将类似于下面的代码:

export LD_LIBRARY_PATH="/Your_build/build/lib:$LD_LIBRARY_PATH" 导出LD_LIBRARY_PATH =“ / Your_build / build / lib:$ LD_LIBRARY_PATH”

The above path should not be completely right, because it could be something that start with /usr/local/ or /usr/include/ . 上面的路径可能不完全正确,因为它可能是以/ usr / local /或/ usr / include /开头的。 If I understand the exact path for general case or others have the complete answer, I will update it. 如果我了解一般情况的确切路径,或者其他人有完整的答案,则将对其进行更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM