mas-bandwidth / yojimbo

A network library for client/server games written in C++
BSD 3-Clause "New" or "Revised" License
2.48k stars 244 forks source link

fails to link on Ubuntu 18.04.1 LTS with gcc 6.4.0 #103

Closed jarrettchisholm closed 5 years ago

jarrettchisholm commented 6 years ago

The error I get is:

/usr/bin/x86_64-linux-gnu-ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
client.make:83: recipe for target 'bin/client' failed
make[1]: *** [bin/client] Error 1
Makefile:54: recipe for target 'client' failed
make: *** [client] Error 2
make: *** Waiting for unfinished jobs....
/usr/bin/x86_64-linux-gnu-ld: bin/libyojimbo.a(tlsf.o): relocation R_X86_64_32 against '.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
server.make:83: recipe for target 'bin/server' failed
make[1]: *** [bin/server] Error 1
Makefile:60: recipe for target 'server' failed
make: *** [server] Error 2
/usr/bin/x86_64-linux-gnu-ld: bin/libyojimbo.a(tlsf.o): relocation R_X86_64_32 against '.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
test.make:83: recipe for target 'bin/test' failed
make[1]: *** [bin/test] Error 1
Makefile:42: recipe for target 'test' failed
make: *** [test] Error 2

I believe this is due to position independent executable now being enabled by default.

A fix that seems to work is adding linkoptions { "-no-pie" } to each project.

gafferongames commented 5 years ago

Please just modify this to work yourself. If you have a pull request that fixes this issue (while having other platform still work), I'm happy to merge it. Thanks