Explorar o código

Fix link cpp object file error (#1791)

Error was reported when building docker image:
  /usr/bin/ld: libaotclib.a(aot_llvm_extra.cpp.o): relocation R_X86_64_32S against symbol 
  `_ZN4llvm30TargetTransformInfoWrapperPass2IDE' can not be used when making a PIE object;
  recompile with -fPIC

Add `-fPIC` to `CMAKE_CXX_FLAGS` and `CMAKE_SHARED_LIBRARY_LINK_C_FLAGS` to fix it.
Wenyong Huang %!s(int64=3) %!d(string=hai) anos
pai
achega
49be7cbbcb
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      build-scripts/config_common.cmake

+ 2 - 0
build-scripts/config_common.cmake

@@ -57,7 +57,9 @@ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
     if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows")
       # Add -fPIC flag if build as 64-bit
       set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
       set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -fPIC")
+      set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -fPIC")
     endif ()
   else ()
     include(CheckCCompilerFlag)