Closed dongdongbh closed 10 months ago
fixed by change CMakeLists.txt
under components/pango_geometry
and components/pango_opengl
。
add
include_directories(/usr/include/eigen3)
change target_link_libraries(${COMPONENT} PUBLIC xxx
to
target_link_libraries(${COMPONENT} PUBLIC pango_core pango_image ${Eigen3_LIBRARIES})
but when I run cmake --build build -t pypangolin_pip_install
show error
ninja: error: unknown target 'pypangolin_pip_install'
build with cmake -DPython_EXECUTABLE=
which python3-B build -GNinja
shows same error
It's strange that https://github.com/stevenlovegrove/Pangolin/blob/master/components/pango_geometry/CMakeLists.txt#L3 succeeded but you get the error about Eigen3::Eigen not being found. Let me know if you find a solution without hard-coding the path and I can include it upstream.
Regarding the python problem, you will want to check the output of cmake carefully to see if it thinks it found python.
After installing pybind11-dev
, it can find python package, but it shows following error
[ 54%] Building CXX object CMakeFiles/pango_python.dir/components/pango_python/src/pyinterpreter.cpp.o
In file included from /home/nvio/code/Pangolin-0.8/components/pango_python/src/pyinterpreter.cpp:27:
/home/nvio/code/Pangolin-0.8/components/pango_python/include/pangolin/python/pyinterpreter.h:40:7: warning: ‘pangolin::PyInterpreter’ declared with greater visibility than the type of its field ‘pangolin::PyInterpreter::guard’ [-Wattributes]
40 | class PyInterpreter : public InterpreterInterface
| ^~~~~~~~~~~~~
/home/nvio/code/Pangolin-0.8/components/pango_python/include/pangolin/python/pyinterpreter.h:40:7: warning: ‘pangolin::PyInterpreter’ declared with greater visibility than the type of its field ‘pangolin::PyInterpreter::pycompleter’ [-Wattributes]
/home/nvio/code/Pangolin-0.8/components/pango_python/include/pangolin/python/pyinterpreter.h:40:7: warning: ‘pangolin::PyInterpreter’ declared with greater visibility than the type of its field ‘pangolin::PyInterpreter::pycomplete’ [-Wattributes]
/home/nvio/code/Pangolin-0.8/components/pango_python/src/pyinterpreter.cpp: In constructor ‘pangolin::PyInterpreter::PyInterpreter()’:
/home/nvio/code/Pangolin-0.8/components/pango_python/src/pyinterpreter.cpp:61:27: error: ‘py::module_’ has not been declared
61 | auto pypangolin = py::module_::import("pypangolin");
| ^~~~~~~
/home/nvio/code/Pangolin-0.8/components/pango_python/src/pyinterpreter.cpp:63:20: error: ‘py::module_’ has not been declared
63 | auto sys = py::module_::import("sys");
| ^~~~~~~
make[2]: *** [CMakeFiles/pango_python.dir/build.make:76: CMakeFiles/pango_python.dir/components/pango_python/src/pyinterpreter.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:684: CMakeFiles/pango_python.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
It's strange that https://github.com/stevenlovegrove/Pangolin/blob/master/components/pango_geometry/CMakeLists.txt#L3 succeeded but you get the error about Eigen3::Eigen not being found. Let me know if you find a solution without hard-coding the path and I can include it upstream.
Regarding the python problem, you will want to check the output of cmake carefully to see if it thinks it found python.
Do you think the problem could be with using "Eigen3::Eigen" instead of using ${Eigen3_LIBRARIES} ?
I see that the Eigen package is required in three components: pango_geometry, pango_image and pango_opengl. In the CMake for all these, eigen library is linked using "Eigen3::Eigen" https://github.com/stevenlovegrove/Pangolin/blob/c1d3a6858321b858fd6ab94324460d2c30acb201/components/pango_geometry/CMakeLists.txt#L13C65-L13C65
When I replaced "Eigen3::Eigen" with ${Eigen3_LIBRARIES}, I was not able to build Pangolin library itself. While building, I got the error that it is not able to find "#include <Eigen/Geometry>" header file.
Adding include_directories(/usr/include/eigen3) and replacing "Eigen3::Eigen" with ${Eigen3_LIBRARIES}
in the CMakeLists.txt for pango_geometry, pango_image and pango_opengl fixes the problem for me.
Maybe this helps in some way :)
Using the CMake targe Eigen3::Eigen
is the way to go for modern CMake projects. This is taken straight out of the Eigen documentation: https://eigen.tuxfamily.org/dox/TopicCMakeGuide.html. Linking against this target automatically adds the correct libraries and include paths. But you can probably still do this manually by specifying the include path and libraries in the "old way".
Looking at the other issue related to ORB-SLAM that you commented on, and following there to the original issue in the ORB_SLAM2
repo (https://github.com/raulmur/ORB_SLAM2/issues/1015), this seems to be related to an old C++ standard on an old gcc and Ubuntu version. However, the Ubuntu version 20.04 at the beginning of the thread seems to be quite recent and the same version is tested on the CI: https://github.com/stevenlovegrove/Pangolin/blob/c1d3a6858321b858fd6ab94324460d2c30acb201/.github/workflows/build.yml#L20 Maybe there are other packages conflicting with this, e.g. an Eigen3 installation somewhere else in your system?
Taking a second look at how Eigen is used in the CMake files, Panglin is searching via find_package (Eigen3 REQUIRED QUIET)
while the Eigen documentation says find_package (Eigen3 3.3 REQUIRED NO_MODULE)
, i.e. it uses NO_MODULE
.
@ParikaGoel Can you check what happens on the current master if you replace QUIET
with NO_MODULE
?
I am now encountering this issue too, where CMake would tell me that Eigen was found, but without showing the include path and later failing with resolving the target Eigen3::Eigen
:
-- libpng Found and Enabled
-- libjpeg Found and Enabled
-- Found Eigen: ''
[...]
-- V4L Found and Enabled
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.4.2")
-- Checking for module 'wayland-egl'
-- Found wayland-egl, version 18.1.0
-- Checking for module 'wayland-cursor'
-- Found wayland-cursor, version 1.21.0
-- Checking for module 'xkbcommon'
-- Found xkbcommon, version 0.9.1
-- Found Threads: TRUE
[...]
CMake Error at components/pango_geometry/CMakeLists.txt:13 (target_link_libraries):
Target "pango_geometry" links to:
Eigen3::Eigen
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
CMakeLists.txt:114 (include)
CMake Error at components/pango_image/CMakeLists.txt:108 (target_link_libraries):
Target "pango_image" links to:
Eigen3::Eigen
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
CMakeLists.txt:114 (include)
CMake Error at components/pango_opengl/CMakeLists.txt:29 (target_link_libraries):
Target "pango_opengl" links to:
Eigen3::Eigen
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
In the log above, CMake should show something like Found Eigen: '/usr/include/eigen3'
. Instead, the reported path is empty: Found Eigen: ''
.
CMake Error when runing
cmake -B build
Build on Ubuntu 20.04,
libeigen3-dev
already installed. I'm using the v0.8 release.