MEX error compiling libeemd

조회 수: 1 (최근 30일)
Alexander N Olesen
Alexander N Olesen 2015년 12월 13일
댓글: Alexander N Olesen 2015년 12월 14일
Hi, I am using MATLAB 2015b on OSX, and I am trying to MEX compile the eemd.c function from the libeemd package https://bitbucket.org/luukko/libeemd, but I am running into problems when I try to compile.
When running the command
mex eemd.c
I get the following
Error using mex
In file included from /Users/neergaard/Dropbox/Studie/Master/Matlab/library/resources/libeemd/src/eemd.c:19:
/Users/neergaard/Dropbox/Studie/Master/Matlab/library/resources/libeemd/src/eemd.h:37:10: fatal error: 'gsl/gsl_statistics_double.h' file not found
#include <gsl/gsl_statistics_double.h>
^
1 error generated.
Then I tried the following in order to force the compiler to look in the correct folder
mex -I/opt/local/include/ eemd.c
However the result then was this
Error using mex
Undefined symbols for architecture x86_64:
"_gsl_linalg_solve_tridiag", referenced from:
_emd_evaluate_spline in eemd.o
"_gsl_poly_dd_eval", referenced from:
_emd_evaluate_spline in eemd.o
"_gsl_poly_dd_init", referenced from:
_emd_evaluate_spline in eemd.o
"_gsl_ran_gaussian", referenced from:
_eemd in eemd.o
_ceemdan in eemd.o
"_gsl_rng_alloc", referenced from:
_allocate_eemd_workspace in eemd.o
_eemd in eemd.o
_ceemdan in eemd.o
"_gsl_rng_free", referenced from:
_free_eemd_workspace in eemd.o
_eemd in eemd.o
_ceemdan in eemd.o
"_gsl_rng_mt19937", referenced from:
_allocate_eemd_workspace in eemd.o
_eemd in eemd.o
_ceemdan in eemd.o
"_gsl_rng_set", referenced from:
_allocate_eemd_workspace in eemd.o
_eemd in eemd.o
_ceemdan in eemd.o
"_gsl_stats_sd", referenced from:
_eemd in eemd.o
_ceemdan in eemd.o
"_gsl_strerror", referenced from:
_emd_evaluate_spline in eemd.o
"_gsl_vector_view_array", referenced from:
_emd_evaluate_spline in eemd.o
"_mexFunction", referenced from:
-exported_symbol[s_list] command line option
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am not sure on how to continue further, and I do not the most experience with this, so any help would be greatly appreciated!
Thanks!

답변 (1개)

Walter Roberson
Walter Roberson 2015년 12월 13일
You probably need to add two parameters to the mex command line. The first would be -L (uppercase L) followed by the name of the directory that holds the gsl libary. The second would be -l (lowercase L) followed by the name of the gsl library. For example it might look something like
mex -I/opt/local/include/ -L/opt/local/lib -llibgsl eemd.c
I am guessing about the appropriate directory and library names here.
  댓글 수: 1
Alexander N Olesen
Alexander N Olesen 2015년 12월 14일
I think you're right. I got a similar answer on StackOverflow where I should go to the terminal and input
pkg-config --libs --cflags gsl
which results in the following parameters
-I/opt/local/include -L/opt/local/lib -lgsl -lgslcblas -lm
However, when that is said and done, I get the following error
Error using mex
Undefined symbols for architecture x86_64:
"_mexFunction", referenced from:
-exported_symbol[s_list] command line option
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea on how to resolve this?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by