All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2,1/1] package/supertux: fix build with RELRO
@ 2020-09-14 20:33 Fabrice Fontaine
  2020-09-19 19:15 ` [Buildroot] [PATCH v2, 1/1] " Thomas Petazzoni
  2020-09-29 13:45 ` Peter Korsgaard
  0 siblings, 2 replies; 6+ messages in thread
From: Fabrice Fontaine @ 2020-09-14 20:33 UTC (permalink / raw)
  To: buildroot

Disable static building of external/squirrel to fix the following build
failure with RELRO:

/home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../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
/home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status

Fixes:
 - http://autobuild.buildroot.org/results/46e8f5e622ce450a89bc6d70f4bfd38182557901
 - http://autobuild.buildroot.org/results/a43720492d817e4555d728546da9114e3ccba952

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Changes v1 -> v2 (after review of Thomas Petazzoni):
 - Disable static building of external/squirrel instead of adding -fPIC

 ...ass-DISABLE_STATIC-to-external-squir.patch | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 package/supertux/0001-CMakeLists.txt-pass-DISABLE_STATIC-to-external-squir.patch

diff --git a/package/supertux/0001-CMakeLists.txt-pass-DISABLE_STATIC-to-external-squir.patch b/package/supertux/0001-CMakeLists.txt-pass-DISABLE_STATIC-to-external-squir.patch
new file mode 100644
index 0000000000..43652d0906
--- /dev/null
+++ b/package/supertux/0001-CMakeLists.txt-pass-DISABLE_STATIC-to-external-squir.patch
@@ -0,0 +1,52 @@
+From 95590485d7cd95611eeac1fc06226d45f235c63a Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sun, 13 Sep 2020 22:09:49 +0200
+Subject: [PATCH] CMakeLists.txt: pass DISABLE_STATIC to external/squirrel
+
+external/squirrel will always build a static binary and library except
+if DISABLE_STATIC is defined so define it to avoid the following build
+failure with RELRO_FULL:
+
+/home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../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
+/home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld: final link failed: nonrepresentable section on output
+collect2: error: ld returned 1 exit status
+
+Fixes:
+ - http://autobuild.buildroot.org/results/46e8f5e622ce450a89bc6d70f4bfd38182557901
+ - http://autobuild.buildroot.org/results/a43720492d817e4555d728546da9114e3ccba952
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ CMakeLists.txt | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1ae0d653b..bb4358b01 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -411,6 +411,7 @@ ExternalProject_Add(squirrel
+   -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+   -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
+   -DCMAKE_INSTALL_PREFIX=${SQUIRREL_PREFIX}
++  -DDISABLE_STATIC=ON
+   -DINSTALL_INC_DIR=include)
+ 
+ if(WIN32)
+@@ -424,10 +425,10 @@ if(WIN32)
+   #For debug run purposes
+   configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mk/msvc/run_supertux.bat.in" "${PROJECT_BINARY_DIR}/run_supertux.bat")
+ else()
+-  add_library(squirrel_lib STATIC IMPORTED)
+-  set_target_properties(squirrel_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}squirrel_static${CMAKE_STATIC_LIBRARY_SUFFIX}")
+-  add_library(sqstdlib_lib STATIC IMPORTED)
+-  set_target_properties(sqstdlib_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}sqstdlib_static${CMAKE_STATIC_LIBRARY_SUFFIX}")
++  add_library(squirrel_lib SHARED IMPORTED)
++  set_target_properties(squirrel_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}squirrel${CMAKE_SHARED_LIBRARY_SUFFIX}")
++  add_library(sqstdlib_lib SHARED IMPORTED)
++  set_target_properties(sqstdlib_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}sqstdlib${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ endif()
+ 
+ include_directories(SYSTEM ${SQUIRREL_PREFIX}/include)
+-- 
+2.28.0
+
-- 
2.28.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2, 1/1] package/supertux: fix build with RELRO
  2020-09-14 20:33 [Buildroot] [PATCH v2,1/1] package/supertux: fix build with RELRO Fabrice Fontaine
@ 2020-09-19 19:15 ` Thomas Petazzoni
  2020-09-29 13:45 ` Peter Korsgaard
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2020-09-19 19:15 UTC (permalink / raw)
  To: buildroot

