package/supertux: needs -fPIC
PATCH 1/1 package/supertux: needs -fPIC
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
--- package/supertux/supertux.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
package/supertux/supertux.mk +2 -1
@@ -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 \
Signature · 1 line
2.28.0
PATCH 1/1 package/supertux: needs -fPIC
Quoted 10 lines · On Sun, 13 Sep 2020 18:49:37 +0200 Fabrice Fontaine…
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: relocationR_X86_64_32against `.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 statusFixes:
- 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
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com