Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3869 closed defect (fixed)

[PATCH] Build error at Fedora 23

Reported by: bb Owned by: Itms
Priority: Must Have Milestone: Alpha 21
Component: Build & Packages Keywords: patch
Cc: Patch:

Description

The build of svn, A19 and A20 fails at Fedora 23 when linking tests. It gives the following error:

 /usr/bin/ld: obj/test_Release/test_root.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
obj/test_Release/test_root.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
test.make:163: recipe for target '../../../binaries/system/test' failed
make[1]: *** [../../../binaries/system/test] Error 1
Makefile:92: recipe for target 'test' failed
make: *** [test] Error 2

Attached patch resolves the error and let the game run normally (it has been applied for me last few month).

Attachments (2)

t3869_BuildError.diff (1.7 KB ) - added by bb 8 years ago.
0001-Build-with-fPIC.patch (650 bytes ) - added by Itms 8 years ago.

Download all attachments as: .zip

Change History (9)

by bb, 8 years ago

Attachment: t3869_BuildError.diff added

comment:1 by Itms, 8 years ago

Keywords: review removed

The patch seems really hacky and could cause problems (you add this new flag for all Linux and BSD platforms...)

Could you try to understand why the problem happens specifically on your system? So we can fix this less "brutally" ;)

comment:2 by fabio, 8 years ago

Debian also provide a hardening patch that may be useful to look at, see #1416.

comment:3 by Itms, 8 years ago

I think a proper fix would be to add a --hardened flag to our premake scripts, for people who need/want that.

comment:4 by Andy Alt, 8 years ago

/usr/bin/ld: obj/test_Release/test_root.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC obj/test_Release/test_root.o: error adding Symbols: Bad value

How could more output be added to determine the cause?

comment:5 by Itms, 8 years ago

Keywords: review added

This patch, more minimal, fixes the issue for me on Fedora 24.

On second thought, adding this build flag doesn't seem too much of a big change (we already use it for Atlas, and it is not a breaking change but rather a small tweak in the compilation process).

However it would need intensive testing on all flavors of Linux and BSD. Could people test that on as many platforms as possible and report on the ticket? Thanks.

by Itms, 8 years ago

Attachment: 0001-Build-with-fPIC.patch added

comment:6 by Itms, 8 years ago

Owner: set to Itms
Resolution: fixed
Status: newclosed

In 18729:

Fix building on Fedora, by adding the Position Independant Code flag when building with gcc. This flag is not supposed to break anything and did not cause troubles when testing it on some other platforms than Fedora.

Based on patch by bb, fixes #3869

comment:7 by Itms, 8 years ago

Keywords: review removed

Thanks for working on the issue :)

Note: See TracTickets for help on using tickets.