PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.85k stars 1.63k forks source link

pcsx2(32bit) seems to have trouble compiling using gcc 6.2.1 #1801

Closed XenonPK closed 7 years ago

XenonPK commented 7 years ago

Here are the build log(s): https://build.opensuse.org/package/live_build_log/home:xenonpk:branches:Emulators/pcsx2/openSUSE_Tumbleweed/i586

https://build.opensuse.org/package/live_build_log/home:xenonpk:branches:Emulators/pcsx2/openSUSE_Factory/i586

And gcc 4.8 compiles successfuly:

https://build.opensuse.org/package/live_build_log/home:xenonpk:branches:Emulators/pcsx2/openSUSE_Leap_42.2/i586

https://build.opensuse.org/package/live_build_log/home:xenonpk:branches:Emulators/pcsx2/openSUSE_Leap_42.1/i586

gregory38 commented 7 years ago

Cdvd plugins were removed recently. I don't understand why you still compile them. Are the compilation options the default ?

XenonPK commented 7 years ago

You can see the specfile with the build options here: https://build.opensuse.org/package/view_file/home:xenonpk:branches:Emulators/pcsx2/pcsx2.spec?expand

This is a branch of the currently official pcsx2 package for openSUSE (all versions) , If you see something that can be made better I'll happily fix it and submit the fixes to the official repos.

gregory38 commented 7 years ago

Just to be sure, upgrade to latest 1.5. Some issues were fixed in the past. Then remove the extra plugin. You don't need them. (And potentially you could remove the dependencies of those plugins, bzip2, JPEG, glew, cg...)

gregory38 commented 7 years ago

Hum tell me that you don't use the git 1.5 tag. It is 1.4 (without various bug fixes...)

gregory38 commented 7 years ago

Note: the glsl API and rebuild shader options are useless too (they impact the unsupported extra plugins)

gregory38 commented 7 years ago

FYI: http://pcsx2.net/developer-blog/207-new-versioning-release-pattern.html

XenonPK commented 7 years ago

Yes, that is the v1.5.0-dev tag, oops... Thanks for noticing, I'll fix stuff up and report back.

gregory38 commented 7 years ago

Warning you will get tons of improvement (rendering fixes + perf boost) ;)

gregory38 commented 7 years ago

Oh by the way, please check that you get the 3 GSdx plugins (SSE 2/4 and AVX2). I'm not sure that you're cmake options are compatible.

XenonPK commented 7 years ago

Is there a better way to avoid building zerogs?

# zerogs doesn't build and source dir must be removed without libCg-devel rm -rf plugins/zerogs/

gregory38 commented 7 years ago

Remove the option to build the extra plugins. All extra plugins are not supported, buggy as hell, don't support recent lib (such as gtk3). Those plugins remains as toy for developers.

XenonPK commented 7 years ago

Got build success across the board, you can check the logs in the links in the first comment if you want :+1: , this is definitely not an upstream issue, sorry for the git tag overlook. :) I will do some last minute clean ups (versioning) , check the GSdx plugins, and submit this to the repos, thanks for the help! :1st_place_medal:

gregory38 commented 7 years ago

Hum, I will post some extra options for you when I come back to home. Note you can clean the dependency list

gregory38 commented 7 years ago
-DDISABLE_ADVANCE_SIMD=TRUE

Use i686 and SSE2 optimization. This way, you can remove the i586. GSdx will be duplicated 3 times.

-DDISABLE_BUILD_DATE=TRUE

Don't insert the build type

-DGSDX_LEGACY=TRUE

Create legacy GSdx with smaller OpenGL requirement. (AKA, Nvidia/AMD proprietary driver on old (DX10 class) hardware).

XenonPK commented 7 years ago

I assume I will have to add -DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake for x86_64 builds to work, right?

gregory38 commented 7 years ago

You mean x86 build on 64 bits host, right? Pure 64 bits exist but it is slow (aka no recompiler). Something like that, check build.sh

