mex cholmod link problem
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I'm trying to compile a cpp function that uses cholmod library inside. The OS is ubuntu 16.04 and I had built a CMakeLists.txt as follows.
project(matlabslam)
cmake_minimum_required(VERSION 3.0)
set(CMAKE_BUILD_TYPE Release)
include_directories(${EIGEN_INCLUDE_DIRS})
# For building the CHOLMOD / CSPARSE solvers
FIND_PACKAGE(Cholmod)
FIND_PACKAGE(BLAS)
FIND_PACKAGE(LAPACK)
IF(CHOLMOD_FOUND AND BLAS_FOUND AND LAPACK_FOUND)
MESSAGE(STATUS "Found CHOLMOD and its dependencies")
SET(CHOLMOD_FOUND TRUE)
ELSE()
SET(CHOLMOD_FOUND FALSE)
ENDIF()
#find_package(SuiteSparse REQUIRED)
#include_directories(${SUITESPARSE_INCLUDE_DIRS})
message(STATUS "Configuring MEX files")
set(MATLAB_ADDITIONAL_VERSIONS
"R2016b=9.1"
)
find_package(Matlab REQUIRED)
matlab_add_mex(
NAME deformMex
SRC deformMex.cpp
SRC Deformation.cpp
SRC DeformationGraph.cpp
SRC CholeskyDecomp.cpp
)
target_link_libraries(deformMex
${Eigen_LIBRARIES}
${SUITESPARSE_LIBRARIES}
)
set_target_properties(deformMex
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mex
CXX_STANDARD 11
)
After the compile, when it is called in Matlab it's giving the following error. Seems like external library cholmod is not linked properly. I've tried and searched lots of things but didn't work. Does anyone know what is wrong?
libsuitesparse-dev is already installed.
>>deformMex
Invalid MEX-file '/home/aslab/Desktop/elasticmap/deformation/mex/deformMex.mexa64': /home/aslab/Desktop/elasticmap/deformation/mex/deformMex.mexa64: undefined symbol: cholmod_solve.
0 comentarios
Respuestas (1)
Harsh
el 14 de Feb. de 2017
Hello,
Based on the error message, there are a few things you can try:
Check if deformMex.mexa64 is present on your system at the location given by MATLAB with the required permissions. More information on this can be found here:
Check to make sure that MATLAB is using the appropriate library path environment variable as shown here:
Try to resolve any link errors specific to your library and build file:
0 comentarios
Ver también
Categorías
Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!