On Mon, 14 Sep 2020 22:33:29 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Disable static building of external/squirrel to fix the following build
> failure with RELRO:
> 
> /home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../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
> /home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld: final link failed: nonrepresentable section on output
> collect2: error: ld returned 1 exit status
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/46e8f5e622ce450a89bc6d70f4bfd38182557901
>  - http://autobuild.buildroot.org/results/a43720492d817e4555d728546da9114e3ccba952
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> Changes v1 -> v2 (after review of Thomas Petazzoni):
>  - Disable static building of external/squirrel instead of adding -fPIC

Applied to master, thanks. Could you discuss this with upstream? I'm
not sure they will accept the patch as-is, but perhaps they will
suggest some more elaborate solution ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2, 1/1] package/supertux: fix build with RELRO
  2020-09-14 20:33 [Buildroot] [PATCH v2,1/1] package/supertux: fix build with RELRO Fabrice Fontaine
  2020-09-19 19:15 ` [Buildroot] [PATCH v2, 1/1] " Thomas Petazzoni
@ 2020-09-29 13:45 ` Peter Korsgaard
  2020-10-03 19:40   ` Romain Naour
  1 sibling, 1 reply; 6+ messages in thread
From: Peter Korsgaard @ 2020-09-29 13:45 UTC (permalink / raw)
  To: buildroot

>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:

 > Disable static building of external/squirrel to fix the following build
 > failure with RELRO:

 > /home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../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
 > /home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld:
 > final link failed: nonrepresentable section on output
 > collect2: error: ld returned 1 exit status

 > Fixes:
 >  - http://autobuild.buildroot.org/results/46e8f5e622ce450a89bc6d70f4bfd38182557901
 >  - http://autobuild.buildroot.org/results/a43720492d817e4555d728546da9114e3ccba952

 > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
 > ---
 > Changes v1 -> v2 (after review of Thomas Petazzoni):
 >  - Disable static building of external/squirrel instead of adding -fPIC

Committed to 2020.02.x, 2020.05.x and 2020.08.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2, 1/1] package/supertux: fix build with RELRO
  2020-09-29 13:45 ` Peter Korsgaard
@ 2020-10-03 19:40   ` Romain Naour
  2020-10-03 19:52     ` Fabrice Fontaine
  0 siblings, 1 reply; 6+ messages in thread
From: Romain Naour @ 2020-10-03 19:40 UTC (permalink / raw)
  To: buildroot

Hello Fabrice,

Le 29/09/2020 ? 15:45, Peter Korsgaard a ?crit?:
>>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:
> 
>  > Disable static building of external/squirrel to fix the following build
>  > failure with RELRO:
> 
>  > /home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../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
>  > /home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld:
>  > final link failed: nonrepresentable section on output
>  > collect2: error: ld returned 1 exit status
> 
>  > Fixes:
>  >  - http://autobuild.buildroot.org/results/46e8f5e622ce450a89bc6d70f4bfd38182557901
>  >  - http://autobuild.buildroot.org/results/a43720492d817e4555d728546da9114e3ccba952
> 
>  > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>  > ---
>  > Changes v1 -> v2 (after review of Thomas Petazzoni):
>  >  - Disable static building of external/squirrel instead of adding -fPIC
> 
> Committed to 2020.02.x, 2020.05.x and 2020.08.x, thanks.
> 

This patch break supertux because libsquirrel.so.0 and libsqstdlib.so.0 are
missing in TARGET_DIR.

I believe, such bundled libraries are meant to be linked statically into supertux.

We need to revert this patch.