Teklad commented 7 years ago

Not sure if this is relevant, but I really can't build the latest git of this, lol. Here's the output:

/home/justin/Projects/pcsx2/pcsx2/MMI.cpp: In function ‘void R5900::Interpreter::OpcodeImpl::MMI::PMADDUW()’:
/home/justin/Projects/pcsx2/pcsx2/MMI.cpp:1470:1: error: insn does not satisfy its constraints:
 }
 ^
(insn 198 197 199 2 (parallel [
            (set (reg:SI 22 xmm1 [175])
                (ashiftrt:SI (reg:SI 22 xmm1 [175])
                    (const_int 31 [0x1f])))
            (clobber (reg:CC 17 flags))
        ]) /home/justin/Projects/pcsx2/pcsx2/MMI.cpp:1462 556 {ashrsi3_cvt}
     (nil))
/home/justin/Projects/pcsx2/pcsx2/MMI.cpp:1470:1: internal compiler error: in extract_constrain_insn, at recog.c:2190
make[2]: *** [pcsx2/CMakeFiles/PCSX2.dir/build.make:799: pcsx2/CMakeFiles/PCSX2.dir/MMI.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:330: pcsx2/CMakeFiles/PCSX2.dir/all] Error 2
make: *** [Makefile:128: all] Error 2

I also tried a pre-compiled version of this using some repos which package the latest git variant, and I get a SIGILL/Illegal Operation crash shortly after start-up.

Some more relevant information, my gcc -v output:

