0001-CMakeLists.txt-compile-squirrel-with-fPIC.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. From 23d0bb0ef0fde52d1cffe235edead09287326fb4 Mon Sep 17 00:00:00 2001
  2. From: Romain Naour <romain.naour@gmail.com>
  3. Date: Sun, 4 Oct 2020 01:11:30 +0200
  4. Subject: [PATCH] CMakeLists.txt: compile squirrel with -fPIC
  5. Ensure that squirrel is compiled with -fPIC to allow linking the static
  6. libraries with dynamically linked programs. This is not a requirement
  7. for most architectures but is mandatory for ARM.
  8. Fixes:
  9. x86_64-buildroot-linux-musl/bin/ld: CMakeFiles/sq_static.dir/sq.c.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
  10. x86_64-buildroot-linux-musl/bin/ld: final link failed: nonrepresentable section on output
  11. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  12. ---
  13. CMakeLists.txt | 3 ++-
  14. 1 file changed, 2 insertions(+), 1 deletion(-)
  15. diff --git a/CMakeLists.txt b/CMakeLists.txt
  16. index 8b1dafa1e..07c603cce 100644
  17. --- a/CMakeLists.txt
  18. +++ b/CMakeLists.txt
  19. @@ -412,7 +412,8 @@ ExternalProject_Add(squirrel
  20. -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
  21. -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
  22. -DCMAKE_INSTALL_PREFIX=${SQUIRREL_PREFIX}
  23. - -DINSTALL_INC_DIR=include)
  24. + -DINSTALL_INC_DIR=include
  25. + -DCMAKE_POSITION_INDEPENDENT_CODE=ON)
  26. if(WIN32)
  27. add_library(squirrel_lib SHARED IMPORTED)
  28. --
  29. 2.25.4