Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation broken with GCC6 #1297

Closed
frantisekz opened this issue Apr 17, 2016 · 18 comments
Closed

Compilation broken with GCC6 #1297

frantisekz opened this issue Apr 17, 2016 · 18 comments

Comments

@frantisekz
Copy link
Contributor

Compilation with GCC6 is not working. I've tried to disable simd (--no-simd) but result is same.

[  9%] Building CXX object common/src/Utilities/CMakeFiles/Utilities.dir/CheckedStaticBox.cpp.o
/home/fanys/pcsx2/common/src/x86emitter/cpudetect.cpp: In member function ‘void x86capabilities::SIMD_EstablishMXCSRmask()’:
/home/fanys/pcsx2/common/src/x86emitter/cpudetect.cpp:68:23: error: ‘_fxsave’ was not declared in this scope
  _fxsave(&targetFXSAVE);
                       ^
common/src/x86emitter/CMakeFiles/x86emitter.dir/build.make:86: guide for target „common/src/x86emitter/CMakeFiles/x86emitter.dir/cpudetect.cpp.o“ failes
make[2]: *** [common/src/x86emitter/CMakeFiles/x86emitter.dir/cpudetect.cpp.o] Error 1
CMakeFiles/Makefile2:273: guide for target „common/src/x86emitter/CMakeFiles/x86emitter.dir/all“ failed
make[1]: *** [common/src/x86emitter/CMakeFiles/x86emitter.dir/all] Error 2
@gregory38
Copy link
Contributor

Could you grep -r _fxsave in /usr/lib/gcc ? (Or wherever your distrib put gcc include file)

@frantisekz
Copy link
Contributor Author

/usr/lib/gcc/x86_64-redhat-linux/6.0.0/include/fxsrintrin.h:_fxsave (void *__P)
/usr/lib/gcc/x86_64-redhat-linux/6.0.0/include/fxsrintrin.h:  return __builtin_ia32_fxsave (__P);
/usr/lib/gcc/x86_64-redhat-linux/6.0.0/include/fxsrintrin.h:_fxsave64 (void *__P)
/usr/lib/gcc/x86_64-redhat-linux/6.0.0/include/fxsrintrin.h:    return __builtin_ia32_fxsave64 (__P);

@gregory38
Copy link
Contributor

Hum, on debian I have a 32 bits include (by the way you can grep word with -w)

/usr/lib/gcc/i586-linux-gnu/4.9/include/fxsrintrin.h:_fxsave (void *__P)
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/fxsrintrin.h:_fxsave (void *__P)

Do you still have a gcc 5 install?

@gregory38
Copy link
Contributor

well both files are the same here. Could you post the fxsrintrin.h file? Normally the file is included by x86intrin.h. And enabled by the gcc option -mfxsr

@frantisekz
Copy link
Contributor Author

frantisekz commented Apr 17, 2016

Do you still have a gcc 5 install?

No, that's not possible by default in Fedora - if I want multiple GCC's, I need to compile them and then set PATH to different gcc.

fxsrintrin.h - http://pastebin.com/wJENF7A3

Btw, I don't even have /usr/lib/gcc/i686-redhat-linux/6.0.0/include/fxsrintrin.h on my system.

@gregory38
Copy link
Contributor

Do you have this include /usr/lib/gcc/i686-redhat-linux/6.0.0/include/ path. The file seems to be normal. (aka no change).
Could you check your compilation flag ? You must have -mfxsr in some build_* files if you use --no-simd (otherwise it used to be enabled by default)

@frantisekz
Copy link
Contributor Author

Directory /usr/lib/gcc/i686-redhat-linux/6.0.0/include/ doesn't exist.
I have only 2 files in /usr/lib/gcc/i686-redhat-linux/6.0.0 : libstdc++fs.a libstdc++.so

Could you check your compilation flag ?

