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
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
카테고리
도움말 센터 및 File Exchange에서 MATLAB Coder에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!