Why do I get a linker error when compiling MATLAB Coder output?
古いコメントを表示
I have generated C++ code for 2 MATLAB functions, and I have made a main file from the 2 examples. I have it compiling against the generated libraries, but I'm getting the following linker error:
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
I am using g++ version 7.4.0 and ld version 2.30
Using the --no-relax option results in several undefined reference errors to functions that are found in the libraries.
gen/libdata2image_mmw.a(data2image_mmw_initialize.o): In function `data2image_mmw_initialize()':
data2image_mmw_initialize.cpp:(.text+0x1a): undefined reference to `omp_init_nest_lock'
gen/libdata2image_mmw.a(data2image_mmw_terminate.o): In function `data2image_mmw_terminate()':
data2image_mmw_terminate.cpp:(.text+0x8): undefined reference to `omp_destroy_nest_lock'
gen/libdata2image_mmw.a(data2image_mmw.o): In function `data2image_mmw(creal_T const*, double const*, double, double, double, double, double*, double*, emxArray_real_T*, emxArray_creal_T*)':
data2image_mmw.cpp:(.text+0x11e): relocation truncated to fit: R_X86_64_PC32 against `.bss'
data2image_mmw.cpp:(.text+0x13e): relocation truncated to fit: R_X86_64_PC32 against `.bss'
data2image_mmw.cpp:(.text+0x14a): relocation truncated to fit: R_X86_64_PC32 against `.bss'
data2image_mmw.cpp:(.text+0x151): relocation truncated to fit: R_X86_64_PC32 against `.bss'
data2image_mmw.cpp:(.text+0x1bc): relocation truncated to fit: R_X86_64_PC32 against `.bss'
data2image_mmw.cpp:(.text+0x1c4): relocation truncated to fit: R_X86_64_PC32 against `.bss'
data2image_mmw.cpp:(.text+0x1cc): relocation truncated to fit: R_X86_64_PC32 against `.bss'
data2image_mmw.cpp:(.text+0x1d7): relocation truncated to fit: R_X86_64_PC32 against `.bss'
data2image_mmw.cpp:(.text+0x20e): relocation truncated to fit: R_X86_64_PC32 against `.bss'
data2image_mmw.cpp:(.text+0x21b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
data2image_mmw.cpp:(.text+0x222): additional relocation overflows omitted from the output
gen/libdata2image_mmw.a(fft1.o): In function `b_r2br_r2dit_trig(creal_T const*, double const*, double const*, creal_T*) [clone ._omp_fn.0]':
fft1.cpp:(.text+0x218): undefined reference to `omp_get_num_threads'
fft1.cpp:(.text+0x220): undefined reference to `omp_get_thread_num'
gen/libdata2image_mmw.a(fft1.o): In function `r2br_r2dit_trig(creal_T const*, double const*, double const*, creal_T*) [clone ._omp_fn.1]':
fft1.cpp:(.text+0x348): undefined reference to `omp_get_num_threads'
fft1.cpp:(.text+0x350): undefined reference to `omp_get_thread_num'
gen/libdata2image_mmw.a(fft1.o): In function `b_r2br_r2dit_trig(creal_T const*, double const*, double const*, creal_T*)':
fft1.cpp:(.text+0x496): undefined reference to `omp_get_max_threads'
fft1.cpp:(.text+0x4c0): undefined reference to `GOMP_parallel'
gen/libdata2image_mmw.a(fft1.o): In function `r2br_r2dit_trig(creal_T const*, double const*, double const*, creal_T*)':
fft1.cpp:(.text+0x564): undefined reference to `omp_get_max_threads'
fft1.cpp:(.text+0x58e): undefined reference to `GOMP_parallel'
collect2: error: ld returned 1 exit status
4 件のコメント
Walter Roberson
2019 年 5 月 30 日
編集済み: Walter Roberson
2020 年 8 月 6 日
Shawn Rigdon
2019 年 5 月 30 日
Anakin Zheng
2019 年 6 月 10 日
Hi Shawn,
Can you share the linker command you are using?
Thanks
Ahmad Alghooneh
2020 年 8 月 3 日
Link OpenMp with your compiler
回答 (1 件)
Ashrarul Sifat
2020 年 2 月 5 日
0 投票
Did you solve this? Also the link from the previous answer is unavailbe now
1 件のコメント
Walter Roberson
2020 年 2 月 6 日
I updated the link.
カテゴリ
ヘルプ センター および File Exchange で MATLAB Coder についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!