Skip to main content
Topic: PCSX2 compile with GCC-8 or -7 (Read 1534 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

PCSX2 compile with GCC-8 or -7

Hey guys, I am trying to figure out how to compile PCSX2 with an older GCC. It doesn't compile with GCC9, it segfaults which is a known issue. currently no fixes on the AUR for it.

I tried to do (I tried CC=/usr/bin/gcc-8 only at first)
Code: [Select]
CC=/usr/bin/gcc-8 \
CXX=/usr/bin/gcc-8 \
but that doesn't work, it gives me:

Code: [Select]

-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/gcc-8
-- Check for working C compiler: /usr/bin/gcc-8 -- broken
CMake Error at /usr/share/cmake-3.14/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/usr/bin/gcc-8"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeTmp
   
    Run Build Command(s):/usr/bin/make cmTC_f73b0/fast
    /usr/bin/make -f CMakeFiles/cmTC_f73b0.dir/build.make CMakeFiles/cmTC_f73b0.dir/build
    make[1]: Entering directory '/home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_f73b0.dir/testCCompiler.c.o
    /usr/bin/gcc-8 -m32   -march=x86-64 -mtune=generic -O2 -pipe -fno-plt    -o CMakeFiles/cmTC_f73b0.dir/testCCompiler.c.o   -c /home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_f73b0
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f73b0.dir/link.txt --verbose=1
    /usr/bin/gcc-8 -m32 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt   -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now  -rdynamic CMakeFiles/cmTC_f73b0.dir/testCCompiler.c.o  -o cmTC_f73b0
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libgcc.a when searching for -lgcc
    /usr/bin/ld: cannot find -lgcc
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libgcc_s.so.1 when searching for libgcc_s.so.1
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libgcc.a when searching for -lgcc
    /usr/bin/ld: cannot find -lgcc
    collect2: error: ld returned 1 exit status
    make[1]: *** [CMakeFiles/cmTC_f73b0.dir/build.make:87: cmTC_f73b0] Error 1
    make[1]: Leaving directory '/home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeTmp'
    make: *** [Makefile:121: cmTC_f73b0/fast] Error 2
   

 

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "/home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeOutput.log".
See also "/home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeError.log".



and yes I have googled this! I'm not really sure why its failing still though. I know I am doing something wrong, but how is the question. I have tried different variations of CC= CXX= but maybe I haven't come upon the right ones

Re: PCSX2 compile with GCC-8 or -7

Reply #1
I had a similar error trying to build bluez-ps3 with gcc-5, it meant the gcc binary was too old compared to the installed version of binutils which supplies the ld command, downgrading binutils might fix it.
But the current advice from the PCSX2 devs themselves is to patch gcc 9 :
https://github.com/PCSX2/pcsx2/commit/43981f5981b0c5578af2243b3db26f0cdb1a1bbd

Or possibly you could try modifying the PKGBUILD to build with clang / llvm as that is supposedly supported by PCSX2 as well.

Code: [Select]
$ diff -u ../PKGBUILD PKGBUILD 
--- ../PKGBUILD 2019-07-04 17:26:15.005995202 +0100
+++ PKGBUILD 2019-07-04 17:58:05.919491923 +0100
@@ -12,7 +12,7 @@
 depends=('lib32-glew' 'lib32-libaio' 'lib32-libcanberra' 'lib32-libjpeg-turbo'
          'lib32-libpulse' 'lib32-nvidia-cg-toolkit' 'lib32-portaudio'
          'lib32-sdl2' 'lib32-soundtouch' 'lib32-wxgtk2')
-makedepends=('cmake' 'git' 'png++')
+makedepends=('cmake' 'git' 'png++' 'clang' 'llvm')
 provides=('pcsx2')
 conflicts=('pcsx2')
 source=('git+https://github.com/PCSX2/pcsx2.git')
@@ -37,6 +37,9 @@
   fi
   mkdir build && cd build
 
+  export CC=/usr/bin/clang
+  export CXX=/usr/bin/clang++
+
   cmake .. \
     -DCMAKE_BUILD_TYPE='Release' \
     -DCMAKE_TOOLCHAIN_FILE='cmake/linux-compiler-i386-multilib.cmake' \
@@ -48,6 +51,7 @@
     -DREBUILD_SHADER='TRUE' \
     -DGLSL_API='TRUE' \
     -DPACKAGE_MODE='TRUE' \
+    -DCMAKE_CXX_COMPILER_ID=Clang \
     -DXDG_STD='TRUE'
 
   make

No, after a few tries it still fails to build with clang :
Code: [Select]
Scanning dependencies of target x86emitter
[ 18%] Building CXX object common/src/x86emitter/CMakeFiles/x86emitter.dir/bmi.cpp.o
[ 19%] Building CXX object common/src/x86emitter/CMakeFiles/x86emitter.dir/cpudetect.cpp.o
/home/me/artix/makepkg/pcsx2/test2/src/pcsx2/common/src/x86emitter/cpudetect.cpp:68:5: error: always_inline function '_fxsave' requires target feature 'xsave', but would be
      inlined into function 'SIMD_EstablishMXCSRmask' that is compiled without support for 'xsave'
    _fxsave(&targetFXSAVE);
    ^
1 error generated.
make[2]: *** [common/src/x86emitter/CMakeFiles/x86emitter.dir/build.make:76: common/src/x86emitter/CMakeFiles/x86emitter.dir/cpudetect.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:279: common/src/x86emitter/CMakeFiles/x86emitter.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

Re: PCSX2 compile with GCC-8 or -7

Reply #2
Hey guys, I am trying to figure out how to compile PCSX2 with an older GCC. It doesn't compile with GCC9, it segfaults which is a known issue. currently no fixes on the AUR for it.

I tried to do (I tried CC=/usr/bin/gcc-8 only at first)
Code: [Select]
CC=/usr/bin/gcc-8 \
CXX=/usr/bin/gcc-8 \
but that doesn't work, it gives me:

Code: [Select]

-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/gcc-8
-- Check for working C compiler: /usr/bin/gcc-8 -- broken
CMake Error at /usr/share/cmake-3.14/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/usr/bin/gcc-8"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeTmp
   
    Run Build Command(s):/usr/bin/make cmTC_f73b0/fast
    /usr/bin/make -f CMakeFiles/cmTC_f73b0.dir/build.make CMakeFiles/cmTC_f73b0.dir/build
    make[1]: Entering directory '/home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_f73b0.dir/testCCompiler.c.o
    /usr/bin/gcc-8 -m32   -march=x86-64 -mtune=generic -O2 -pipe -fno-plt    -o CMakeFiles/cmTC_f73b0.dir/testCCompiler.c.o   -c /home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_f73b0
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f73b0.dir/link.txt --verbose=1
    /usr/bin/gcc-8 -m32 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt   -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now  -rdynamic CMakeFiles/cmTC_f73b0.dir/testCCompiler.c.o  -o cmTC_f73b0
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libgcc.a when searching for -lgcc
    /usr/bin/ld: cannot find -lgcc
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libgcc_s.so.1 when searching for libgcc_s.so.1
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libgcc.a when searching for -lgcc
    /usr/bin/ld: cannot find -lgcc
    collect2: error: ld returned 1 exit status
    make[1]: *** [CMakeFiles/cmTC_f73b0.dir/build.make:87: cmTC_f73b0] Error 1
    make[1]: Leaving directory '/home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeTmp'
    make: *** [Makefile:121: cmTC_f73b0/fast] Error 2
   

 

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "/home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeOutput.log".
See also "/home/kz/Compiles/pcsx2-emu-fresh/src/pcsx2/build/CMakeFiles/CMakeError.log".



and yes I have googled this! I'm not really sure why its failing still though. I know I am doing something wrong, but how is the question. I have tried different variations of CC= CXX= but maybe I haven't come upon the right ones

Is gcc8-libs installed?

Re: PCSX2 compile with GCC-8 or -7

Reply #3
Yes Nous, gcc8-libs is installed...
and if clang don't work, then I'm really lost, oh well... How do we patch GCC9? O_o