I have found this: CXX_FLAGS = -msse -msse2 -mfxsr -march=i686 -pipe -fvisibility=hidden -pthread -fno-builtin-strcmp -fno-builtin-memcmp -mfpmath=sse -Wall -Wno-attributes -Wno-missing-field-initializers -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wno-unused-value -Wstrict-aliasing -Wstrict-overflow=2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -DNDEBUG -O2 -std=c++11 -Wno-invalid-offsetof -pthread -fno-strict-aliasing -Wno-parentheses -Wstrict-aliasing -Wno-char-subscripts -Wno-missing-braces -fno-strict-aliasing -Wno-parentheses -Wstrict-aliasing -Wno-char-subscripts -Wno-missing-braces -DWX_PRECOMP

@jcdenton2k
Copy link

jcdenton2k commented Apr 17, 2016

I found something that might help, at least for Ubuntu:
http://askubuntu.com/questions/26498/choose-gcc-and-g-version

One needs to make sure that the distro is using the proper GCC and G++ versions when multiple versions are installed. I'm not familiar with how other non-Debian distros will work on that issue.

I documented my results here in a non-pcsx2 context:
FreedomBen/rtl8188ce-linux-driver#92 (comment)

The main thing that I know about GCC-6 is that it hasn't seen wide use/release yet among Ubuntu and Ubuntu-based distros.

@frantisekz
Copy link
Contributor Author

I found something that might help

Thanks for help, but this issue is not about choosing different GCC version. It is solution to get pcsx2 compiled, but it's important to have working compilation under latest GCC - this can be achieved by reporting bug to GCC, which will probably take ages to solve or by fixing/modifying application itself.

This issue is not some top priority bug - as you have said, most distributions are using older GCC versions (even Fedora does so, I am running yet to be released Fedora 24).

@gregory38
Copy link
Contributor

Could you try to add this line

#include "x86emitter/x86_intrin.h"

in top of common/src/x86emitter/cpudetect.cpp

@frantisekz
Copy link
Contributor Author

Works with include added. Thanks

@Soukyuu
Copy link

Soukyuu commented May 12, 2016

I'm still getting this trying to build 1.4.0 on arch linux x64, even with #include x86_intrin.h or #include x86emitter/x86_intrin.h - there is also no x86_intrin.h on my system as far as I can tell. gcc-multilib 6.1.1

@Soukyuu
Copy link

Soukyuu commented May 12, 2016

nvm, apparently the code has changed much between 1.4.0 and current git master, so it's not trivial to just add the line - I will try getting the git snapshot to build instead.

@frantisekz
Copy link
Contributor Author

@Soukyuu PCSX2 stable won't probably work with latest GCC unless @gregory38 decides to port fixes to stable and release point release.

I'd recommend you opening a new issue if you have issues with GCC 6.1.

@gregory38
Copy link
Contributor

Yeah I did quite a good jobs :p
I don't have time to install gcc 6 on my debian system (still 4.9). But you're free to help us ;)

@Soukyuu
Copy link

Soukyuu commented May 13, 2016

The current git master compiles fine with 6.1.1, so I don't think there is anything to be done for an older stable version.

@sergiomb2
Copy link

fix build for me on Fedora 24+

diff --git a/common/src/x86emitter/cpudetect.cpp b/common/src/x86emitter/cpudetect.cpp
index b318909..38f506d 100644
--- a/common/src/x86emitter/cpudetect.cpp
+++ b/common/src/x86emitter/cpudetect.cpp
@@ -16,6 +16,7 @@
 #include "PrecompiledHeader.h"
 #include "cpudetect_internal.h"
 #include "internal.h"
+#include "fxsrintrin.h"

 using namespace x86Emitter;

@gregory38
Copy link
Contributor

gregory38 commented Sep 3, 2016

@sergiomb2 thanks you for the patch. I pushed it in the 1.4 branch. Sorry for the delay, I just saw your patch due to another issure report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants