flann-lib / flann

Fast Library for Approximate Nearest Neighbors
http://people.cs.ubc.ca/~mariusm/flann
Other
2.25k stars 647 forks source link

FLANN installation issue. #117

Open philsanti opened 11 years ago

philsanti commented 11 years ago

Hi,

I got the HDF5 and the gtest dependencies installed on my ubuntu 12.04, but after I run make I don't get the flann.hpp. Am I doing something wrong?

The make output for my installation produced:

hilips@teamAlpha:~/Downloads/flann-1.8.4-src/build$ cmake .. CMake Warning at src/matlab/CMakeLists.txt:79 (message): Cannot find MATLAB or Octave instalation. Make sure that the 'bin' directory from the MATLAB instalation or that mkoctfile is in PATH

-- Install prefix: /usr/local -- Build type: RelWithDebInfo -- Building C bindings: ON -- Building python bindings: ON -- Building matlab bindings: ON -- Building CUDA library: OFF -- Using OpenMP support: ON -- Using MPI support: OFF -- Configuring done -- Generating done -- Build files have been written to: /home/philips/Downloads/flann-1.8.4-src/build

philips@teamAlpha:~/Downloads/flann-1.8.4-src/build$ make Scanning dependencies of target flann_s [ 25%] Building CXX object src/cpp/CMakeFiles/flann_s.dir/flann/flann.cpp.o Linking CXX static library ../../lib/libflann_s.a [ 25%] Built target flann_s Scanning dependencies of target flann Linking CXX shared library ../../lib/libflann.so [ 25%] Built target flann Scanning dependencies of target flann_cpp_s [ 50%] Building CXX object src/cpp/CMakeFiles/flann_cpp_s.dir/flann/flann_cpp.cpp.o Linking CXX static library ../../lib/libflann_cpp_s.a [ 50%] Built target flann_cpp_s Scanning dependencies of target flann_cpp Linking CXX shared library ../../lib/libflann_cpp.so [ 50%] Built target flann_cpp Scanning dependencies of target flann_example_cpp [ 75%] Building CXX object examples/CMakeFiles/flann_example_cpp.dir/flann_example.cpp.o Linking CXX executable ../bin/flann_example_cpp [ 75%] Built target flann_example_cpp Scanning dependencies of target flann_example_c [100%] Building C object examples/CMakeFiles/flann_example_c.dir/flann_example.c.o In file included from /usr/include/stdio.h:934:0, from /home/philips/Downloads/flann-1.8.4-src/examples/flann_example.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h: In function ‘read_points’: /home/philips/Downloads/flann-1.8.4-src/examples/flann_example.c:31:19: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result] Linking CXX executable ../bin/flann_example_c [100%] Built target flann_example_c Scanning dependencies of target examples [100%] Built target examples

If anyone can offer any insight I'd greatly appreciate it. I didn't turn off the bindings for MATLAB and Python because I didn't know if I would use them in the future. I didn't receive any errors though in the make, so I was curious if anyone had a fix for this.

Thanks.

mariusmuja commented 11 years ago

FLANN seems to compile fine for you, I'm not sure I understand what the problem is. The flann.hpp file is one of the FLANN source files, is located in src/cpp/flann/flann.cpp and after a 'make install' will be installed in CMAKE_INSTALL_PREFIX/include/flann/flann.hpp.

On Thu, Jul 11, 2013 at 8:49 AM, philsanti notifications@github.com wrote:

Hi,

I got the HDF5 and the gtest dependencies installed on my ubuntu 12.04, but after I run make I don't get the flann.hpp. Am I doing something wrong?

The make output for my installation produced:

hilips@teamAlpha:~/Downloads/flann-1.8.4-src/build$ cmake .. CMake Warning at src/matlab/CMakeLists.txt:79 (message): Cannot find MATLAB or Octave instalation. Make sure that the 'bin' directory from the MATLAB instalation or that mkoctfile is in PATH

