MEX error compiling libeemd

4 次查看(过去 30 天)
Alexander N Olesen
Alexander N Olesen 2015-12-13
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 中查找有关 Spline Postprocessing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by