[justin@crethias ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc-multilib/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 6.3.1 20170109 (GCC) 

It's gcc multilib, so technically it should compile, but it's just crapping out. This could be an upstream issue with GCC though.... not really sure.

Edit: Also... here's the cmake I used.

cmake .. -DCMAKE_BUILD_TYPE='Release' -DCMAKE_TOOLCHAIN_FILE='cmake/linux-compiler-i386-multilib.cmake' -DCMAKE_INSTALL_PREFIX='/usr' -DCMAKE_LIBRARY_PATH='/usr/lib32' -DPLUGIN_DIR='/usr/lib32/pcsx2' -DGAMEINDEX_DIR='/usr/share/pcsx2' -DEXTRA_PLUGINS='TRUE' -DREBUILD_SHADER='TRUE' -DGLSL_API='TRUE' -DPACKAGE_MODE='TRUE' -DXDG_STD='TRUE'

Another Edit: I'm using Arch Linux.... completely forgot to add this. -.-

gregory38 commented 7 years ago

Don't use those options -DEXTRA_PLUGINS='TRUE' -DREBUILD_SHADER='TRUE' -DGLSL_API='TRUE'

It won't solve your issue but there are bad. Then internal compiler error: in extract_constrain_insn, at recog.c:2190 also known as ICE must reported to GCC.

gregory38 commented 7 years ago

Can the issue be closed?

XenonPK commented 7 years ago

I believe so, as it does not seem to be an upstream issue(on your side, at least). On the other hand, while I have achieved some successful builds, some fail at different stages , one of them is the one reported by Teklad. Could this be related to the available hardware extensions at build time? My skylake laptop always compiles successfuly, however, the builds sent to the build service are not always successful.

Teklad commented 7 years ago

Just to chime in. I compiled GCC 5.3 and was able to compile using that with 0 issues

On Feb 5, 2017 7:03 PM, "XenonPK" notifications@github.com wrote:

I believe so, as it does not seem to be an upstream issue(on your side, at least). On the other hand, while I have achieved some successful builds, some fail at different stages , one of them is the one reported by Teklad. Could this be related to the available hardware extensions at build time? My skylake laptop always compiles successfuly, however, the builds sent to the build service are not always successful.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PCSX2/pcsx2/issues/1801#issuecomment-277565098, or mute the thread https://github.com/notifications/unsubscribe-auth/ACvJZfbdRNuXQug5iiX-Gh2PP-GJHmhEks5rZnF_gaJpZM4L0hVO .

gregory38 commented 7 years ago

@XenonPK What is your issue (error log) ? ICE are internal GCC bug. Even invalid C/ISA mustn't trigger an ICE.

I don't remember if you can compile an AVX2 build on a non-AVX2 CPU.

XenonPK commented 7 years ago

[ 337s] /home/abuild/rpmbuild/BUILD/pcsx2-1.5.0.r23d081ab2/pcsx2/MMI.cpp: In function 'void R5900::Interpreter::OpcodeImpl::MMI::PMADDUW()': [ 337s] /home/abuild/rpmbuild/BUILD/pcsx2-1.5.0.r23d081ab2/pcsx2/MMI.cpp:1470:1: error: insn does not satisfy its constraints: [ 337s] } [ 337s] ^ [ 337s] (insn 211 210 212 2 (parallel [ [ 337s] (set (reg:SI 22 xmm1 [175]) [ 337s] (ashiftrt:SI (reg:SI 22 xmm1 [175]) [ 337s] (const_int 31 [0x1f]))) [ 337s] (clobber (reg:CC 17 flags)) [ 337s] ]) /home/abuild/rpmbuild/BUILD/pcsx2-1.5.0.r23d081ab2/pcsx2/MMI.cpp:1462 474 {ashrsi3_cvt} [ 337s] (nil)) [ 337s] /home/abuild/rpmbuild/BUILD/pcsx2-1.5.0.r23d081ab2/pcsx2/MMI.cpp:1470:1: internal compiler error: in extract_constrain_insn, at recog.c:2190 [ 337s] Please submit a full bug report, [ 337s] with preprocessed source if appropriate. [ 337s] See http://bugs.opensuse.org/ for instructions. [ 337s] make[2]: [pcsx2/CMakeFiles/PCSX2.dir/build.make:802: pcsx2/CMakeFiles/PCSX2.dir/MMI.cpp.o] Error 1 [ 337s] make[2]: Waiting for unfinished jobs.... [ 339s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/pcsx2-1.5.0.r23d081ab2/build' [ 339s] [ 68%] Built target GSdx [ 340s] [ 68%] Linking CXX shared module libGSdx-legacy-1.0.0.so [ 340s] cd /home/abuild/rpmbuild/BUILD/pcsx2-1.5.0.r23d081ab2/build/plugins/GSdx_legacy && /usr/bin/cmake -E cmake_link_script CMakeFiles/GSdx-legacy-1.0.0.dir/link.txt --verbose=1

The problem with this is that, if I try the build again, with the the exact same source and build flags, the build may be successful, or it may throw a different error, so it's hard to reproduce.

EDIT: spoke too soon, here's another example:

