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

Can't Compile on Amlogic s905 after last commits #10626

Closed
shantigilbert opened this issue Feb 19, 2018 · 24 comments
Closed

Can't Compile on Amlogic s905 after last commits #10626

shantigilbert opened this issue Feb 19, 2018 · 24 comments
Labels
SDL2 Issue on SDL (or Qt in SDL code) but not all ports.

Comments

@shantigilbert
Copy link

What happens? Compile ends in error
Using these options PPSSPP used to compile with no problem

                       -DUSING_FBDEV=1  \
                       -DUSING_GLES2=1  \
                       -DUSE_FFMPEG=1  \
                       -DARMV7=1  \
		       -DSHARED_LIBZIP=1 \
                       -DARM_NEON=1"

But now I get this error

/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.2/PPSSPPSDL-78449ce/SDL/SDLGLGraphicsContext.cpp: In member function 'int SDLGLGraphicsContext::Init(SDL_Window*&, int, int, int, std::string*)':
/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.2/PPSSPPSDL-78449ce/SDL/SDLGLGraphicsContext.cpp:87:11: error: 'EGL_Init' was not declared in this scope
  EGL_Init();
           ^
/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.2/PPSSPPSDL-78449ce/SDL/SDLGLGraphicsContext.cpp: In lambda function:
/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.2/PPSSPPSDL-78449ce/SDL/SDLGLGraphicsContext.cpp:121:18: error: 'g_eglDisplay' was not declared in this scope
   eglSwapBuffers(g_eglDisplay, g_eglSurface);
                  ^~~~~~~~~~~~
/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.2/PPSSPPSDL-78449ce/SDL/SDLGLGraphicsContext.cpp:121:32: error: 'g_eglSurface' was not declared in this scope
   eglSwapBuffers(g_eglDisplay, g_eglSurface);
                                ^~~~~~~~~~~~
/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.2/PPSSPPSDL-78449ce/SDL/SDLGLGraphicsContext.cpp:121:44: error: 'eglSwapBuffers' was not declared in this scope
   eglSwapBuffers(g_eglDisplay, g_eglSurface);
                                            ^
/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.2/PPSSPPSDL-78449ce/SDL/SDLGLGraphicsContext.cpp: In member function 'int SDLGLGraphicsContext::Init(SDL_Window*&, int, int, int, std::string*)':
/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.2/PPSSPPSDL-78449ce/SDL/SDLGLGraphicsContext.cpp:117:7: warning: unused variable 'success' [-Wunused-variable]
  bool success = draw_->CreatePresets();
       ^~~~~~~
/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.2/PPSSPPSDL-78449ce/SDL/SDLGLGraphicsContext.cpp: In member function 'virtual void SDLGLGraphicsContext::ShutdownFromRenderThread()':
/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.2/PPSSPPSDL-78449ce/SDL/SDLGLGraphicsContext.cpp:138:12: error: 'EGL_Close' was not declared in this scope
  EGL_Close();
            ^
