MATLAB Coder - ld: 32-bit RIP relative reference out of range

3 次查看(过去 30 天)
Hi,
I'm trying to compile MATLAB functions to C++ using MATLAB Coder and I'm getting the following error message:
ld: 32-bit RIP relative reference out of range
I should mention that when running the entrypoint function whitin MATLAB it consumes ~15GB of RAM because it works on large matrices.
I'm under OSX and I use clang++ shipped with the lastest version of XCode. MATLAB version is 2020a.
I don't have experience with C++ compiling and linking proces so I'm a bit out of clue on how to solve this error. If anyone can provide explainations and ideas to fix it will be really helpfull.
Thanks.

回答(1 个)

Adit Calambur
Adit Calambur 2021-7-21
Hi Vadim,
To summarise your issue, you are unable to generate code for an entry-point function of considerable size. On further reading about this error message, it seems as if your compiler is having trouble allocating memory above a certain threshold. Possible solutions might be:
.
  1 个评论
Vadim Bertrand
Vadim Bertrand 2021-7-22
Hi,
Thanks for your answer.
Indeed the problem was related to memory allocation, and to my understanding to static or fix memory allocation. I forced MATLAB Coder to consider the big matrices causing issues to be dynamically allocated by passing their dimensions as parameters to my function instead of having them constant. Maybe it adds some computation time overhead but it was the only workaround I found to my original issue. (Before I tried to use -mcmodel=large without success)
Regards,
Vadim

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by