Skip to contentSkip to conversation

flatbuffers: add PIC compiler flag required for aarch64

PATCH New Andrey Zhizhikin 1 participant 1 message Dec 26, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 flatbuffers: add PIC compiler flag required for aarch64

Add PIC flag to CXXFLAGS in order to solve the issue with linking against the library for aarch64.

Without PIC enabled, linking against this library fails with following messages:

relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `[snap]' which may bind externally can not be used when making a shared object; recompile with -fPIC

---
 meta-oe/recipes-devtools/flatbuffers/flatbuffers_1.11.0.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta-oe/recipes-devtools/flatbuffers/flatbuffers_1.11.0.bb +2 -2
index bd6dcef4e..529441de1 100644
@@ -17,8 +17,8 @@ SRC_URI = "git://github.com/google/flatbuffers.git \
           "
 
 # Make sure C++11 is used, required for example for GCC 4.9
-CXXFLAGS += "-std=c++11"
-BUILD_CXXFLAGS += "-std=c++11"
+CXXFLAGS += "-std=c++11 -fPIC"
+BUILD_CXXFLAGS += "-std=c++11 -fPIC"
 
 # BUILD_TYPE=Release is required, otherwise flatc is not installed
 EXTRA_OECMAKE += "\
Signature · 1 line
2.17.1