At global scope:
cc1plus: warning: unrecognized command line option '-Wno-deprecated-register'
make[3]: *** [CMakeFiles/native.dir/build.make:111: CMakeFiles/native.dir/SDL/SDLGLGraphicsContext.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....

Last commit I was using was 5eba689 so a lot has changed since then, do I need to change my compiler options?

What should happen? Finish Compiling

What hardware and operating system are you running PPSSPP on? GPU might matter if it's a graphical issue. Amlogic S905 using Libreelec

@unknownbrackets unknownbrackets added the SDL2 Issue on SDL (or Qt in SDL code) but not all ports. label Feb 19, 2018
@unknownbrackets
Copy link
Collaborator

What if you add here:

class GLRenderManager;

The following:

#if defined(USING_EGL)
#include "EGL/egl.h"
#endif

-[Unknown]

@shantigilbert
Copy link
Author

Thanks for the reply but unfortunately I get the same error :(

@shantigilbert
Copy link
Author

shantigilbert commented Feb 19, 2018

after trying one by one, last compiling Commit is c27d64f but it won't work on the device itself, it just shows a black screen.

@shantigilbert
Copy link
Author

Any idea on how can I fix this?

@unknownbrackets
Copy link
Collaborator

From that it sounds like the Vulkan changes brought this on. But this error:

error: 'EGL_Init' was not declared in this scope

Really should be solved by including EGL.h in that c file. If that's not helping, I'm a bit perplexed.

-[Unknown]

@shantigilbert
Copy link
Author

Thank you for the reply, Is there a way to pass an option to skip vulkan, for systems that don't support it? I am going to compile each commit and see exactly where the error started showing.

@suzuke
Copy link

suzuke commented Feb 26, 2018

Hi, here is a patch for skiping vulkan for -DARMV7=1
patch

We will still have the error due to it is defined at SDL/SDLMain.cpp and not being referenced in SDL/SDLGLGraphicsContext.cpp

error: 'EGL_Init' was not declared in this scope

with this above patch, below commit build fine c27d6

@shantigilbert
Copy link
Author

Thanks @suzuke I will try that and report back :)

@shantigilbert
Copy link
Author

shantigilbert commented Feb 27, 2018

Unfortunately it didn't work :( that commit compiles fine with or without the patch, but it does not work on the device itself (SDL_CreateWindow failed: Could not initialize OpenGL / GLES library
). after that commit no other one compiles :(

I think using -DNO_VULKAN has the same effect, but the main problem is I am not sure why its not finding egl.h.

This is the info I have gathered:

The SDL create window error starts on this commit: e3eb6d3

It seems to me (but I could be very wrong) like the commits to fix Raspberry Pi GLES2 compilation broke other devices, since the egl.h problems seem to start around those commits, unfortunately this is something out of my league to even debug much less even for me to confirm :(

Last good commit that I tried and worked on the S905 is this one 9a732fe

Thanks for all the help.

@suzuke
Copy link

suzuke commented Feb 27, 2018

EGL_Init is a function defined in SDLMain.cpp
(but after the separation of SDLGLGraphicsContext, , SDLGLGraphicsContext using it but didn't reference it
85446d)
It doesn't come from egl.h, so the compile issue is not related to egl.h not being found.

@unknownbrackets
Copy link
Collaborator

Oh, oops, I assumed it was actual EGL without thinking.

In that case, we should really just move EGL_Init over to the new file too, looks like it's only used there. As a temporary workaround, you can put int8_t EGL_Init(); after all the #include lines in SDLGLGraphicsContext.cpp.

Disabling Vulkan on all arm64 devices is not a good idea, since it works quite well on Android arm64 devices.

Anyway, the SDL create window issue may be a problem with the driver when requesting a specific version - try replacing this line:

for (size_t i = 0; i < ARRAY_SIZE(attemptVersions); ++i) {

With:

if (false) {

Does it work again (this is just a hack), or does it still error?

-[Unknown]

@suzuke
Copy link

suzuke commented Feb 27, 2018

There is not only EGL_Init() but also g_eglDisplay, g_eglSurface, eglSwapBuffers, EGL_Close() all has the same issue.
For example, CheckEGLErrors is only defined in SDLMain but it is used in both EGL_Open, EGL_Init.
It would not work if we just move EGL_Init to the new file.

@shantigilbert
Copy link
Author

@unknownbrackets unfortunately that didn't work, there is no error on EGL_Init() anymore but as @suzuke said, there is still errors on the others.

Also the change for the SDL window didn't work :(

@shantigilbert
Copy link
Author

shantigilbert commented Mar 11, 2018

I managed to move forward on this a bit by adding this:

int8_t EGL_Init(); 
static EGLDisplay g_eglDisplay = NULL;
static EGLSurface g_eglSurface = NULL;
int8_t EGL_Close();


but now I get this error:

/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.3/PPSSPPSDL-3c16f84/SDL/SDLVulkanGraphicsContext.cpp: In member function 'bool SDLVulkanGraphicsContext::Init(SDL_Window*&, int, int, int, std::string*)':
/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.3/PPSSPPSDL-3c16f84/SDL/SDLVulkanGraphicsContext.cpp:64:64: error: 'union SDL_SysWMinfo::<anonymous>' has no member named 'x11'
   vulkan_->InitSurface(WINDOWSYSTEM_XLIB, (void*)sys_info.info.x11.display,
                                                                ^~~
/home/sx05re/sx05re/8.2Kszaq/build.Sx05RE-S905.arm-1.8.3/PPSSPPSDL-3c16f84/SDL/SDLVulkanGraphicsContext.cpp:65:37: error: 'union SDL_SysWMinfo::<anonymous>' has no member named 'x11'
     (void *)(intptr_t)sys_info.info.x11.window, pixel_xres, pixel_yres);
make[1]: *** [CMakeFiles/Makefile2:464: CMakeFiles/native.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
At global scope:
cc1plus: warning: unrecognized command line option '-Wno-deprecated-register'
[ 41%] Linking CXX static library ../../lib/libarmips.a
[ 41%] Built target armips
make: *** [Makefile:128: all] Error 2

@shantigilbert
Copy link
Author

shantigilbert commented Mar 13, 2018

Got it to compile with @suzuke 's no vulkan patch (we really don't need it in this device) but now just need to figure out the SDL window creation error. I think this might work, replacing from line

#ifdef USING_GLES2
to


/*
                // maybe this?? 
		mode |= SDL_WINDOW_FULLSCREEN_DESKTOP;
*/

mode |= SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN;
	SDL_GLContext glContext = nullptr;

		SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
		SetGLCoreContext(false);

		window = SDL_CreateWindow("PPSSPP", x,y, pixel_xres, pixel_yres, mode);
		if (!window) {
			NativeShutdown();
			fprintf(stderr, "SDL_CreateWindow failed: %s\n", SDL_GetError());
		}

		glContext = SDL_GL_CreateContext(window);
		if (glContext != nullptr) {
			// Victory, got one.
		}

But I really have no idea what I am doing! so if someone can tell me if this would work and not break anything else I would appreciate it :)

I will post the full patch when I figure this out.

EDIT: it kinda worked, now I don't get an error, but I only get sound and no video :(
btw this is the real error it gives without modifying anything:

SDL_CreateWindow failed: mali-fbdev: Can't create EGL window surface

@shantigilbert
Copy link
Author

@unknownbrackets sorry to be a bother on this, but have you had any time to check this at all? I've been trying so many ways, but the best I could do is get audio with no video, my experience on this is practically null so I am just doing trial and error. It would be great if you could give me more pointers as to how to move forward to fix this. Thank you!

@unknownbrackets
Copy link
Collaborator

I googled around a bit - is your user in the "video" group?

-[Unknown]

@shantigilbert
Copy link
Author

User is always root, LE only has one user.

@hissingshark
Copy link
Contributor

@shantigilbert
When you say

Last commit I was using was 5eba689

Do you mean that built and ran okay?

I've been trying #10534 to build PPSSPP since last year on an S905x and the best I managed was built, but with a black screen at runtime, and no error messages (sound and gamepad working in the background though).

I just checked out that commit and unfortunately that too had the black screen.

@shantigilbert
Copy link
Author

shantigilbert commented May 1, 2018

@hissingshark The last commit that works for me is this one 9a732fe

Not sure what you are using as OS, I am using LibreElec, but to make it work I need to set the color depth to 16 so that it will run.

I use (for 1080p)
fbset -fb /dev/fb0 -g 1920 1080 1920 2160 16

then you can run PPSSPP, if I run it without chaining depth all I get is sound.

But after the changes to SDLGLGraphicsContext.cpp nothing I've tried seems to work anymore.

@hissingshark
Copy link
Contributor

@shantigilbert Well that's most enlightening, thank you! With that setting my v1.5.4 build and the 9a732fe both run.

I wish I'd know about this last year. Because now I can see how badly it's running on my box and I needn't have spent so many nights on it! I've tried downgrading as many setting as I can but can't quite get it playable. Tested GTA and the Burnout games so far. I'll try a bit more tweaking, but I think it's just beyond the SOC, which is understandable (don't know until you try). Having said that, you must have found it acceptable or you wouldn't be trying to build from master?

My OS is OSMC on their Vero4k. It would run better I'm sure if I was running 64-bit as it's aarch64/armv8-a, but unfortunately our userland is 32. I see from the 1st post that you were tricking it into building for armv7 too. I can build most of it 64, but at the final linking stage I get:

[100%] Linking CXX executable PPSSPPSDL
/usr/bin/ld: skipping incompatible /opt/vero3/lib/libGLESv2.so when searching for -lGLESv2
/usr/bin/ld: cannot find -lGLESv2

I assume the video drivers are pre-compiled as 32bit and I can't work around that as the sources aren't available.

@shantigilbert
Copy link
Author

shantigilbert commented May 2, 2018 via email

@unknownbrackets
Copy link
Collaborator

@hissingshark found some useful issues in #10534 which are probably related. There was a mistake in the way GL versions were being attempted. See #11144.

I think there's more information in that other issue (which is older than this one) at this point, so I'm going to close this as a duplicate. If I'm wrong, feel free to comment and I'll reopen.

-[Unknown]

@shantigilbert
Copy link
Author

shantigilbert commented Jun 6, 2018

@unknownbrackets Thanks, although that fixed the SDL window error, when I run it there is still only a black screen with audio. (but you also mentioned that in the other issue)

Also I still had to add this to make it compile

int8_t EGL_Init(); 
static EGLDisplay g_eglDisplay = NULL;
static EGLSurface g_eglSurface = NULL;
int8_t EGL_Close();

Otherwise I would get the same errors as the first post.
not sure what else could be, but you can leave this issue closed and follow up on the other one as it seems it has better info, Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SDL2 Issue on SDL (or Qt in SDL code) but not all ports.
Projects
None yet
Development

No branches or pull requests

4 participants