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

[Question] Would it be possible to update gcc? #118

Open
DarkBattle0000 opened this issue Jan 22, 2024 · 12 comments
Open

[Question] Would it be possible to update gcc? #118

DarkBattle0000 opened this issue Jan 22, 2024 · 12 comments

Comments

@DarkBattle0000
Copy link

I'm new to the playstation 3 development scene, I started using the toolset not too long ago. But I noticed some interesting things that got in the way of development for the platform. For some reason I have problems compiling projects with -O2 levels, it compiles more does not run, always returns to xmb (I did Code Review, this ok). In search of an answer the idea came to my mind that the flags that -O2 levels add could be the problem, so I decided to test one by one until I get to the -fcode-hoisting flag, for some reason this flag does not allow me to compile with -O2 levels. Searching around a bit, I found a small update from gcc 7.2.0 to gcc 7.5.0, but it seems to be very unstable. But when compiling my project with this update it worked perfectly. The point here is, Would it be possible to update gcc or fix the problem?

@zeldin
Copy link
Member

zeldin commented Jan 25, 2024

Hi! You might want to try out #110 which contains an update to gcc 10. Would be nice to get some more feedback on how that works out for people.

@humbertodias
Copy link

@DarkBattle0000
Try out #121

@cy33hc
Copy link

cy33hc commented Mar 13, 2024

Hi! You might want to try out #110 which contains an update to gcc 10. Would be nice to get some more feedback on how that works out for people.

Built couple of tiny3d samples, but get a black screen and have to power off the ps3 when trying to load from ps3loadx.

@cy33hc
Copy link

cy33hc commented Mar 13, 2024

@DarkBattle0000 Try out #121

Built the toolchain on Ubuntu focal and then built a couple of tiny3d samples. Loaded it via ps3loadx. Same like thing like gcc 10.2.0, I just get black screen and have to poweroff the ps3.

@humbertodias
Copy link

humbertodias commented Mar 13, 2024

@DarkBattle0000 Try out #121

Built the toolchain on Ubuntu focal and then built a couple of tiny3d samples. Loaded it via ps3loadx. Same like thing like gcc 10.2.0, I just get black screen and have to poweroff the ps3.

I'm also facing the black screen using c++ with iostream.h and I'm still investigating the reason.
On the hand pure c it's working.
@DarkBattle0000 try out to generated the pkg and tell me if still fails

docker run -i --rm -v `pwd`:/build -w /build hldtux/ps3dev-sdl2 bash -s <<EOF
echo '#include <SDL.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    SDL_version version;
    SDL_VERSION(&version);
    printf("SDL version %d.%d.%d\n", version.major, version.minor, version.patch);

    // Initialize SDL with video and game controller subsystems
    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) != 0) {
        printf("SDL initialization failed: %s\n", SDL_GetError());
        return 1;
    }

    SDL_Window * window = SDL_CreateWindow(
       "window",
        SDL_WINDOWPOS_UNDEFINED,
        SDL_WINDOWPOS_UNDEFINED,
        480,
        272,
        0
    );

    if (window == NULL) {
        printf("Window creation failed: %s\n", SDL_GetError());
        SDL_Quit();
        return 1;
    }


    // SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
    SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_SOFTWARE);
    if (renderer == NULL) {
        printf("Renderer creation failed: %s\n", SDL_GetError());
        SDL_DestroyWindow(window);
        SDL_Quit();
        return 1;
    }

    SDL_Rect rect = {216, 96, 34, 64};

    int running = 1;
    SDL_Event event;
    while (running) {
        if (SDL_PollEvent(&event)) {
            switch (event.type) {
                case SDL_QUIT:
                        running = 0;
                    break;
                case SDL_CONTROLLERDEVICEADDED:
                    SDL_GameControllerOpen(event.cdevice.which);
                    break;
                case SDL_CONTROLLERBUTTONDOWN:
                    if(event.cbutton.button == SDL_CONTROLLER_BUTTON_START)
                        running = 0;
                    break;
            }
        }

        // Clear the screen
        SDL_RenderClear(renderer);

        // Draw a red square
        SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
        SDL_RenderFillRect(renderer, &rect);

        // Draw everything on a white background
        SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
        SDL_RenderPresent(renderer);
    }

    return 0;
}' > main.c

