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

[Improvement] Raylib renderer segfaults if fonts fail to load #32

Open
LucasMW opened this issue Sep 30, 2024 · 5 comments
Open

[Improvement] Raylib renderer segfaults if fonts fail to load #32

LucasMW opened this issue Sep 30, 2024 · 5 comments

Comments

@LucasMW
Copy link

LucasMW commented Sep 30, 2024

Can't run on Mac OS Sonoma
image
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: SYSTEM: Working Directory: /Users/lucassousa
WARNING: FILEIO: [resources/profile-picture.png] Failed to open file
WARNING: IMAGE: Data is not valid to load texture
WARNING: FILEIO: [resources/Roboto-Regular.ttf] Failed to open file
WARNING: FILEIO: [resources/Roboto-Regular.ttf] Failed to open file
zsh: segmentation fault

@nicbarker nicbarker changed the title Crash [Bug] Potential issue on Mac OSX Sonoma Sep 30, 2024
@nicbarker
Copy link
Owner

nicbarker commented Sep 30, 2024

Hello, sorry to hear that you're having issues. It appears from the log the example isn't able to load the font files from the disk, so the renderer is segfaulting when trying to measure text. Would you be able to tell me about your toolchain? Are you running the examples with CMake?

@LucasMW
Copy link
Author

LucasMW commented Sep 30, 2024

Hello. Thanks for the swift reply
I tried some things and was actually able to run one of the examples, namely raylib-sidebar-scrolling-container:
image
Yes, I am using cmake, mkdir build; cd build; cmake ..; make; typical workflow.
clay_examples_cpp_project_example builds, but running does nothing. (I don't know if it is intended)
The official website I seem to have a problem with generating code for the target wasm32
Generating with cmake builds, but the binary does nothing:
./clay_official_website (does nothing)
Using sh build.sh leads to

error: unable to create target: 'No available targets are compatible with triple "wasm32"'

I tried changing the target options and changing the compiler but got nowhere.

clang --version

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

cmake --version

cmake version 3.30.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Tried using zig cc as well:

zig version

0.12.0

@nicbarker
Copy link
Owner

nicbarker commented Sep 30, 2024

@LucasMW Thanks for the info, I will get the documentation cleaned up a bit. Just for posterity:

  • The C++ project is just there as a stub at the moment and for tests, to make sure that the build still works and we maintain C++20 syntax compatibility with any changes.
  • The official website CMakeLists.txt is just there because I personally use CLion, and it refuses to give me intellisense if files aren't included in a cmake project. As you discovered the build should be done through build.sh 🙂

I suspect that you may have to install llvm via brew to get the wasm example to compile, as clang goes out to llvm for it's wasm compile target. Let me know if you have issues and I can try to dig up the process I used. (Note to self: document this properly)

@nicbarker nicbarker changed the title [Bug] Potential issue on Mac OSX Sonoma [Improvement] Raylib renderer segfaults if fonts fail to load Sep 30, 2024
@LucasMW
Copy link
Author

LucasMW commented Oct 1, 2024

Hello!
I managed to make the website work using zig cc 0.14.0+ (master branch by now)
--- a/examples/clay-official-website/build.sh
+++ b/examples/clay-official-website/build.sh

-&& clang
+&& zig-macos-x86_64-0.14.0-dev.1694+3b465ebec/zig cc \

---target=wasm32
+--target=wasm32-freestanding \

image

@nicbarker
Copy link
Owner

@LucasMW Apologies for the delayed response, I forgot to reply. That's awesome, well done! 😁

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

2 participants