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

Unable to build with gcc6 #1691

Closed
John-Gee opened this issue May 10, 2016 · 9 comments
Closed

Unable to build with gcc6 #1691

John-Gee opened this issue May 10, 2016 · 9 comments

Comments

@John-Gee
Copy link
Contributor

Hello,

When I build on Linux with gcc6 it errors on this:

In file included from rpcs3-git/src/rpcs3/rpcs3/Emu/CPU/CPUThread.cpp:6:0:
rpcs3-git/src/rpcs3/rpcs3/Emu/Cell/SPUThread.h:379:31: warning: ignoring attributes on template argument ‘__m128 {aka __vector(4) float}’ [-Wignored-attributes]
std::array<__m128, 155 + 174> m_data;
^
rpcs3-git/src/rpcs3/rpcs3/Emu/Cell/SPUThread.h: In constructor ‘spu_imm_table_t::scale_table_t::scale_table_t()’:
rpcs3-git/src/rpcs3/rpcs3/Emu/Cell/SPUThread.h:386:60: error: ‘exp2’ was not declared in this scope
m_data[i + 155] = _mm_set1_ps(static_cast(exp2(i)));
^
rpcs3/CMakeFiles/rpcs3.dir/build.make:2051: recipe for target 'rpcs3/CMakeFiles/rpcs3.dir/Emu/CPU/CPUThread.cpp.o' failed
make[2]: *** [rpcs3/CMakeFiles/rpcs3.dir/Emu/CPU/CPUThread.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:607: recipe for target 'rpcs3/CMakeFiles/rpcs3.dir/all' failed
make[1]: *** [rpcs3/CMakeFiles/rpcs3.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

I am guessing it is related to this change in gcc:
Header <math.h> changes

The C++ library now provides its own <math.h> header that wraps the C library header of the same name. The C++ header defines additional overloads of some functions and ensures that all standard functions are defined as real functions and not as macros. Code which assumes that sin, cos, pow, isfinite etc. are macros may no longer compile.
https://gcc.gnu.org/gcc-6/porting_to.html

Unfortunately I have been unable to find a way to workaround this.
I hope someone else knows better.

@MrSapps
Copy link

MrSapps commented May 10, 2016

try "using std::exp2;" in that function?

@John-Gee
Copy link
Contributor Author

John-Gee commented May 10, 2016

I feel dumb, yes #include math.h and std:: seem to work.
But, it brings more annoying ones:

rpcs3/rpcs3/Emu/Cell/SPUOpcodes.h: In constructor ‘spu_decoder<D, T>::spu_decoder() [with D = spu_itype::type; T = unsigned int spu_itype::type::]’:
rpcs3/rpcs3/Emu/Cell/SPUOpcodes.h:261:3: internal compiler error: in expand_expr_real_2, at expr.c:8097
[ 57%] Building CXX object rpcs3/CMakeFiles/rpcs3.dir/Emu/Cell/SPUInterpreter.cpp.o
Please submit a full bug report,
with preprocessed source if appropriate.
See https://bugs.archlinux.org/ for instructions.
rpcs3/CMakeFiles/rpcs3.dir/build.make:5021: recipe for target 'rpcs3/CMakeFiles/rpcs3.dir/Emu/Cell/SPUAnalyser.cpp.o' failed
make[2]: *
* [rpcs3/CMakeFiles/rpcs3.dir/Emu/Cell/SPUAnalyser.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
c++: internal compiler error: Segmentation fault (program cc1plus)

@MrSapps
Copy link

MrSapps commented May 10, 2016

Better report the compiler bug, otherwise the only way is to adjust code/narrow down the cause of the crash and rewrite the code so it won't trigger the crash.

@John-Gee
Copy link
Contributor Author

I've reported it to the GCC team, we'll see how that goes.

@John-Gee
Copy link
Contributor Author

It has been accepted as a regression.
I'll keep this bug updated on how it goes.

@John-Gee
Copy link
Contributor Author

I was given a patch that fixes the GCC segfault, I believe that patch will be part of 6.2 but I'm still hoping for 6.1.2 or so.

With that I was able to fix the rest of build issues and create a pull request for it.
I've made the check for GCC 6, even though up to 6.1.1 crashes, because there is nothing that can be easily done for 6.1 and 6.1.1 anyway... (If you're not aware of GCC numbering system, 6.1 is actually the first version in the 6 releases... There is no 6.0 stable build).

@janisozaur
Copy link
Contributor

@John-Gee care to post GCC bug report link?

@John-Gee
Copy link
Contributor Author

Here's one:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70869
It's not mine but it's the active one.

@John-Gee
Copy link
Contributor Author

And it's fixed in GCC 6.2!

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

No branches or pull requests

4 participants