gcc 編譯錯誤

1: 錯誤: recompile with -fPIC [1]
...
[ 14%] Linking CXX shared library ../lib/libvgltrans_test2.so
/usr/bin/ld: /opt/libjpeg-turbo/lib64/libturbojpeg.a(libturbojpeg_la-jdmarker.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `__stack_chk_guard@@GLIBC_2.17' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /opt/libjpeg-turbo/lib64/libturbojpeg.a(libturbojpeg_la-jdmarker.o)(.text+0xa0c): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `__stack_chk_guard@@GLIBC_2.17'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
...
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
解決:
以上述例子, 從新編譯此套件所需的libturbojpeg. 在編譯過程加入 -fPIC


Reference

  1. recompile with -fPIC

留言

這個網誌中的熱門文章

yocto recipe : (1) 撰寫 recipe

yocto recipe : (2) 撰寫 bbappend

yocto recipe : (3) 使用 External Source 來編譯軟體