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

[rcore] Application crash on start-up when compiled with -march=native flag #4630

Open
4 tasks done
Infinityridr opened this issue Dec 21, 2024 · 1 comment
Open
4 tasks done

Comments

@Infinityridr
Copy link

Infinityridr commented Dec 21, 2024

WARNING: Please, read this note carefully before submitting a new issue:

It is important to realise that this is NOT A SUPPORT FORUM, this is for reproducible BUGS with raylib ONLY.

There are lots of generous and helpful people ready to help you out on raylib Discord forum or raylib reddit.

Remember that asking for support questions here actively takes developer time away from improving raylib.


Please, before submitting a new issue verify and check:

  • I tested it on latest raylib version from master branch
  • I checked there is no similar issue already reported
  • I checked the documentation on the wiki
  • My code has no errors or misuse of raylib

Issue description

when building any project with the flag "-march=native", at starting the built program, it crashes 2/3 of the time.
Even the example projects in the site, simpler ones crash less often or never, but more complex ones do crash more.

Build command:

g++ main.cpp -o main.exe -lraylib -lopengl32 -lgdi32 -lwinmm -march=native -LC:\Users\XXX\Downloads\sampleProject -IC:\Users\XXX\Downloads\sampleProject

Build Structure:

the libraylib.a, raylib.h, main.cpp and main.exe in the same folder.

Steps to recreate:

grab any of the examples (like the split-screen one) and compile it with "-march=native" now it will crash or work sometimes when running.

Working Log:

INFO: Initializing raylib 5.5
INFO: Platform backend: DESKTOP (GLFW)
INFO: Supported raylib modules:
INFO: > rcore:..... loaded (mandatory)
INFO: > rlgl:...... loaded (mandatory)
INFO: > rshapes:... loaded (optional)
INFO: > rtextures:. loaded (optional)
INFO: > rtext:..... loaded (optional)
INFO: > rmodels:... loaded (optional)
INFO: > raudio:.... loaded (optional)
INFO: DISPLAY: Device initialized successfully
INFO: > Display size: 1920 x 1080
INFO: > Screen size: 800 x 440
INFO: > Render size: 800 x 440
INFO: > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: Supported extensions count: 230
INFO: GL: OpenGL device information:
INFO: > Vendor: Intel
INFO: > Renderer: Intel(R) UHD Graphics
INFO: > Version: 3.3.0 - Build 27.20.100.8190
INFO: > GLSL: 3.30 - Build 27.20.100.8190
INFO: GL: VAO extension detected, VAO functions loaded successfully
INFO: GL: NPOT textures extension detected, full NPOT textures supported
INFO: GL: DXT compressed textures supported
INFO: GL: ETC2/EAC compressed textures supported
INFO: GL: ASTC compressed textures supported
INFO: PLATFORM: DESKTOP (GLFW - Win32): Initialized successfully
INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Vertex shader compiled successfully
INFO: SHADER: [ID 2] Fragment shader compiled successfully
INFO: SHADER: [ID 3] Program shader loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
INFO: RLGL: Default OpenGL state initialized successfully
INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: SYSTEM: Working Directory: C:\Users\jeroc\Downloads\sampleProject
INFO: TEXTURE: [ID 3] Texture loaded successfully (400x440 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Depth renderbuffer loaded successfully (32 bits)
INFO: FBO: [ID 1] Framebuffer object created successfully
INFO: TEXTURE: [ID 4] Texture loaded successfully (400x440 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 2] Depth renderbuffer loaded successfully (32 bits)
INFO: FBO: [ID 2] Framebuffer object created successfully
INFO: TIMER: Target time per frame: 16.667 milliseconds
INFO: FBO: [ID 1] Unloaded framebuffer from VRAM (GPU)
INFO: FBO: [ID 2] Unloaded framebuffer from VRAM (GPU)
INFO: TEXTURE: [ID 2] Unloaded texture data from VRAM (GPU)
INFO: SHADER: [ID 3] Default shader unloaded successfully
INFO: TEXTURE: [ID 1] Default texture unloaded successfully
INFO: Window closed successfully

Not working Log:

INFO: Initializing raylib 5.5
INFO: Platform backend: DESKTOP (GLFW)
INFO: Supported raylib modules:
INFO: > rcore:..... loaded (mandatory)
INFO: > rlgl:...... loaded (mandatory)
INFO: > rshapes:... loaded (optional)
INFO: > rtextures:. loaded (optional)
INFO: > rtext:..... loaded (optional)
INFO: > rmodels:... loaded (optional)
INFO: > raudio:.... loaded (optional)
INFO: DISPLAY: Device initialized successfully
INFO: > Display size: 1920 x 1080
INFO: > Screen size: 800 x 440
INFO: > Render size: 800 x 440
INFO: > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: Supported extensions count: 230
INFO: GL: OpenGL device information:
INFO: > Vendor: Intel
INFO: > Renderer: Intel(R) UHD Graphics
INFO: > Version: 3.3.0 - Build 27.20.100.8190
INFO: > GLSL: 3.30 - Build 27.20.100.8190
INFO: GL: VAO extension detected, VAO functions loaded successfully
INFO: GL: NPOT textures extension detected, full NPOT textures supported
INFO: GL: DXT compressed textures supported
INFO: GL: ETC2/EAC compressed textures supported
INFO: GL: ASTC compressed textures supported
INFO: PLATFORM: DESKTOP (GLFW - Win32): Initialized successfully
INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Vertex shader compiled successfully
INFO: SHADER: [ID 2] Fragment shader compiled successfully
INFO: SHADER: [ID 3] Program shader loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
INFO: RLGL: Default OpenGL state initialized successfully
INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: SYSTEM: Working Directory: C:\Users\jeroc\Downloads\sampleProject
INFO: TEXTURE: [ID 3] Texture loaded successfully (400x440 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Depth renderbuffer loaded successfully (32 bits)
INFO: FBO: [ID 1] Framebuffer object created successfully
INFO: TEXTURE: [ID 4] Texture loaded successfully (400x440 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 2] Depth renderbuffer loaded successfully (32 bits)
INFO: FBO: [ID 2] Framebuffer object created successfully
INFO: TIMER: Target time per frame: 16.667 milliseconds

Environment

Desktop Laptop Win10
OpenGl 4.6 and OpenGl ES 3.1 compatible.
W64devkit gcc compiler.
i5-10300H cpu
Nividia gtx 1650 ti GPU

Issue Screenshot

Image of the app mere milliseconds before closing forcefully when just run:
Screenshot (11)

Code Example

https://www.raylib.com/examples/core/loader.html?name=core_2d_camera_split_screen
^^^ The example of split-screen is one of the many crash causers.

@Infinityridr
Copy link
Author

Infinityridr commented Dec 21, 2024

Update
Im not very knowledgeable in this stuff but this might be helpful: (split-screen example)

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff75b811729 in main () at main.cpp:87
87 BeginTextureMode(screenCamera1);
Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff75b811729 in main () at main.cpp:87
87 BeginTextureMode(screenCamera1);
[Thread 6832.0x24a0 exited with code 3221225477]
[Thread 6832.0x2958 exited with code 3221225477]
[Thread 6832.0x2274 exited with code 3221225477]
[Thread 6832.0x8a0 exited with code 3221225477]

Exception thrown at 0x00007FF75B811729 in main.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

image
https://discord.com/channels/426912293134270465/661385466766950403/1320127460708454532

For now im just going go with -O3

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

1 participant