-- Install prefix: /usr/local -- Build type: RelWithDebInfo -- Building C bindings: ON -- Building python bindings: ON -- Building matlab bindings: ON -- Building CUDA library: OFF -- Using OpenMP support: ON -- Using MPI support: OFF -- Configuring done -- Generating done -- Build files have been written to: /home/philips/Downloads/flann-1.8.4-src/build

philips@teamAlpha:~/Downloads/flann-1.8.4-src/build$ make Scanning dependencies of target flann_s [ 25%] Building CXX object src/cpp/CMakeFiles/flann_s.dir/flann/flann.cpp.o Linking CXX static library ../../lib/libflann_s.a [ 25%] Built target flann_s Scanning dependencies of target flann Linking CXX shared library ../../lib/libflann.so [ 25%] Built target flann Scanning dependencies of target flann_cpp_s [ 50%] Building CXX object src/cpp/CMakeFiles/flann_cpp_s.dir/flann/flann_cpp.cpp.o Linking CXX static library ../../lib/libflann_cpp_s.a [ 50%] Built target flann_cpp_s Scanning dependencies of target flann_cpp Linking CXX shared library ../../lib/libflann_cpp.so [ 50%] Built target flann_cpp Scanning dependencies of target flann_example_cpp [ 75%] Building CXX object examples/CMakeFiles/flann_example_cpp.dir/flann_example.cpp.o Linking CXX executable ../bin/flann_example_cpp [ 75%] Built target flann_example_cpp Scanning dependencies of target flann_example_c [100%] Building C object examples/CMakeFiles/flann_example_c.dir/flann_example.c.o In file included from /usr/include/stdio.h:934:0, from /home/philips/Downloads/flann-1.8.4-src/examples/flann_example.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h: In function ‘read_points’: /home/philips/Downloads/flann-1.8.4-src/examples/flann_example.c:31:19: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result] Linking CXX executable ../bin/flann_example_c [100%] Built target flann_example_c Scanning dependencies of target examples [100%] Built target examples

If anyone can offer any insight I'd greatly appreciate it. I didn't turn off the bindings for MATLAB and Python because I didn't know if I would use them in the future. I didn't receive any errors though in the make, so I was curious if anyone had a fix for this.

Thanks.

— Reply to this email directly or view it on GitHubhttps://github.com/mariusmuja/flann/issues/117 .

philsanti commented 11 years ago

I see that it made it in the src/cpp/flann/flann.hpp file I must of missed that before, but when I ran make it didn't make it in /usr/include. What I did is just copied the file over from the flann folder and manually copied it to /usr/include. The thing is I'm getting a lot of HDF5 errors. I read the hdf5 package to include was the libhdf5-serial-dev and I also installed libhdf5-serial-1.8.4. I have a picture below of my error.

flann_examples_error

djsutherland commented 11 years ago

@philsanti You're installing to /usr/local (the default, and what CMake says in the "Install prefix" section). So the main header ends up in /usr/local/include/flann/flann.hpp. You should delete /usr/include/flann, and make sure your compiler/linker are looking in /usr/local (e.g. -I/usr/local/include -L/usr/local/lib if you use the gcc or clang command line).

philsanti commented 11 years ago

@dougalsutherland where is the install prefix, because I installed using the instructions on the manual.pdf, and I don't remember seeing that. I will try what you said I want to read that document in case I missed anything else. Thanks for pointing it out.

mariusmuja commented 11 years ago

@philsanti You can set the install prefix with the CMAKE_INSTALL_PREFIX cmake variable. You can either use cmak-gui or ccmake to set it after the configure step, or just use the cmake command with the following arguments:

cmake -DCMAKE_INSTALL_PREFIX=/usr ..
philsanti commented 11 years ago

@mariusmuja I tried what you suggested and douglas suggested, and according to that the library should be installed within my /usr/local/include folder. I don't get any error messages,but the library still isn't installed in the correct location. Is the repository on the PCL library a current version of FLANN?

This is what I get when I run the cmake command:

