No rule to make target *.so - c++

I am trying to build this https://github.com/felixendres/rgbdslam_v2 with ROS catkin. However, that shouldn't be that relevant. The error I am getting is with my installation of qt4.
No rule to make target /usr/lib/arm-linux-gnueabihf/libQtGui.so', needed by/home/odroid/catkin_ws/devel/lib/rgbdslam/rgbdslam'. Stop.
I heard else where that this is caused by duplicate library files, but when I do
ldconfig -p | grep libQtGui
I get
libQtGui.so.4 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libQtGui.so.4
libQtGui.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libQtGui.so
How would I fix this build error? I think it has something to do with RGBDSLAM not being designed for arm and searching in the wrong place, but it is only doing a find_package(Qt4 REQUIRED) and include(${QT_USE_FILE})
Edit: Another example:
No rule to make target /usr/lib/libpcl_io.so', needed by/home/odroid/catkin_ws/devel/lib/pcl_ros/convert_pcd_to_image'
I compiled both qt4 and pcl from source and only did sudo make install.

This error means that a second copy of the library is lying around. Run aptitude search to find the extra copy.

Related

No rule to make target `libbrcmEGL.so', needed by `HelloTriangle'

I'm trying to cross-compile an OpenGLES2.0 example HelloTriangle using VisualGDB for the RaspberryPi 3 running Raspbian lite.
I assume I was able to include the libraries libbrcmEGL.so and libbrcmGLESv2.so correctly in my CMakeLists.txt file
because instead of giving me these errors:
c:/sysgcc/raspberry/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -lLIBGLES
c:/sysgcc/raspberry/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -lLIBEGL`
It gives me these errors
make[2]: *** No rule to make target `libbrcmEGL.so', needed by `HelloTriangle'. Stop.`
This is my CMakeLists file:
cmake_minimum_required(VERSION 2.7)
project(HelloTriangle)
set(LIBRARIES_FROM_REFERENCES "")
add_executable(HelloTriangle HelloTriangle.cpp esShapes.c esTransform.c esUtil.c esShader.c)
include_directories(include)
target_link_libraries(HelloTriangle ${CMAKE_BINARY_DIR}/libbrcmGLESv2.so ${CMAKE_BINARY_DIR}/libbrcmEGL.so "${LIBRARIES_FROM_REFERENCES}")
I don't understand what else it needs to make the target. Looking around stack overflow, I saw suggestions to add
LINK_DIRECTORIES(/opt/vc/lib/)
I also tried
target_link_libraries(HelloTriangle /opt/vc/lib/libbrcmGLESv2.so /opt/vc/lib/libbrcmEGL.so "${LIBRARIES_FROM_REFERENCES}")
I also checked that I have these libraries in my sysroot in:
C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot
I still get the same error:
I need some help figuring out what is missing from my CMakeLists.txt
Changed to target_link_libraries(HelloTriangle ${CMAKE_CURRENT_SOURCE_DIR}/lib/libbrcmGLESv2.so ${CMAKE_CURRENT_SOURCE_DIR}/lib/libbrcmEGL.so "${LIBRARIES_FROM_REFERENCES}") and it compiled

Graph-tool: compile and connect to local CGAL library, in Linux? (no sudo)

[Ubuntu]
I have compiled CGAL locally:
/path/to/cgal/
/lib/
libCGAL_Core.so libCGAL_Core.so.13.0.2
libCGAL_ImageIO.so.13 libCGAL.so libCGAL.so.13.0.2
libCGAL_Core.so.13 libCGAL_ImageIO.so
libCGAL_ImageIO.so.13.0.2 libCGAL.so.13
/include/
/CGAL/
version.h compiler_config.h
And I have managed to satisfy all of the graph-tool requirements except cgal (at least all of the requirements checked up to cgal):
./configure --with-boost=/path/to/boost --with-cgal=/path/to/cgal
And I get all successes up and until I get the following error message:
checking for __gmpz_init in -lgmp... yes
checking for __gmpz_init in -lgmp... (cached) yes
checking whether CGAL is available in /path/to/cgal... no
configure: error: CGAL library not found.
// the harshest part is that it seems to be searching in the correct
// directory.
I have tried specifying different points in the cgal build directory. The cgal compilation command I used was (from build directory):
cmake path/to/cgal_src_dir -DCMAKE_BUILD_TYPE=Release;
Next, I tried adding includes:
./configure --with-boost=$boost --with-cgal=path/to/cgal CPPFLAGS="-I path/to/cgal/include -I $HOME/.local/include" LDFLAGS="-L path/to/cgal/lib -L $HOME/.local/lib -Wl,-rpath=$HOME/.local/lib"
I will admit that I don't understand the -Wl,-rpath= part, I copied that from the graph-tool installation guide. The .local/lib folder contains the files for the other components, such as gmp, expat, sparsehash, etc.
This is not exact answer but as asked by OP will help in finishing installation, so please don't vote blindly.
To create debian package of libcgal open your CMakeList.txt and at the end of file add:
#--------------------------------------------------------------------
# Create debian files
#--------------------------------------------------------------------
if (UNIX AND NOT APPLE)
SET(CPACK_GENERATOR "DEB")
SET(CPACK_PACKAGE_NAME "libcgal-all")
SET(CPACK_PACKAGE_VERSION "${CGAL_VERSION}")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ library for computational geometry (development files)\n CGAL (Computational Geometry Algorithms Library) makes the most important of the solutions and methods developed in computational geometry available to users in industry and academia in a C++ library. The goal is to provide easy access to useful, reliable geometric algorithms.\n .\n This package contains the header files and static libraries for libCGAL.so, libCGAL_Core.so, and libCGAL_ImageIO.so. The header files and static libraries for libCGAL_Qt4.so can be found in the package libcgal-qt4-dev.")
SET(CPACK_PACKAGE_CONTACT "bordeo")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev, libboost-thread-dev, libboost-system-dev, libboost-program-options-dev, libgmp10-dev, libmpfr-dev, zlib1g-dev")
SET(CPACK_DEBIAN_PACKAGE_REPLACES "libcgal10, libcgal-dev")
INCLUDE(CPack)
endif()
In case you don't have any dependency remove whole line of SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libcln6, libcln-dev, libreadline6, libreadline6-dev, flex, bison"), and change others as it seems fit.
Now go to the terminal and issue following commands in cgal directory
mkdir build
cd build
cmake-gui ..
# set CMAKE_INSTALL_PREFIX to `~/.local
cmake ..
make -j4
cpack ..
you will find your debian built. Extract or install the debian to ~/.local.
Once this is done go to graph tool directory and start the build like
./configure --prefix="/wherever" --with-boost=/path/to/boost --with-cgal=~/.local
make -j4
make install
Hope this will solve your problem.