[ 597s] [ 67%] Linking CXX shared module libGSdx.so [ 597s] cd /home/abuild/rpmbuild/BUILD/pcsx2-1.5.0.r23d081ab2/build/plugins/GSdx && /usr/bin/cmake -E cmake_link_script CMakeFiles/GSdx.dir/link.txt --verbose=1 [ 597s] /usr/bin/c++ -fomit-frame-pointer -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -march=native -pipe -fvisibility=hidden -pthread -fno-builtin-strcmp -fno-builtin-memcmp -mfpmath=sse -Wall -Wextra -Wno-attributes -Wno-unused-function -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-value -Wstrict-aliasing -Wstrict-overflow=1 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -ggdb3 -fno-omit-frame-pointer -DNDEBUG -DPCSX2_DEVBUILD -D_DEVEL -O2 -std=c++11 -Wno-invalid-offsetof -pthread -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -shared -o libGSdx.so CMakeFiles/GSdx.dir/GLLoader.cpp.o CMakeFiles/GSdx.dir/GLState.cpp.o CMakeFiles/GSdx.dir/PSX/GPU.cpp.o CMakeFiles/GSdx.dir/PSX/GPUDrawScanline.cpp.o CMakeFiles/GSdx.dir/PSX/GPUDrawScanlineCodeGenerator.cpp.o CMakeFiles/GSdx.dir/PSX/GPULocalMemory.cpp.o CMakeFiles/GSdx.dir/PSX/GPURenderer.cpp.o CMakeFiles/GSdx.dir/PSX/GPURendererSW.cpp.o CMakeFiles/GSdx.dir/PSX/GPUSetupPrimCodeGenerator.cpp.o CMakeFiles/GSdx.dir/PSX/GPUState.cpp.o CMakeFiles/GSdx.dir/GS.cpp.o CMakeFiles/GSdx.dir/GSAlignedClass.cpp.o CMakeFiles/GSdx.dir/GSBlock.cpp.o CMakeFiles/GSdx.dir/GSCapture.cpp.o CMakeFiles/GSdx.dir/GSClut.cpp.o CMakeFiles/GSdx.dir/GSCodeBuffer.cpp.o CMakeFiles/GSdx.dir/GSCrc.cpp.o CMakeFiles/GSdx.dir/GSDevice.cpp.o CMakeFiles/GSdx.dir/GSDeviceOGL.cpp.o CMakeFiles/GSdx.dir/GSDeviceSW.cpp.o CMakeFiles/GSdx.dir/GSDeviceNull.cpp.o CMakeFiles/GSdx.dir/GSDirtyRect.cpp.o CMakeFiles/GSdx.dir/GSDrawingContext.cpp.o CMakeFiles/GSdx.dir/GSDrawScanline.cpp.o CMakeFiles/GSdx.dir/GSDrawScanlineCodeGenerator.cpp.o CMakeFiles/GSdx.dir/GSDrawScanlineCodeGenerator.x64.cpp.o CMakeFiles/GSdx.dir/GSDrawScanlineCodeGenerator.x64.avx.cpp.o CMakeFiles/GSdx.dir/GSDrawScanlineCodeGenerator.x64.avx2.cpp.o CMakeFiles/GSdx.dir/GSDrawScanlineCodeGenerator.x86.cpp.o CMakeFiles/GSdx.dir/GSDrawScanlineCodeGenerator.x86.avx.cpp.o CMakeFiles/GSdx.dir/GSDrawScanlineCodeGenerator.x86.avx2.cpp.o CMakeFiles/GSdx.dir/GSDump.cpp.o CMakeFiles/GSdx.dir/GSFunctionMap.cpp.o CMakeFiles/GSdx.dir/GSHwHack.cpp.o CMakeFiles/GSdx.dir/GSLinuxDialog.cpp.o CMakeFiles/GSdx.dir/GSLocalMemory.cpp.o CMakeFiles/GSdx.dir/GSLzma.cpp.o CMakeFiles/GSdx.dir/GSPerfMon.cpp.o CMakeFiles/GSdx.dir/GSPng.cpp.o CMakeFiles/GSdx.dir/GSRasterizer.cpp.o CMakeFiles/GSdx.dir/GSRenderer.cpp.o CMakeFiles/GSdx.dir/GSRendererCL.cpp.o CMakeFiles/GSdx.dir/GSRendererHW.cpp.o CMakeFiles/GSdx.dir/GSRendererNull.cpp.o CMakeFiles/GSdx.dir/GSRendererOGL.cpp.o CMakeFiles/GSdx.dir/GSRendererSW.cpp.o CMakeFiles/GSdx.dir/GSOsdManager.cpp.o CMakeFiles/GSdx.dir/GSSetting.cpp.o CMakeFiles/GSdx.dir/GSSetupPrimCodeGenerator.cpp.o CMakeFiles/GSdx.dir/GSSetupPrimCodeGenerator.x64.cpp.o CMakeFiles/GSdx.dir/GSSetupPrimCodeGenerator.x64.avx.cpp.o CMakeFiles/GSdx.dir/GSSetupPrimCodeGenerator.x64.avx2.cpp.o CMakeFiles/GSdx.dir/GSSetupPrimCodeGenerator.x86.cpp.o CMakeFiles/GSdx.dir/GSSetupPrimCodeGenerator.x86.avx.cpp.o CMakeFiles/GSdx.dir/GSSetupPrimCodeGenerator.x86.avx2.cpp.o CMakeFiles/GSdx.dir/GSShaderOGL.cpp.o CMakeFiles/GSdx.dir/GSState.cpp.o CMakeFiles/GSdx.dir/GSTables.cpp.o CMakeFiles/GSdx.dir/GSTexture.cpp.o CMakeFiles/GSdx.dir/GSTextureCache.cpp.o CMakeFiles/GSdx.dir/GSTextureCacheSW.cpp.o CMakeFiles/GSdx.dir/GSTextureCacheOGL.cpp.o CMakeFiles/GSdx.dir/GSTextureOGL.cpp.o CMakeFiles/GSdx.dir/GSTextureNull.cpp.o CMakeFiles/GSdx.dir/GSTextureSW.cpp.o CMakeFiles/GSdx.dir/GSUtil.cpp.o CMakeFiles/GSdx.dir/GSVector.cpp.o CMakeFiles/GSdx.dir/GSVertexTrace.cpp.o CMakeFiles/GSdx.dir/GSWnd.cpp.o CMakeFiles/GSdx.dir/GSWndOGL.cpp.o CMakeFiles/GSdx.dir/GSWndEGL.cpp.o CMakeFiles/GSdx.dir/GSdx.cpp.o CMakeFiles/GSdx.dir/GSdxResources.cpp.o CMakeFiles/GSdx.dir/stdafx.cpp.o -lX11 -lXext -lGLU -lGL -lglib-2.0 -lgobject-2.0 -latk-1.0 -lgio-2.0 -lgthread-2.0 -lgmodule-2.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lpangocairo-1.0 -lpangoft2-1.0 -lpangoxft-1.0 -lgdk-x11-2.0 -lgtk-x11-2.0 -lrt -ldl -lm -lpng -lz -lfreetype -llzma [ 599s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/pcsx2-1.5.0.r23d081ab2/build' [ 599s] [ 67%] Built target GSdx-legacy-1.0.0 [ 600s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/pcsx2-1.5.0.r23d081ab2/build' [ 601s] [ 67%] Built target GSdx [ 601s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/pcsx2-1.5.0.r23d081ab2/build' [ 601s] make: *** [Makefile:131: all] Error 2 [ 601s] error: Bad exit status from /var/tmp/rpm-tmp.FEtOwe (%build) [ 601s] [ 601s] [ 601s] RPM build errors: [ 601s] Bad exit status from /var/tmp/rpm-tmp.FEtOwe (%build) [ 601s] [ 601s] lamb04 failed "build pcsx2.spec" at Mon Feb 6 15:05:45 UTC 2017. [ 601s] [ 601s] ### VM INTERACTION START ### [ 601s] [ 601s] lamb04 failed "build pcsx2.spec" at Mon Feb 6 15:05:45 UTC 2017. [ 601s] [ 601s] ### VM INTERACTION START ### [ 604s] [ 591.605748] sysrq: SysRq : Power Off [ 604s] [ 591.617337] reboot: Power down [ 604s] ### VM INTERACTION END ### [ 604s] [ 604s] lamb04 failed "build pcsx2.spec" at Mon Feb 6 15:05:49 UTC 2017. [ 604s]

gregory38 commented 7 years ago

Hum, the ICE (internal compiler error) could be a buffer overflow/underflow somewhere in GCC code. It must be reported to GCC (or openSuse) as it is a critical regression.

Hirato commented 7 years ago

@Teklad you're an arch user as well? I got that exact same ICE because I modified /etc/makepkg.conf to use -march=native -mtune=native. it went away once I returned it to the defaults of x86-64 and generic respectively.

I also can't build with gcc 6.3.1 anymore. there's a bunch of warnings but the fatal one is this:

/home/hirato/sources/pcsx2-git/src/pcsx2/plugins/zzogl-pg/opengl/rasterfont.cpp: In member function ‘printString.constprop’:
/home/hirato/sources/pcsx2-git/src/pcsx2/plugins/zzogl-pg/opengl/rasterfont.cpp:150:6: error: calling ‘printString.constprop’ with SSE calling convention without SSE/SSE2 enabled
void RasterFont::printString(const char *s, double x, double y, double z)
     ^
/home/hirato/sources/pcsx2-git/src/pcsx2/plugins/zzogl-pg/opengl/rasterfont.cpp:150:6: sorry, unimplemented: this is a GCC bug that can be worked around by adding attribute used to function called
gregory38 commented 7 years ago

Could people stop to build UNSUPPORTED plugins. Please remove the extra build option and retry.

XenonPK commented 7 years ago

I'm having some trouble with the multilib build, cmake says it found PORTAUDIO and SOUNDTOUCH, however, when it gets to spu2x, it reports PORTAUDIO_LIBRARIES and SOUNDTOUCH_LIBRARIES are set to NOTFOUND.

I've added both 64 bit and 32 bit versions of these libraries to the build requirements, however, it still does not find them.

These files are present in the build environment: 32bit libraries: /usr/lib/libportaudio.so.2 /usr/lib/libportaudio.so.2.0.0 /usr/lib/libSoundTouch.so.0 /usr/lib/libSoundTouch.so.0.0.0

64bit libraries: /usr/lib64/libportaudio.so.2 /usr/lib64/libportaudio.so.2.0.0 /usr/lib64/libSoundTouch.so.0 /usr/lib64/libSoundTouch.so.0.0.0

Here's the log: cmake.tar.gz

gregory38 commented 7 years ago

is it the latest git ? I updated something recently.

gregory38 commented 7 years ago

Here the main call. Check that you have the .h ? And where there are located.

cmake/SearchForStuff.cmake:check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h)
cmake/SearchForStuff.cmake:check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h)
XenonPK commented 7 years ago

