About Store Forum Documentation Contact



Post Reply 
[SOLVED][Linux] building and flags
Author Message
Houge Offline
Member

Post: #1
[SOLVED][Linux] building and flags
Hi!

It's partly a support request and parly a feature request. So, the thing is that if we try to build the Editor or any EE app in non-Ubuntu distribution (Arch Linux in my case) we get a lot of errors like this:
Code:
/usr/bin/ld: ../../../Editor/Bin/EsenthelEngine.a(lzham_lzcomp_internal.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../Editor/Bin/EsenthelEngine.a(lzham_lzcomp_state.o): relocation R_X86_64_32S against symbol `_ZN5lzham11g_prob_costE' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../Editor/Bin/EsenthelEngine.a(lzham_match_accel.o): relocation R_X86_64_32S against symbol `_ZN5lzham7CLZBase11m_slot_tab0E' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../Editor/Bin/EsenthelEngine.a(x86state.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../Editor/Bin/EsenthelEngine.a(type1.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../Editor/Bin/EsenthelEngine.a(ftbitmap.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../Editor/Bin/EsenthelEngine.a(codebook.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../Editor/Bin/EsenthelEngine.a(floor1.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../Editor/Bin/EsenthelEngine.a(lsp.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE

Here is some information about PIC and PIE. Long story short: PIC is the more common and nowadays-recommended solution, but Ubuntu LLVM keeps building libraries and executables with no PIC. So, the thing is that all Third-Party libs, Engine and EE Applications should include the flags "-fPIC -fPIE" and be recompiled.

Can it be done for next Linux release? smile
(This post was last modified: 09-23-2020 04:27 PM by Houge.)
09-19-2020 12:30 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: [Linux] building and flags
From what I see so far, these options reduce performance.
https://nebelwelt.net/publications/files/12TRpie.pdf
09-19-2020 03:56 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #3
RE: [Linux] building and flags
10% overhead affects x86 32 bit CPUs. The impact is negligible for general purpose x86_64 code.
A result of PIE is that Address Space Layout Randomization (ASLR) can be enabled (these days the default for security reasons, which is why also PIE is the default these days).

OR

The other option, can you please add "-nopie" option to the linker then to explicitly tell it not to use PIE? And "-fno-pic -fno-pie" to the Engine build flags.
For example, editor has only "-static-libstdc++" linker option, so it should be "-static-libstdc++ -nopie"

The files to edit are:
Editor Data/Code/Linux/nbproject/Makefile-Release.mk:<line 63>
Editor Data/Code/Linux/nbproject/Makefile-Debug.mk:<line 63>
Editor Data/Code/Linux/nbproject/configurations.xml:<line 76>
Editor Data/Code/Linux/nbproject/configurations.xml:<line 144>

Editor Source/_Build_/Esenthel/nbproject/Makefile-Release.mk:<line 176>
Editor Source/_Build_/Esenthel/nbproject/Makefile-Debug.mk:<line 176>
Editor Source/_Build_/Esenthel/nbproject/configurations.xml:<line 203>
Editor Source/_Build_/Esenthel/nbproject/configurations.xml:<line 559>

Project/Linux/nbproject/Makefile-Release.mk:<line 113>
Project/Linux/nbproject/Makefile-Debug.mk:<line 113>
Project/Linux/nbproject/configurations.xml:<line 250>
Project/Linux/nbproject/configurations.xml:<line 492>
(This post was last modified: 09-19-2020 08:53 PM by Houge.)
09-19-2020 07:54 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: [Linux] building and flags
Hello,

I've made the changes:
https://github.com/Esenthel/EsenthelEngi...11904fe00f

Hope it helps
09-23-2020 05:46 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #5
RE: [Linux] building and flags
I redownloaded the source (to perform a clean build) and now it works perfectly, thank you!
09-23-2020 04:27 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply