use -fabi-version=2 for GCC, turn off LTO #142

Use the g++ `-fabi-version=2` compiler option, as suggested by @ArtiiP
to fix problems similar to:

```
Fatal Error: Mismatch between the program and library build versions
detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1002,wx
containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1009,wx
containers,compatible with 2.8).
Aborted
```

Turn LTO off by default until I fix it for newer gcc/binutils, currently
with gcc7 ar segfaults linking vbamcore.
This commit is contained in:
Rafael Kitover 2017-09-01 05:06:26 -07:00
parent 1a27f81342
commit 4e665ae088
2 changed files with 6 additions and 6 deletions

View File

@ -77,11 +77,7 @@ ENDIF()
option(ENABLE_FFMPEG "Enable ffmpeg A/V recording" ${FFMPEG_DEFAULT})
SET(LTO_DEFAULT ON)
IF(WIN32)
SET(LTO_DEFAULT OFF)
ENDIF()
SET(LTO_DEFAULT OFF)
OPTION(ENABLE_LTO "Compile with Link Time Optimization (gcc and clang only)" ${LTO_DEFAULT})
@ -371,6 +367,10 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
SET(MY_CXX_FLAGS -std=gnu++11 -fpermissive -fexceptions)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(MY_CXX_FLAGS ${MY_CXX_FLAGS} -fabi-version=2)
ENDIF()
FOREACH(ARG ${MY_CXX_FLAGS})
SET(MY_CXX_FLAGS_STR "${MY_CXX_FLAGS_STR} ${ARG}")
ENDFOREACH()

View File

@ -115,7 +115,7 @@ Here is the complete list:
| ENABLE_LINK | Enable GBA linking functionality (requires SFML) | ON |
| ENABLE_LIRC | Enable LIRC support | OFF |
| ENABLE_FFMPEG | Enable ffmpeg A/V recording | ON on Linux and MSys2 |
| ENABLE_LTO | Compile with Link Time Optimization (gcc and clang only) | ON where works |
| ENABLE_LTO | Compile with Link Time Optimization (gcc and clang only) | OFF |
| ENABLE_GBA_LOGGING | Enable extended GBA logging | ON |
| ENABLE_DIRECT3D | Direct3D rendering for wxWidgets (Windows, **NOT IMPLEMENTED!!!**) | ON |
| ENABLE_XAUDIO2 | Enable xaudio2 sound output for wxWidgets (Windows only) | ON |