php-sdl icon indicating copy to clipboard operation
php-sdl copied to clipboard

Problems on M1 Monterey

Open cgrabenstein opened this issue 2 years ago • 0 comments

I installed sdl via brew: $ brew install sdl2

Then I tried to install php-sdl via pecl, bit it failed with

/private/tmp/pear/temp/sdl/src/php_sdl.h:42:10: fatal error: 'SDL2/SDL.h' file not found
#include <SDL2/SDL.h>
         ^~~~~~~~~~~~
1 error generated.

However, I managed to build and install it manually, but I had to edit the Makefile. I changed the line

INCLUDES = -I/opt/homebrew/Cellar/php/8.2.6/include/php -I/opt/homebrew/Cellar/php/8.2.6/include/php/main -I/opt/homebrew/Cellar/php/8.2.6/include/php/TSRM -I/opt/homebrew/Cellar/php/8.2.6/include/php/Zend -I/opt/homebrew/Cellar/php/8.2.6/include/php/ext -I/opt/homebrew/Cellar/php/8.2.6/include/php/ext/date/lib -I/opt/homebrew/include/SDL2

to

INCLUDES = -I/opt/homebrew/Cellar/php/8.2.6/include/php -I/opt/hCellar/php/8.2.6/include/php/main -I/opt/homebrew/Cellar/php/8.2.6/include/php/TSRM -I/opt/homebrew/Cellar/php/8.2.6/include/php/Zend -I/opt/homebrew/Cellar/php/8.2.6/include/php/ext -I/opt/homebrew/Cellar/php/8.2.6/include/php/ext/date/lib -I/opt/homebrew/include/SDL2 -I/opt/homebrew/include

The only change is the added -I/opt/homebrew/include.

After building, I ran make test and got three failed tests. See php_test_results_20230513_1945.txt for details.

Eventually everything seems to work, but maybe this issue will help others that struggle with the same or similar issues.

cgrabenstein avatar May 13 '23 19:05 cgrabenstein