libretro / LRPS2

GNU General Public License v2.0
165 stars 48 forks source link

[COMPILATION BUG] GCC w/ LTO Fails to Compile #180

Open ThisNekoGuy opened 2 years ago

ThisNekoGuy commented 2 years ago

PCSX2 version:

Latest git build as of October 16th, 2021

Description of the issue:

Compiling libretro-PCSX2 fails with GCC Link Time Optimization (LTO) enabled.

(Not directly related but similar, Clang compiler support and Clang LTO support should be added as well but this currently doesn't directly impact this issue.)

How to reproduce the issue:

Compile the project with the GCC compiler with LTO enabled.

Last known version to work:

Supposedly worked before the last commit.

PC specifications:

OS: Arch Linux CPU: Ryzen 3700X

ksv1986 commented 2 years ago

See https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ

Adding set_source_files_properties(FastJmp.cpp PROPERTIES COMPILE_FLAGS -fno-lto) into common/src/Utilities/CMakeLists.txt fixes the issue.

ThisNekoGuy commented 2 years ago

Telling a certain source file just not to compile with LTO is still an inability to compile with LTO; furthermore, this only proves that there is a problem that can be solved and it shouldn't fall to anyone trying to compile it to solve it

abouvier commented 2 years ago

It will be the fix in upstream: https://github.com/PCSX2/pcsx2/pull/4938