All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/supertux: needs -fPIC
@ 2020-09-13 16:49 Fabrice Fontaine
  2020-09-13 19:47 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2020-09-13 16:49 UTC (permalink / raw)
  To: buildroot

Add -fPIC to CFLAGS (and CXXFLAGS for consistency) to avoid the
following build failure:

/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>
---
 package/supertux/supertux.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/supertux/supertux.mk b/package/supertux/supertux.mk
index 3587aefe3a..14b7ed535f 100644
--- a/package/supertux/supertux.mk
+++ b/package/supertux/supertux.mk
@@ -30,7 +30,8 @@ SUPERTUX_DEPENDENCIES = host-pkgconf boost freetype libcurl libgl libglew \
 # ENABLE_OPENGLES2=OFF: Disable opengles2 for now.
 SUPERTUX_CONF_OPTS += \
 	-DCMAKE_BUILD_TYPE=Release \
-	-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -DGLEW_NO_GLU" \
+	-DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -DGLEW_NO_GLU -fPIC" \
+	-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -DGLEW_NO_GLU -fPIC" \
 	-DENABLE_BOOST_STATIC_LIBS=OFF \
 	-DBUILD_DOCUMENTATION=OFF \
 	-DENABLE_OPENGL=ON \
-- 
2.28.0

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

* [Buildroot] [PATCH 1/1] package/supertux: needs -fPIC
  2020-09-13 16:49 [Buildroot] [PATCH 1/1] package/supertux: needs -fPIC Fabrice Fontaine
@ 2020-09-13 19:47 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2020-09-13 19:47 UTC (permalink / raw)
  To: buildroot

On Sun, 13 Sep 2020 18:49:37 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Add -fPIC to CFLAGS (and CXXFLAGS for consistency) to avoid the
> following build failure:
> 
> /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

I am not totally sure that "blindly" appending -fPIC here is the right
solution. This is a RELRO_FULL configuration, so it selects
BR2_PIC_PIE, and therefore the toolchain wrapper passes -fPIE when
building everything.

My guess is that instead the issue is that it is building a static
executable here, as can be guessed from:

""
Scanning dependencies of target sq_static
[...]
collect2: error: ld returned 1 exit status
make[6]: *** [sq/CMakeFiles/sq_static.dir/build.make:86: sq/sq_static] Error 1
""

Could you investigate this a bit more? My feeling is that supertux is
building static libraries/executable, while we have
-DBUILD_SHARED_LIBS=ON.

Could you have a look ?

Thanks,

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

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

end of thread, other threads:[~2020-09-13 19:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-13 16:49 [Buildroot] [PATCH 1/1] package/supertux: needs -fPIC Fabrice Fontaine
2020-09-13 19:47 ` Thomas Petazzoni

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.