CMake not building a library when added as a subdirectory

I added the xgboost library as a git submodule of my project and I'm trying to add it to cmake as a subdirectory. Unfortunately it's not working. A simple hello world project with the following CMakeLists.txt replicates the error that I'm getting.
cmake_minimum_required(VERSION 3.2)
project(foo)
add_subdirectory(xgboost)
add_executable(${PROJECT_NAME} foo.cpp)
target_link_libraries(${PROJECT_NAME} xgboost)
After building the library there is nothing in the xgboost/lib directory so I get the following error.
clang: error: no such file or directory:
'/Users/.../myproject/xgboost/lib/libxgboost.dylib'
I think that the problem is generated in their CMakeLists file since they have two different targets. Maybe cmake is choosing the wrong target but I'm not familiar enough with cmake to figure it out. The following code is from xgboost's CMakeLists.
# Executable
add_executable(runxgboost $<TARGET_OBJECTS:objxgboost> src/cli_main.cc)
set_target_properties(runxgboost PROPERTIES
OUTPUT_NAME xgboost
)
set_output_directory(runxgboost ${PROJECT_SOURCE_DIR})
target_link_libraries(runxgboost ${LINK_LIBRARIES})
# Shared library
add_library(xgboost SHARED $<TARGET_OBJECTS:objxgboost>)
target_link_libraries(xgboost ${LINK_LIBRARIES})
set_output_directory(xgboost ${PROJECT_SOURCE_DIR}/lib)
#Ensure these two targets do not build simultaneously, as they produce outputs with conflicting names
add_dependencies(xgboost runxgboost)
My questions in order of importance are:
Is there any way to fix it without modifying xgboost's CMakeLists.txt file?
Is it reasonable to try to add xgboost to my project as a git submodule?
Is there any reason cmake is not instructing to build the library?
Note: There were several edits to this question since I tried to narrow down the problem and to provide more information.
(I would love to ask for few things beforehand in the comment section, but I have too low reputation to do so, so I will just give it a shot ;))
I have few suspects, and one of them is ${CMAKE_SOURCE_DIR} of the submodule's root CMakeLists.txt. Although the paths are set properly when you run that CMakeLists.txt alone, cmake gets confused the moment you add it as your subdirectory. Have you looked into another directories for your output binaries?
First I would suggest testing this hypothesis, and then I would suggest writing similar, but separate CMakeLists.txt file for xgboost library, and then substitute it in the project temporarily. Unfortunately the CMakeLists.txt filename is hardcoded and there is no possibility to have two files of that kind in one directory; so it seems that the answer to 1) is, that you rather have to change the file.
For the 2): as long as it does not require huge additional logic in your CMakeLists.txt, it makes sense. Other viable option is to create an install target, which you can use to install your xgboost library locally (using CMAKE_INSTALL_PREFIX(doc) variable), and then add the installation path to your CMAKE_LIBRARY_PATH(doc).

