Closed Uchiha729 closed 1 month ago
I also encountered the same problem, can you share how to solve the error of epoxy?Even if I have install through sudpo apt-get install libepoxy-dev
As shown below, I also edited the CMakeLists.txt and resolved the problem: /usr/bin/ld: can't find -lOpengl::EGL.
cmake_minimum_required( VERSION 2.8 )
project( visualizeGeometry )
set(CMAKE_CXX_FLAGS "-std=c++11")
include_directories( "/usr/include/eigen3" )
find_package( Pangolin )
include_directories( ${Pangolin_INCLUDE_DIRS} )
find_package(OpenGL REQUIRED)
add_executable( visualizeGeometry visualizeGeometry.cpp )
target_link_libraries( visualizeGeometry ${Pangolin_LIBRARIES} )
You have to add a Findepoxy.cmake
module and then use find_package(epoxy REQUIRED)
in the CMakeLists.txt
and include its directories before generating a target and linking the Pangolin
library.
This is the code for Findepoxy.cmake
#[=======================================================================[.rst:
FindEpoxy
---------
Find the Epoxy (*libepoxy*) headers and library.
Imported Targets
^^^^^^^^^^^^^^^^
``epoxy::epoxy``
The Epoxy library, if found.
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables in your project:
``Epoxy_FOUND``
true if (the requested version of) Epoxy is available.
``Epoxy_VERSION``
the version of Epoxy; only defined when a ``pkg-config`` module for
Epoxy is available.
``Epoxy_LIBRARIES``
the libraries to link against to use Epoxy.
``Epoxy_INCLUDE_DIRS``
where to find the Epoxy headers.
``Epoxy_COMPILE_OPTIONS``
this should be passed to target_compile_options(), if the
target is not used for linking
#]=======================================================================]
find_package(PkgConfig QUIET)
pkg_check_modules(PC_Epoxy QUIET epoxy)
set(Epoxy_COMPILE_OPTIONS ${PC_Epoxy_CFLAGS_OTHER})
set(Epoxy_VERSION ${PC_Epoxy_VERSION})
find_path(Epoxy_INCLUDE_DIR
NAMES epoxy/common.h
HINTS ${PC_Epoxy_INCLUDEDIR} ${PC_Epoxy_INCLUDE_DIR}
)
find_library(Epoxy_LIBRARY
NAMES ${Epoxy_NAMES} epoxy
HINTS ${PC_Epoxy_LIBDIR} ${PC_Epoxy_LIBRARY_DIRS}
)
# The libepoxy headers do not have anything usable to detect its version
if ("${Epoxy_FIND_VERSION}" VERSION_GREATER "${Epoxy_VERSION}")
if (Epoxy_VERSION)
message(FATAL_ERROR "Required version (${Epoxy_FIND_VERSION}) is"
" higher than found version (${Epoxy_VERSION})")
else ()
message(WARNING "Cannot determine Epoxy version withouit pkg-config")
endif ()
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Epoxy
FOUND_VAR Epoxy_FOUND
REQUIRED_VARS Epoxy_LIBRARY
VERSION_VAR Epoxy_VERSION
)
if (Epoxy_LIBRARY AND NOT TARGET epoxy::epoxy)
add_library(epoxy::epoxy UNKNOWN IMPORTED GLOBAL)
set_target_properties(epoxy::epoxy PROPERTIES
IMPORTED_LOCATION "${Epoxy_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${Epoxy_COMPILE_OPTIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${Epoxy_INCLUDE_DIR}"
)
endif ()
mark_as_advanced(
Epoxy_LIBRARY
Epoxy_INCLUDE_DIR
)
if (Epoxy_FOUND)
set(Epoxy_LIBRARIES ${Epoxy_LIBRARY})
set(Epoxy_INCLUDE_DIRS ${Epoxy_INCLUDE_DIR})
endif ()
now save this as Findeigen.cmake
and add the following lines to CMakeLists.txt
include_directories("/usr/include/eigen3")
find_package(Pangolin REQUIRED)
set(CMAKE_MODULE_PATH "/Path/to/Findeigen.cmake directory")
find_package(epoxy REQUIRED)
include_directories(${Pangolin_INCLUDE_DIRS} ${epoxy_INCLUDE_DIRS})
add_executable(visualizeGeometry visualizeGeometry.cpp)
target_link_libraries(visualizeGeometry ${Pangolin_LIBRARIES})
now try compiling the code after changing the path to Findeigen.cmake
file's directory in the CMakeLists.txt
I also encountered the same problem, can you share how to solve the error of epoxy?Even if I have install through
sudpo apt-get install libepoxy-dev
As shown below, I also edited the CMakeLists.txt and resolved the problem: /usr/bin/ld: can't find -lOpengl::EGL.cmake_minimum_required( VERSION 2.8 ) project( visualizeGeometry ) set(CMAKE_CXX_FLAGS "-std=c++11") include_directories( "/usr/include/eigen3" ) find_package( Pangolin ) include_directories( ${Pangolin_INCLUDE_DIRS} ) find_package(OpenGL REQUIRED) add_executable( visualizeGeometry visualizeGeometry.cpp ) target_link_libraries( visualizeGeometry ${Pangolin_LIBRARIES} )
Ohh sorry did not see you had error with Opengl. For that just put this in you CMakeLists.txt
cmake_minimum_required( VERSION 2.8 )
project( visualizeGeometry )
set(CMAKE_CXX_FLAGS "-std=c++11")
include_directories( "/usr/include/eigen3" )
find_package( Pangolin )
find_package(OpenGL REQUIRED)
include_directories( ${Pangolin_INCLUDE_DIRS} ${OpenGL_INCLUDE_DIRS})
add_executable( visualizeGeometry visualizeGeometry.cpp )
target_link_libraries( visualizeGeometry ${Pangolin_LIBRARIES} )
that should sort it out ig
You have to add a
Findepoxy.cmake
module and then usefind_package(epoxy REQUIRED)
in theCMakeLists.txt
and include its directories before generating a target and linking thePangolin
library.This is the code for
Findepoxy.cmake
#[=======================================================================[.rst: FindEpoxy --------- Find the Epoxy (*libepoxy*) headers and library. Imported Targets ^^^^^^^^^^^^^^^^ ``epoxy::epoxy`` The Epoxy library, if found. Result Variables ^^^^^^^^^^^^^^^^ This will define the following variables in your project: ``Epoxy_FOUND`` true if (the requested version of) Epoxy is available. ``Epoxy_VERSION`` the version of Epoxy; only defined when a ``pkg-config`` module for Epoxy is available. ``Epoxy_LIBRARIES`` the libraries to link against to use Epoxy. ``Epoxy_INCLUDE_DIRS`` where to find the Epoxy headers. ``Epoxy_COMPILE_OPTIONS`` this should be passed to target_compile_options(), if the target is not used for linking #]=======================================================================] find_package(PkgConfig QUIET) pkg_check_modules(PC_Epoxy QUIET epoxy) set(Epoxy_COMPILE_OPTIONS ${PC_Epoxy_CFLAGS_OTHER}) set(Epoxy_VERSION ${PC_Epoxy_VERSION}) find_path(Epoxy_INCLUDE_DIR NAMES epoxy/common.h HINTS ${PC_Epoxy_INCLUDEDIR} ${PC_Epoxy_INCLUDE_DIR} ) find_library(Epoxy_LIBRARY NAMES ${Epoxy_NAMES} epoxy HINTS ${PC_Epoxy_LIBDIR} ${PC_Epoxy_LIBRARY_DIRS} ) # The libepoxy headers do not have anything usable to detect its version if ("${Epoxy_FIND_VERSION}" VERSION_GREATER "${Epoxy_VERSION}") if (Epoxy_VERSION) message(FATAL_ERROR "Required version (${Epoxy_FIND_VERSION}) is" " higher than found version (${Epoxy_VERSION})") else () message(WARNING "Cannot determine Epoxy version withouit pkg-config") endif () endif () include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Epoxy FOUND_VAR Epoxy_FOUND REQUIRED_VARS Epoxy_LIBRARY VERSION_VAR Epoxy_VERSION ) if (Epoxy_LIBRARY AND NOT TARGET epoxy::epoxy) add_library(epoxy::epoxy UNKNOWN IMPORTED GLOBAL) set_target_properties(epoxy::epoxy PROPERTIES IMPORTED_LOCATION "${Epoxy_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${Epoxy_COMPILE_OPTIONS}" INTERFACE_INCLUDE_DIRECTORIES "${Epoxy_INCLUDE_DIR}" ) endif () mark_as_advanced( Epoxy_LIBRARY Epoxy_INCLUDE_DIR ) if (Epoxy_FOUND) set(Epoxy_LIBRARIES ${Epoxy_LIBRARY}) set(Epoxy_INCLUDE_DIRS ${Epoxy_INCLUDE_DIR}) endif ()
now save this as
Findeigen.cmake
and add the following lines toCMakeLists.txt
include_directories("/usr/include/eigen3") find_package(Pangolin REQUIRED) set(CMAKE_MODULE_PATH "/Path/to/Findeigen.cmake directory") find_package(epoxy REQUIRED) include_directories(${Pangolin_INCLUDE_DIRS} ${epoxy_INCLUDE_DIRS}) add_executable(visualizeGeometry visualizeGeometry.cpp) target_link_libraries(visualizeGeometry ${Pangolin_LIBRARIES})
now try compiling the code after changing the path to
Findeigen.cmake
file's directory in theCMakeLists.txt
Thank you very much for providing the code of FindEpoxy.cmake. It's critical.
Initially the error came up saying even -lOpengl::EGL could not be found, but I edited the CMakeLists.txt as shown below
and the
/usr/bin/ld: cannot find -lOpenGL::EGL No such file or directory
was gone but still the/usr/bin/ld: cannot find -lepoxy::epoxy: No such file or directory
error persists. I also havelibepoxy-dev
installed throughsudo apt-get install libepoxy-dev