Cmake compiler error ANN library not found - cmake

I tried to compile this repository link but I am stuck with CMake Error: ann_LIBRARIES not found. While searching in the inernet I found ANN link which I build but I don't know how to give the absolute path in Cmake file. And also I installed libflann1.9 and libflann-dev but still I am having the same problem.
I have ubuntu 18.04 and qt5, boost lib, blas & lapack and libpng libraries are installed.
cmake ..
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- serialization
-- filesystem
-- system
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'libxml++-2.6'
-- Found libxml++-2.6, version 2.40.1
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- system
-- filesystem
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- thread
-- chrono
-- system
-- date_time
-- atomic
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- filesystem
-- system
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.34")
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- filesystem
-- thread
-- system
-- chrono
-- date_time
-- atomic
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- filesystem
-- thread
-- serialization
-- program_options
-- regex
-- system
-- chrono
-- date_time
-- atomic
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- filesystem
-- program_options
-- regex
-- system
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- filesystem
-- program_options
-- system
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- filesystem
-- program_options
-- regex
-- system
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ann_LIBRARIES
linked by target "TrackingUtils" in directory /home/dhiren/Dev/FranksVelodyneAlgos/libTrackingUtils
-- Configuring incomplete, errors occurred!
See also "/home/dhiren/Dev/FranksVelodyneAlgos/build/CMakeFiles/CMakeOutput.log".
See also "/home/dhiren/Dev/FranksVelodyneAlgos/build/CMakeFiles/CMakeError.log".
Thank you

Finally, I was able to compile the codebase
My procedures are given follows:
First I tried to compile the source code in ubuntu 18.04 but got stuck with so many errors, so I tried in ubuntu 14.04 (docker).
I installed the required packages as the author mentioned.
Now I stuck with ann_LIBRARIES problem, so for that, I downloaded ANN library from link and build by simply performing make linux-g++ from inside ann_1.1.2 folder
Now ANN library is ready to use. After that to avoid the ann_LIBRARIES problem while building process, we should perform command from terminal cmake -Dann_LIBRARIES=/home/ann_1.1.2/lib/libANN.a ..
Now so far I build the project sucessfully. Now time to compile the code using make command, again I got ANN/ANN.h: No such file or directory error which I resolved by giving absulute path #include </home/ann_1.1.2/include/ANN/ANN.h> //approximate) nearest neighbor from each file where the error arose. Obviously providing absolute path is not a good idea. That's it
Thanks to #Tsyvarev
Hope this will help somebody.

Related

CMake error while trying to install gr-osmosdr

I've been trying to install gr-osmosdr for quite some time but I never get to end the installation process. I've followed the steps on https://github.com/osmocom/gr-osmosdr
which show how to install gr-osmosdr via cmake. After cloning and building the "build" directory, it's time for cmake to do its job. It is at this step that things begin to fail. I get the following error:
CMake Warning (dev) at /home/victor/.local/lib/python2.7/site-packages/cmake/data/share/cmake-3.18/Modules/GNUInstallDirs.cmake:225 (message):
Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
target architecture is known. Please enable at least one language before
including GNUInstallDirs.
Call Stack (most recent call first):
CMakeLists.txt:24 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- The CXX compiler identification is GNU 5.4.0
-- The C compiler identification is GNU 5.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Build type not specified: defaulting to release.
CMake Error at CMakeLists.txt:44 (find_package):
Could not find a configuration file for package "Gnuradio" that is
compatible with requested version "3.8".
The following configuration files were considered but not accepted:
/usr/lib/x86_64-linux-gnu/cmake/gnuradio/GnuradioConfig.cmake, version: 3.7.9.1
-- Configuring incomplete, errors occurred!
See also "/home/victor/gr-osmosdr/build/CMakeFiles/CMakeOutput.log".
At this point I'm unable to continue the installation process. I'm running Ubuntu 16.04.7 LTS and GNU Radio 3.7.9.
Thanks
The error message is quite descriptive: You're trying to build a modern GNU Radio 3.8-compatible gr-osmosdr with an ancient GNU Radio 3.7.9.1. Won't work. You could try building an outdated version of gr-osmosdr, but really, instead you should just upgrade to Ubuntu 20.04.
There, you can just
sudo apt install gnuradio gr-osmosdr
and don't have to build anything yourself (it will just work!).