METIS: undefined reference to `METIS_WPartGraphRecursive'

I have to compile a software that depends on METIS library, but whose CMake thing was written by disabling all the places where METIS was needed. Now, I have to re-enable that code again and thus the code depends now on METIS.
I installed metis-5.1.0 from source, and I wrote a CMake module to find it (actually I used this one). I modify the CMakeLists.txt accordingly, basically adding the following lines
find_package(METIS REQUIRED)
if (METIS_FOUND)
include_directories(SYSTEM ${METIS_INCLUDE_PATH})
else (METIS_FOUND)
message (SEND_ERROR "This application cannot compile without METIS")
endif (METIS_FOUND)
and, at the end,
target_link_libraries(<my_executable> ${METIS_LIBRARIES})
After cmake, it seems everything is fine, because cmake prints:
-- Found METIS: /usr/local/include
-- METIS libraries /usr/local/lib/libmetis.a
...
-- Configuring done
-- Generating done
-- Build files have been written to: <mylocation>
However, after I run make, I get
undefined reference to `METIS_WPartGraphKway'
undefined reference to `METIS_WPartGraphRecursive'
How can I solve?
EDIT:
As an additional information, when I compile with make VERBOSE=1, the linker seems to look for the right library, as it includes /usr/local/lib/libmetis.a, which corresponds to the location that cmake was specifying and which also exists. Moreover, when I look into the library with nm /usr/local/lib/libmetis.a, I see:
00000000000001c0 T METIS_WPartGraphKway
00000000000009c0 T METIS_WPartGraphRecursive
P.S.: In Ubuntu 17.04, I have tried with metis-5.1.0, metis-4.0.3 and also installing with sudo apt-get install libmetis-dev. In the latter case I find libmetis.so instead of libmetis.a, but, also in this case, this is correctly recognized by cmake, correctly looked for by the linker, but at the end I get the same error.
I also tried sudo apt-get install libmetis-dev, installing from source metis-5.1.0 and metis-3.0.6 on Ubuntu 14.04 and I had the same problem.
This seems a hard-to-solve error, as many people ask the same question in this page of the METIS formum.
I have also tried to add -lmetis at the end of the compilation command, as suggested here
As an additional information, I did a grep WPartGraphKway in the METIS source folder. In version 5.1.0 there is no such string. In version 4.0.3 there is.
I solved doing this:
I install metis-3.0
I run cmake for my software
I run make VERBOSE=1
I copy the last gcc command being printed
I paste it, I add at the end of the command -lmetis and execute the command
Note that, if I repeat the same operation with metis-5.1.0, it does not work and I have the same error that I wrote in the first post.

Building Open Source library Teem with Levmar support using CMake

I try to build the library Teem under Windows 64bit with levmar support using cmakeGUI with generator VisualStudio10 Win64.
First off all, i built Levmar with CLAPACK and F2C. That works fine as levmar can be compiled without errors and the demo succeds.
The mysterious thing is, when i try to build teem with levmar support ON, cmake always turns it off "because it was not found" although i told cmake the path to levmar.lib.
Thats what the CmakeGUI tells me:
"warning: Turning off Teem_LEVMAR, because it wasn't found.
Configuring done"
Here is a part of my CMakeList.txt delivered with teem:
# Look for "levmar" library <http://www.ics.forth.gr/~lourakis/levmar/>
option(Teem_LEVMAR "Build Teem with levmar library support." OFF)
set(Teem_LEVMAR_LIB "")
if(Teem_LEVMAR)
find_package(LEVMAR)
if(LEVMAR_FOUND)
add_definitions(-DTEEM_LEVMAR)
set(Teem_LEVMAR_LIB ${LEVMAR_LIBRARIES})
set(Teem_LEVMAR_IPATH ${LEVMAR_INCLUDE_DIR})
else()
# We need to set this as a cache variable, so that it will show up as
# being turned off in the cache.
message("warning: Turning off Teem_LEVMAR, because it wasn't found.")
set(Teem_LEVMAR OFF CACHE BOOL "Build Teem with levmar library support." FORCE)
endif()
endif()
Has anyone an idea what happens here?
I tried the same thing with 3 different levmar.lib and different generators but unfortunately i suggest that i have to tell cmake the exact name of the library or the name levmar.lib is simply wrong.
I reported that question also to my supervisor for my thesis but he had the same problem and could not help me.
I also tried to modify the CMakeList:
#if(Teem_LEVMAR)
include_directories(${LEVMAR}/lib)
#endif()
which was originally
if(Teem_LEVMAR)
include_directories(${Teem_LEVMAR_IPATH})
endif()
but it did not help.
Why does cmake recognizes levmar.lib not as the levmar library, in fact does not accept it.
i also tried to understand why find_package(levmar) does not succeed but now i do not know any ways to make it work.
greetings,
jan luca.