# compile
ppu-gcc main.c -o main \
-mcpu=cell -I/usr/local/ps3dev/ppu/include \
-I/usr/local/ps3dev/portlibs/ppu/include \
-L/usr/local/ps3dev/portlibs/ppu/lib \
-L/usr/local/ps3dev/spu/spu/lib \
-L/usr/local/ps3dev/ppu/powerpc64-ps3-elf/lib \
-I/usr/local/ps3dev/portlibs/ppu/include/SDL2 -I/usr/local/ps3dev/portlibs/ppu/include -L/usr/local/ps3dev/portlibs/ppu/lib -lSDL2_image -lSDL2 -lm -lgcm_sys -lrsx -lsysutil -lrt -llv2 -lio -laudio

# elf
ppu-strip main -o main.elf
sprxlinker main.elf
fself main.elf main.self
make_self main.elf main.self

# pkg
mkdir -p pkg/USRDIR
make_self_npdrm main.elf pkg/USRDIR/EBOOT.BIN UP0000-ABCDEFG_00-0000000000000000
cp /usr/local/ps3dev/bin/sfo.xml .
sed -i "s/01\.00/2.00/g" sfo.xml
sfo.py --title GAME_TITLE --appid GAME_ID -f sfo.xml pkg/PARAM.SFO
pkg.py --contentid UP0000-ABCDEFG_00-0000000000000000 pkg/ main.pkg

EOF

Screenshot 2024-03-13 at 12 17 48 PM

@cy33hc
Copy link

cy33hc commented Mar 14, 2024

@humbertodias Blacks screen with pkg also.

@humbertodias
Copy link

@humbertodias Blacks screen with pkg also.

Weird! I have tested successfully it on rpcs3 today.
is the black screen only on console or also on rpcs3?

@cy33hc
Copy link

cy33hc commented Mar 14, 2024

@humbertodias Testing on console only. I can try downloading your prebuilt toolchain and try building. What Ubuntu version are you on? I tried running in Focal and I'm getting this error.

./powerpc64-ps3-elf-gcc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found

@humbertodias
Copy link

I'm using ubuntu 24.04 amd64 the same used to publish at releases

You could also use the docker version of toolchain

docker run -it -v`pwd`:/build hldtux/ps3dev

@cy33hc
Copy link

cy33hc commented Mar 14, 2024

Tested with the prebuilt toolchain. Testing on console only.

  1. Built sprite2D sample from tiny3d and black screen on both PKG and ps3loadx
  2. Built the graphics/cairo sample from PSL1GHT and black screen on ps3loadx. This sample does not have option to build a pkg.

@humbertodias
Copy link

humbertodias commented Mar 14, 2024

Unfortunately, I don't have a ps3 for testing.
But, I have successfully tested on rpcs3

How I did to compile sprites 2D and generate the pkg

git clone https://github.com/wargio/tiny3D
docker run -i -v`pwd`:/build hldtux/ps3dev bash -s <<EOF
cd tiny3D
make
cd samples/sprites2D
make pkg
EOF

Then outside the container grab the tiny3D/samples/sprites2D/sprites2D.pkg and drop on rpcs3

image

@humbertodias
Copy link

Tested with the prebuilt toolchain. Testing on console only.

  1. Built sprite2D sample from tiny3d and black screen on both PKG and ps3loadx
  2. Built the graphics/cairo sample from PSL1GHT and black screen on ps3loadx. This sample does not have option to build a pkg.

I found out the problem and fix here humbertodias@bc0c04b
Basically, the app ps3loadx uses the library tiny3D that wasn't on https://github.com/ps3dev/ps3libraries
Therefore, I had pointed to mine https://github.com/humbertodias/ps3libraries that already have the script to install it.
Try to use the latest release of https://github.com/humbertodias/ps3loadx/releases and it should work now.

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

4 participants