Best regards,
Romain

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2, 1/1] package/supertux: fix build with RELRO
  2020-10-03 19:40   ` Romain Naour
@ 2020-10-03 19:52     ` Fabrice Fontaine
  2020-10-03 20:02       ` Romain Naour
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Fontaine @ 2020-10-03 19:52 UTC (permalink / raw)
  To: buildroot

Hello Romain,

Le sam. 3 oct. 2020 ? 21:40, Romain Naour <romain.naour@gmail.com> a ?crit :
>
> Hello Fabrice,
>
> Le 29/09/2020 ? 15:45, Peter Korsgaard a ?crit :
> >>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:
> >
> >  > Disable static building of external/squirrel to fix the following build
> >  > failure with RELRO:
> >
> >  > /home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../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
> >  > /home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld:
> >  > final link failed: nonrepresentable section on output
> >  > collect2: error: ld returned 1 exit status
> >
> >  > Fixes:
> >  >  - http://autobuild.buildroot.org/results/46e8f5e622ce450a89bc6d70f4bfd38182557901
> >  >  - http://autobuild.buildroot.org/results/a43720492d817e4555d728546da9114e3ccba952
> >
> >  > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> >  > ---
> >  > Changes v1 -> v2 (after review of Thomas Petazzoni):
> >  >  - Disable static building of external/squirrel instead of adding -fPIC
> >
> > Committed to 2020.02.x, 2020.05.x and 2020.08.x, thanks.
> >
>
> This patch break supertux because libsquirrel.so.0 and libsqstdlib.so.0 are
> missing in TARGET_DIR.
>
> I believe, such bundled libraries are meant to be linked statically into supertux.
>
> We need to revert this patch.
Understood, I'll revert this patch.
I opened an issue upstream: https://github.com/SuperTux/supertux/issues/1536
One option would be to disable building of sq binary (but I don't know
yet if it is upstreamable).
>
> Best regards,
> Romain
Best Regards,

Fabrice

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2, 1/1] package/supertux: fix build with RELRO
  2020-10-03 19:52     ` Fabrice Fontaine
@ 2020-10-03 20:02       ` Romain Naour
  0 siblings, 0 replies; 6+ messages in thread
From: Romain Naour @ 2020-10-03 20:02 UTC (permalink / raw)
  To: buildroot

Hello Fabrice,

Le 03/10/2020 ? 21:52, Fabrice Fontaine a ?crit?:
> Hello Romain,
> 
> Le sam. 3 oct. 2020 ? 21:40, Romain Naour <romain.naour@gmail.com> a ?crit :
>>
>> Hello Fabrice,
>>
>> Le 29/09/2020 ? 15:45, Peter Korsgaard a ?crit :
>>>>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:
>>>
>>>  > Disable static building of external/squirrel to fix the following build
>>>  > failure with RELRO:
>>>
>>>  > /home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../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
>>>  > /home/peko/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-musl/8.3.0/../../../../x86_64-buildroot-linux-musl/bin/ld:
>>>  > final link failed: nonrepresentable section on output
>>>  > collect2: error: ld returned 1 exit status
>>>
>>>  > Fixes:
>>>  >  - http://autobuild.buildroot.org/results/46e8f5e622ce450a89bc6d70f4bfd38182557901
>>>  >  - http://autobuild.buildroot.org/results/a43720492d817e4555d728546da9114e3ccba952
>>>
>>>  > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>>>  > ---
>>>  > Changes v1 -> v2 (after review of Thomas Petazzoni):
>>>  >  - Disable static building of external/squirrel instead of adding -fPIC
>>>
>>> Committed to 2020.02.x, 2020.05.x and 2020.08.x, thanks.
>>>
>>
>> This patch break supertux because libsquirrel.so.0 and libsqstdlib.so.0 are
>> missing in TARGET_DIR.
>>
>> I believe, such bundled libraries are meant to be linked statically into supertux.
>>
>> We need to revert this patch.
> Understood, I'll revert this patch.
> I opened an issue upstream: https://github.com/SuperTux/supertux/issues/1536
> One option would be to disable building of sq binary (but I don't know
> yet if it is upstreamable).

Sorry, I haven't looked how to fix the initial issue yet.

But it seems that some bundled libraries are built as a shared libraries:
[ 70%] Linking CXX shared library libsquirrel.so

We need to force CMake to build them as static libraries.

This fix is not good, but thank you for all other issues you fixed in Buildroot :)

Best regards,
Romain


>>
>> Best regards,
>> Romain
> Best Regards,
> 
> Fabrice
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-03 20:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 20:33 [Buildroot] [PATCH v2,1/1] package/supertux: fix build with RELRO Fabrice Fontaine
2020-09-19 19:15 ` [Buildroot] [PATCH v2, 1/1] " Thomas Petazzoni
2020-09-29 13:45 ` Peter Korsgaard
2020-10-03 19:40   ` Romain Naour
2020-10-03 19:52     ` Fabrice Fontaine
2020-10-03 20:02       ` Romain Naour

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.