CMake cannot find OpenMPI head file when I Install it by using conda

I am not very familiar with installing package by conda. I install the OpenMPI by conda install -c conda-forge/label/gcc7 openmpi. After that I write the following CMakeLists.txt file
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(CUDA_MPI LANGUAGES CXX CUDA)
find_package(CUDA REQUIRED)
find_package(MPI REQUIRED)
add_library(Timer STATIC timer.h
timer.cpp)
add_library(Coll STATIC collectives.h
collectives.cu)
add_executable(CUDA_MPI ${CMAKE_CURRENT_SOURCE_DIR}/test/test.cpp)
include_directories(/usr/lib/x86_64-linux-gnu/openmpi/include)
target_link_libraries(CUDA_MPI PUBLIC Timer Coll MPI::MPI_CXX ${CUDA_LIBRARIES})
My configuration log is as the following. It seems that CMake tool can find the library of OpenMPI but it cannot find the head file.
-- The CXX compiler identification is GNU 7.3.0
-- The CUDA compiler identification is NVIDIA 10.0.130
-- Check for working CXX compiler: /home/szhangcj/.conda/envs/distributed/bin/x86_64-conda_cos6-linux-gnu-c++
-- Check for working CXX compiler: /home/szhangcj/.conda/envs/distributed/bin/x86_64-conda_cos6-linux-gnu-c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found version "10.0")
-- Found MPI_CXX: /home/szhangcj/.conda/envs/distributed/lib/libmpi_cxx.so (found version "3.1")
-- Found MPI: TRUE (found version "3.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/szhangcj/HPC/MPI/baidu-allreduce/build
The error message from the generating stage is as the following.
Scanning dependencies of target Timer
[ 14%] Building CXX object CMakeFiles/Timer.dir/timer.cpp.o
[ 28%] Linking CXX static library libTimer.a
[ 28%] Built target Timer
Scanning dependencies of target Coll
[ 42%] Building CUDA object CMakeFiles/Coll.dir/collectives.cu.o
/home/szhangcj/HPC/MPI/baidu-allreduce/collectives.cu:9:10: fatal error: mpi.h: No such file or directory
#include <mpi.h>
^~~~~~~
compilation terminated.
CMakeFiles/Coll.dir/build.make:62: recipe for target 'CMakeFiles/Coll.dir/collectives.cu.o' failed
make[2]: *** [CMakeFiles/Coll.dir/collectives.cu.o] Error 1
CMakeFiles/Makefile2:147: recipe for target 'CMakeFiles/Coll.dir/all' failed
make[1]: *** [CMakeFiles/Coll.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I have checked the installation directory and I found that there is no include directory under the openmpi folder. How can I fix this?
What's more, on another machine, I repeat the same process to install the Openmpi by using conda. After that, I even cannot find the MPI library.

CMake doesn't pass CUDA arguments?

I am trying to compile a library with both, C++ and CUDA source files. I am using GNU make with CMake. My compiler of choice is clang, since CUDA only supports gcc up to version 5 and Debian 9 has gcc 6 as its oldest version and I have to use software that is provided by the Debian 9 or 10 repositories.
CMake version is 3.9.0
clang version is 3.8.1
cc and c++ in /usr/bin correctly link to clang and clang++ ẃhich also link to the correct files.
Unfortunately the initial checks of CMake for CUDA fail although everything, as far as I can see, seems to be set up correctly. It looks like the arguments aren't passed correctly to the CUDA compiler.
This is a part of my project's main CMake file:
cmake_minimum_required (VERSION 3.9.0 FATAL_ERROR)
project (dev)
find_package(CUDA REQUIRED)
set(CUDA_HOST_COMPILATION_CPP ON)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -Wno-deprecated-gpu-targets -ccbin clang-3.8")
The library's CMake file looks like this:
cmake_minimum_required(VERSION 3.9.0 FATAL_ERROR)
project (libname LANGUAGES CXX CUDA)
file(GLOB SOURCES "*.cu" "*.cpp")
add_library(libname ${SOURCES})
set_target_properties(libname PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_target_properties(libname PROPERTIES POSITION_INDEPENDENT_CODE ON)
This is the output of CMake:
-- The C compiler identification is Clang 3.8.1
-- The CXX compiler identification is Clang 3.8.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr (found version "8.0")
-- The CUDA compiler identification is unknown
-- Check for working CUDA compiler: /usr/bin/nvcc
-- Check for working CUDA compiler: /usr/bin/nvcc -- broken
The CUDA/nvcc tests of CMake fails with the following errors:
Change Dir: /home/user/projects/hamonIC-linux-experimental/current_state/working_copy/code/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_6d1a9/fast"
/usr/bin/make -f CMakeFiles/cmTC_6d1a9.dir/build.make
CMakeFiles/cmTC_6d1a9.dir/build
make[1]: Entering directory
'/home/user/projects/hamonIC-linux-experimental/current_state/working_copy/code/build/CMakeFiles/CMakeTmp'
Building CUDA object CMakeFiles/cmTC_6d1a9.dir/main.cu.o
/usr/bin/nvcc -x cu -c
/home/user/projects/hamonIC-linux-experimental/current_state/working_copy/code/build/CMakeFiles/CMakeTmp/main.cu
-o CMakeFiles/cmTC_6d1a9.dir/main.cu.o
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are
deprecated, and may be removed in a future release (Use
-Wno-deprecated-gpu-targets to suppress warning).
ERROR: No supported gcc/g++ host compiler found, but clang-3.8 is
available.
Use 'nvcc -ccbin clang-3.8' to use that instead.
CMakeFiles/cmTC_6d1a9.dir/build.make:65: recipe for target
'CMakeFiles/cmTC_6d1a9.dir/main.cu.o' failed
make[1]: *** [CMakeFiles/cmTC_6d1a9.dir/main.cu.o] Error 1
make[1]: Leaving directory
'/home/user/projects/hamonIC-linux-experimental/current_state/working_copy/code/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_6d1a9/fast' failed
make: *** [cmTC_6d1a9/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
hic_iplibrary/source/ciccommon/CMakeLists.txt:7 (project)
The CUDA NVCC flags in CMake have to be semicolon delimited and not whitespace delimited.
Change the flags in your CMakeLists.txt to use:
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-Wno-deprecated-gpu-targets;-ccbin=clang-3.8")
and that should allow CMake to pass your flags to NVCC.

CMake Error: Unsupported architecture -- ppc64. On PowerPC Ubuntu

I have PowerMac G5. I install Lubuntu xenial on it. Now I try to build database Tarantool from source.
Onthe step cmake . I have the following error:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - big endian
CMake Error at cmake/arch.cmake:19 (message):
Unsupported architecture -- ppc64,
Call Stack (most recent call first):
CMakeLists.txt:46 (include)
-- Configuring incomplete, errors occurred!
See also "/home/zlon/tarantool/CMakeFiles/CMakeOutput.log".
See also "/home/zlon/tarantool/CMakeFiles/CMakeError.log".
Is it possible to fix this error or have have no chances with Linux on PowerPC?

CMake does not find compiler with C++11 support

I am trying to install the FANN library for use in a project. I am using this as my guide but when I run cmake ., I receive this:
`$ cmake .
-- FANN is used as APPLICATION_NAME
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Could NOT find OpenMP (missing: OpenMP_CXX_FLAGS)
-- The compiler /usr/bin/c++ has no C++0x, C++11 or C++14 support. FANN will still work with no problem, but the tests will not be able to compile.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/marvin/fann`
even if I have gcc/g++ 4.9 installed. Looking at the instructions from Git hub, the output when running cmake . should be something like this:
`-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- FANN is used as APPLICATION_NAME
-- 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
-- Found PythonInterp: /home/cobalt/anaconda3/bin/python (found version "3.4.3")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Performing Test COMPILER_SUPPORTS_CXX14
-- Performing Test COMPILER_SUPPORTS_CXX14 - Success
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- The compiler /usr/bin/c++ has C++14 support.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cobalt/repos/fann`
any help?
Even though you have gcc-4.9 installed it's probably not in the standard location, or you have your environment variable CXX pointing to /usr/bin/c++ which is another compiler.
Try running cmake -D CMAKE_CXX_COMPILER /path/to/your/g++-4.9/binary" ..