Just updated to the latest git and the error message is now:

[ 6s] CMake Error at cmake/SelectPcsx2Plugins.cmake:20 (message): [ 6s] Skip build of spu2-x: miss some dependencies:check these libraries -> [ 6s] soundtouch (>=1.5), alsa, portaudio (>=1.9), sdl (>=1.2) pcsx2 common libs [ 6s] Call Stack (most recent call first): [ 6s] cmake/SelectPcsx2Plugins.cmake:256 (print_dep) [ 6s] CMakeLists.txt:62 (include)

I've checked that these are present: /usr/include/soundtouch/SoundTouch.h /usr/include/portaudio.h /usr/include/pa_linux_alsa.h

gregory38 commented 7 years ago

do you have the previous line saying that it didn't found the package.

XenonPK commented 7 years ago

cmake.tar.gz There's the cmake log, and now it reports missing lib for both

gregory38 commented 7 years ago

Did you provide cmake/linux-compiler-i386-multilib.cmake in the option ? Are you lib ok ? Oh wait you miss the libfoo.so (you can do symlink)

XenonPK commented 7 years ago

I figured it out, I was trying a multilib build because I could not get it to build the three different versions of GSdx, however, the build service was not really meant to be used like that. The earlier issue was caused by a leftover cmake option from the last maintainer, even with -DDISABLE_ADVANCE_SIMD=TRUE it was doing -march=native (and causing the random build failures). After removing that cmake option, everything worked as expected. The ICE is definitely caused by setting -march/mtune=native.