Mex error while linking with gmp on Linux

26 views Asked by At

I am using a mex command which works fine in Windows but when I try to mex on Linux, I get an error regarding gmp library.

I have linked to the same gmp library using GCC outside of Matlab successfully. Below is the command

gcc -x c++ -I. -L. -lstdc++ -lm -lIp_cordic_v6_0_bitacc_cmodel -Wl,-rpath,. -o run_bitacc_cmodel run_bitacc_cmodel.c

However within Matlab (tried 2019 and 2020), I get the below error:

gmp.h:37:61: error: ‘GMP_NAIL_BITS’ was not declared in this scope
 #define GMP_NUMB_MASK     ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS)

Below is the mex command I am using to compile the code in Matlab on Linux:

mex -lstdc++ -lm -lgmp -lIp_cordic_v6_0_bitacc_cmodel cordic_sin_cos.cpp -v

Below is the mex command I am using to compile the code in Matlab on Windows which works fine:

mex cordic_sin_cos.cpp libIp_cordic_v6_0_bitacc_cmodel.lib
0

There are 0 answers