philips@teamAlpha:~/Downloads/flann-1.8.4-src/build$ sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local/include .. -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Found PythonInterp: /usr/bin/python (found version "2.7.3") -- Found HDF5: debug;/usr/lib/libhdf5.so;optimized;/usr/lib/libhdf5.so -- Found GTest: /usr/lib/libgtest.a -- Try OpenMP C flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Try OpenMP CXX flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Found OpenMP: -fopenmp -- Install prefix: /usr/local/include -- Build type: RelWithDebInfo -- Building C bindings: ON -- Building python bindings: OFF -- Building matlab bindings: OFF -- Building CUDA library: OFF -- Using OpenMP support: ON -- Using MPI support: OFF -- Configuring done -- Generating done -- Build files have been written to: /home/philips/Downloads/flann-1.8.4-src/build

The make output results is the following:

philips@teamAlpha:~/Downloads/flann-1.8.4-src/build$ sudo make Scanning dependencies of target flann_s [ 25%] Building CXX object src/cpp/CMakeFiles/flann_s.dir/flann/flann.cpp.o Linking CXX static library ../../lib/libflann_s.a [ 25%] Built target flann_s Scanning dependencies of target flann Linking CXX shared library ../../lib/libflann.so [ 25%] Built target flann Scanning dependencies of target flann_cpp_s [ 50%] Building CXX object src/cpp/CMakeFiles/flann_cpp_s.dir/flann/flann_cpp.cpp.o Linking CXX static library ../../lib/libflann_cpp_s.a [ 50%] Built target flann_cpp_s Scanning dependencies of target flann_cpp Linking CXX shared library ../../lib/libflann_cpp.so [ 50%] Built target flann_cpp Scanning dependencies of target flann_example_cpp [ 75%] Building CXX object examples/CMakeFiles/flann_example_cpp.dir/flann_example.cpp.o Linking CXX executable ../bin/flann_example_cpp [ 75%] Built target flann_example_cpp Scanning dependencies of target flann_example_c [100%] Building C object examples/CMakeFiles/flann_example_c.dir/flann_example.c.o In file included from /usr/include/stdio.h:934:0, from /home/philips/Downloads/flann-1.8.4-src/examples/flann_example.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h: In function ‘read_points’: /home/philips/Downloads/flann-1.8.4-src/examples/flann_example.c:31:19: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result] Linking CXX executable ../bin/flann_example_c [100%] Built target flann_example_c Scanning dependencies of target examples [100%] Built target examples

The output of /usr/local/include: philips@teamAlpha:/usr/local/include$ ls python2.7

djsutherland commented 11 years ago

@philsanti You also have to run [sudo] make install after compiling, and the install prefix should be just /usr/local, not /usr/local/include. I'd suggest:

cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install

Note that /usr/local is the default install prefix anyway.

philsanti commented 11 years ago

I figured that out about 20 minutes ago and ran that command. Now when I try to run the examples it still produces errors saying undefined reference to H5open and other H5Fclose, basically the picture I posted above.

xiaoxiaobx commented 4 years ago

When installing / flann-1.6.11-src on Ubuntu, the following error occurred in camke: How can I solve it? Thank you!

CMake Error at src/matlab/CMakeLists.txt:71 (message): Cannot find MATLAB or Octave instalation. Make sure that the 'bin' directory from the MATLAB instalation or that mkoctfile is in PATH Install prefix: /usr/local/include Build type: RelWithDebInfo Building C bindings: ON Building python bindings: ON Building matlab bindings: ON Using MPI support: OFF Configuring incomplete, errors occurred!

omkarpatil18 commented 4 years ago

sudo apt install liboctave-dev Running this worked for me (Ubuntu 16).

Then I got another error for using cmake 3.11.0 +

Check this out for that https://github.com/mariusmuja/flann/issues/369

run touch src/cpp/empty.cpp In src/cpp/CMakeLists.txt replace add_library(flann_cpp SHARED "") and add_library(flann SHARED "") with add_library(flann_cpp SHARED empty.cpp) and add_library(flann SHARED empty.cpp)

Hope this helps :)