Raylib: [build] raylib 2.0 on macOS is confusing and broken.

Created on 14 Mar 2019  路  8Comments  路  Source: raysan5/raylib

Sorry for such long post. TLDR: I'm keen to learn raylib, but am having a hard time with raylib 2.0 on macOS, and am really just sharing the experience in the hope it can be improved.

Using macOS 10.14.3, I installed raylib using Homebrew (as suggested in the wiki), which installed the package without an issue.

Once installed, the wiki does not explain how to use the library, and I couldn't find any other docs on how to compile a raylib example on macOS.

From (very limited) experience from trying raylib on a RPi, I remembered that it bundled a bunch of examples, so thought I'd try to find those. This stuff is probably obvious to people who are more familiar with raylib, but for new users, it's really isn't clear how they get started.

Looking in the system directory that Homebrew installs raylib to (/usr/local/Cellar/raylib/2.0.0) reveals that the examples are not included in the package.

I had a copy of the raylib git repo in my home directory, so tried the examples from there. From the raylib/examples directory, I ran make path PLATFORM=DESKTOP_PLATFORM replacing path with something like core/core_basic_window.

Most of the examples will not compile, and few of those that do compile will run.

Note: A handful of examples from the core directory do compile and run correctly (core_basic_window, core_input_keys, core_input_mouse, core_color_select).

The text_bmfont_ttf example compiled, but when executed, it complained that the font could not be loaded, then stated it will use the default font, then exited unexpectedly, causing the OS to complain too.

When trying physac/physics_demo, it fails to compile with a long list of references (including _InitWindow, _IsKeyDown, _Vector2Add et cetera), saying ld: symbols(s) not found for architecture x86_64. Trying to compile physac/physics_movement produces basically the exact same error.

I have raylib on my RPi3B+ still, so can personally enjoy using it there for now, but wanted to see if something can be done about macOS in general, as my experience with using brew on macOS would have honestly put me off using raylib if I hadn't already had a positive experience with it once before.

All 8 comments

@carlsmith Thanks for reporting, seems most issues are related to not finding required external resources (images, fonts, audios, models...). Unfortunately I don't have a macOS, actually, never had one... and I'm not very fond of that platform since they announced OpenGL support removal...

I'll leave this issue open for anyone willing to contribute.

Once installed, the wiki does not explain how to use the library, and I couldn't find any other docs on how to compile a raylib example on macOS.

cc yourgame.c `pkg-config --libs --cflags raylib`

Ye, should probably be noted in the Wiki.

Looking in the system directory that Homebrew installs raylib to (/usr/local/Cellar/raylib/2.0.0) reveals that the examples are not included in the package.

Why would they? glfw3 or SDL2 don't install their examples either, neither in source or binary form, because that's not the use case. It's there so other packages can depend on it, so you could type brew install yourgame and have it automatically pull in raylib or say in your game's documentation to brew install raylib beforehand. A binary library package should install at most library, headers, documentation and maybe configuration.

I had a copy of the raylib git repo in my home directory, so tried the examples from there. From the raylib/examples directory, I ran make path PLATFORM=DESKTOP_PLATFORM replacing path with something like core/core_basic_window.

Most of the examples will not compile, and few of those that do compile will run.

Homebrew raylib tracks the latest release, which is v2.0.0. If you want examples, you need to git checkout v2.0.0, not master which has seen 9 months of changes since then.

Note: A handful of examples from the core directory do compile and run correctly (core_basic_window, core_input_keys, core_input_mouse, core_color_select).

Because these didn't change too much in the last 9 months.

The text_bmfont_ttf example compiled, but when executed, it complained that the font could not be loaded, then stated it will use the default font, then exited unexpectedly, causing the OS to complain too.

Please check if it happens with the text_bmfont_ttf example included with raylib 2.0.0.

When trying physac/physics_demo, it fails to compile with a long list of references (including _InitWindow, _IsKeyDown, _Vector2Add et cetera), saying ld: symbols(s) not found for architecture x86_64. Trying to compile physac/physics_movement produces basically the exact same error.

Please check this happens with the physics_demo example included with raylib 2.0.0.

I have raylib on my RPi3B+ still, so can personally enjoy using it there for now, but wanted to see if something can be done about macOS in general, as my experience with using brew on macOS would have honestly put me off using raylib if I hadn't already had a positive experience with it once before.

That's unfortunate. We should reword the documentation to note that homebrew packages tracks releases, not master.

I've amended the documentation.

Thank you, @a3f. Your post is very helpful, and things make a lot more sense now.

I'm a Web developer, and still new to C programming, so a lot of the confusion stems from my own ignorance. I'm always at least slightly confused at this stage. I just figured that raylib is promoted as good for beginners, so this kind of feedback (and your response to it) might be useful.

Thanks for your patience.

Unfortunately I don't have a macOS, actually, never had one... and I'm not very fond of that platform since they announced OpenGL support removal...

@raysan5, in my defense, I've only ever had one Apple product. I bought a MBA13 back in 2013, when OS X was much more developer friendly, and my hardware still works fine (and I have Linux installed on everything else), so just haven't upgraded. I'm mainly interested in using raylib on RPi ultimately.

I'll close the issue. Thanks, guys.

One last thing, @a3f: You forgot the -b flag in your comment:

git checkout -b v2.0.0

One more last thing: On Mac, you will get an error when running cc:

/bin/sh: pkg-config: command not found

Running this will fix it:

brew install pkgconfig

I've updated the wiki page, adding this paragraph to the edit that @a3f just made (covering the cc command):

You may get an error, complaining that the pkg-config command was not found. You can use brew install pkgconfig to fix that.

Thank you, @a3f. Your post is very helpful, and things make a lot more sense now.

Great. Please report back if you run into further issues, I use macOS at home, so I might be able to help :)

Was this page helpful?
0 / 5 - 0 ratings