armory3d / armortools

3D Content Creation Tools
https://armorpaint.org
Other
3.23k stars 334 forks source link

Armorpaint Linux build fails with a "relocation" error. #1533

Closed Swexti closed 1 year ago

Swexti commented 1 year ago

ArmorPaint version:

Main branch

OS/device including version:

Linux Mint 20

Issue description:

Trying to build armortools, following the instructions in the manual, leads to the following errors:

[24/24] g++ -o Armory -O2 main.o g2.o g2_ext.o compute.o openglunit.o g5ong4unit.o linuxunit.o posixunit.o rootunit.o rootunit_.o a1unit.o audio.o graphics.o graphics_kore.o graphics_soft.o g4unit.o g5unit.o inputunit.o iounit.o stb_vorbis.o mathunit.o networkunit.o waylandunit.o -static-libgcc -static-libstdc++ -pthread -lv8_monolith -L/home/swexti/git/armortools/armorcore/v8/libraries/linux/release/ -lasound -ldl -ludev -lGL -lEGL
FAILED: Armory
g++ -o Armory -O2 main.o g2.o g2_ext.o compute.o openglunit.o g5ong4unit.o linuxunit.o posixunit.o rootunit.o rootunit_.o a1unit.o audio.o graphics.o graphics_kore.o graphics_soft.o g4unit.o g5unit.o inputunit.o iounit.o stb_vorbis.o mathunit.o networkunit.o waylandunit.o -static-libgcc -static-libstdc++ -pthread -lv8_monolith -L/home/swexti/git/armortools/armorcore/v8/libraries/linux/release/ -lasound -ldl -ludev -lGL -lEGL
/usr/bin/ld: main.o: relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: g2.o: relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: compute.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: openglunit.o: relocation R_X86_64_32S against symbol `kinc_egl_windows' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: g5ong4unit.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: linuxunit.o: relocation R_X86_64_32S against symbol `x11_ctx' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: posixunit.o: relocation R_X86_64_32S against `.bss' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: rootunit.o: relocation R_X86_64_32 against symbol `stdout@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: a1unit.o: relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: graphics.o: relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: graphics_soft.o: relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: inputunit.o: relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: iounit.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: stb_vorbis.o: relocation R_X86_64_32S against `.bss' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: networkunit.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Build time: 0m 12s
Compilation failed.
Error: Compile error

Full(-ish) log (if needed)

What I have tried

Steps to reproduce:

Follow the build instructions.

luboslenco commented 1 year ago

I am not sure why this happens, sorry. :(

The build action for linux: https://github.com/armory3d/armorcore/blob/main/.github/workflows/linux_opengl.yml

Uses ubuntu-latest which is described here: https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md

Maybe spotting a difference compared to your setup can give a clue on how to resolve that.

Adding "-fPIE" to the compilation flags.

Using project.addCFlag() / project.addCppFlag() in .kfile might help: https://github.com/Kode/kmake/blob/main/kmake/src/Project.ts#L462