Problem compiling with Intel C compiler via MATLAB Coder

13 ビュー (過去 30 日間)
Joe M
Joe M 2021 年 2 月 24 日
コメント済み: Ryan Livingston 2021 年 3 月 7 日
I have registered a toolchain that uses the Intel C compiler (icc), but compilation fails because icc does not recognize NAN and INFINITY in the file rt_nonfinite.c. The problematic lines are
real_T rtNaN = (real_T)NAN;
and
real_T rtInf = (real_T)INFINITY;
I thought I had solution when I added
tc.addMacro('C_STANDARD_OPTS',' -D__PURE_INTEL_C99_HEADERS__ ');
to my m-file defining the toolchain object. But now compilation fails due to the same lines (and more) in rt_nonfinite.c, but for a different reas on. The error is now
error: expression must have a constant value.
I know that NAN and INFINITE are defined in the math.h that comes with icc. Could icc be unaware of its own header files? How can I fix that?
Thanks in advance for advice and insight. I am working on a 64 bit Linux box.

回答 (1 件)

Joe M
Joe M 2021 年 2 月 25 日
I managed to get MATLAB Coder to use icc successfully by adding the following to the m-file that defined the toolchain object:
tc.addMacro('C_STANDARD_OPTS', ' -std=c11 ');
With this added, everything compiled. There are other parts in my example's C_STANDARD_OPTS, but I did not change them.
At least one mystery remains. I define a coder.config object with the following commands.
cfg = coder.config('exe');
cfg.Toolchain = 'Intel IPP | make (64-bit Linux)';
But when I query the value of cfg.TargetLangStandard, the value is 'C99 (ISO)'.
Is my cfg not using the C11 standard, which seemed to allow compilation to proceed?
  3 件のコメント
Joe M
Joe M 2021 年 3 月 6 日
編集済み: Joe M 2021 年 3 月 6 日
Thank you for the inisght. I will test this.
Is there documentation that describes the map between GNU make commands and construction of a toolchain object? Some of the connections are clear, but some are a bit murky to me.
Ryan Livingston
Ryan Livingston 2021 年 3 月 7 日
The root of the custom toolchain doc is here:
Which sort of GNU Make commands are you looking for info regarding?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDeployment Basics についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by