Closed paul-hammant closed 1 year ago
Did you use the Makefile_Homebrew Makefile ?
Two Makefile provided. And we are just having a convo on the Element chat about switching to just a Homebrew based Makefile. So go back to just 1 and that's only Homebrew.
If you have sdl installed via Homebrew and prefer that way.
make -f Makefile_Homebrew install
This is yet more weight to the Homebrew only install argument.
I will add a comment to the intro install doc mentioning the two makesfiles.
include
The standard way of installing SDL2 requires that the above line be changed in the C source file to #include <SDL2/SDL.h>
. This works and allows for multiple installations of SDL to be installed (SDL 3 is now current, but that's another topic). I am already having to do this whenever I pull upstream, or I can't get things to compile, even with my homebrew installation.
I would be in favor of having the 'default' method be one that uses -lSDL2
on the command line and the above #include
, as that's what is required for either installing via Homebrew or building and installing SDL from source on macOS or another system.
IIRC, only the very earliest of SDL2 installs required manually installing the framework, which was a big pain. I've only had to do it once on the many macOS systems I have running.
@vygr, you might try running brew install sdl2
(I think that's the correct name) on your system, it can coexist with the framework you've already installed and then we could possibly change to only having and maintaining a single Makefile.
I think the idea of having two Makefiles is an issue for newbies (like myself): frankly, I never even looked for secondary Makefiles, etc. Just typed make
to see what happened. I was able to correct it because I'm using SDL2 for a number of other projects on macOS.
I have just been applying this patch when updating:
diff --git a/Makefile b/Makefile
index f0181f33a..cae570719 100644
--- a/Makefile
+++ b/Makefile
@@ -47,7 +47,7 @@ obj/$(CPU)/$(ABI)/$(OS)/main_gui: $(OBJ_FILES_GUI)
ifeq ($(OS),Darwin)
c++ -o $@ $^ \
-F/Library/Frameworks \
- -framework SDL2
+ -lSDL2
endif
ifeq ($(OS),Linux)
c++ -o $@ $^ \
diff --git a/src/main.cpp b/src/main.cpp
index 5ca7f3f85..ad67010dc 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -35,7 +35,8 @@
#include <libkern/OSCacheControl.h>
#endif
#ifdef _GUI
- #include <SDL.h>
+ #include <SDL2/SDL.h>
#endif
#define VP64_STACK_SIZE 8192
I have Homebrew installed on my Mac and the SDL2 package.
That why I'm leaning towards a Homebrew only make as it does make things easier.
I had Macports at one point but Homebrew proved better (hope that doesn't start a flame war)
Another idea would be to just swap the Makefiles - make the Homebrew version the default Makefile, and see whether anyone complains. If so, have them use the other renamed Makefile_macOSFrameworks. I haven't tested to see whether this method fixes the problematic #include <SDL2/SDL.h>
or not though.
I have just pushed the changes for Homebrew only. I hope this works for everyone. It works here after I deleted my Frameworks folder for sdl, so fingers crossed.
I've added links to the docs to point at Homebrew installer etc.
Yay - confirmed as working for me
Homebrew has a sdl2 package: https://github.com/Homebrew/homebrew-core/blob/master/Formula/sdl2.rb. It installs just fine, it says.
After that though, there is no ..
.. hence
make
barfing.I can see these though:
I'm on 12.6.5 (Monteray) with a 2018 i5 chip, if that matters