joseph-montanez / raylib-php

PHP 8 Bindings to raylib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

configure: error: pkg-config not found

igorfuna opened this issue · comments

I'm trying to buld raylib-php on Raspberry Pi 4.
I get the following error after running ./configure

checking for raylib support... yes, shared
checking whether to enable raylib support... yes, shared
checking for pkg-config... /usr/bin/pkg-config
checking for libraylib... configure: error: pkg-config not found

Please advise.

You need the build tools first:

sudo apt install build-essential autoconf libtool bison re2c

Second, you will need to compile and install raylib itself:

sudo apt-get install --no-install-recommends raspberrypi-ui-mods lxterminal gvfs
sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev libxrandr-dev libxi-dev libasound2-dev mesa-common-dev libgl1-mesa-dev

sudo apt-get install libdrm-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev

More info on Raylib on Raspberry Pi 4: https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi

git clone https://github.com/raysan5/raylib.git
cd raylib
git checkout tags/4.0.0
cd src
make PLATFORM=PLATFORM_DRM
sudo make install

Then you can compile the Raylib-PHP extension:

phpize

./configure
make
make install

Thank you very much for the reply.
I already had the tools and Raylib installed.

The Raylib library is located in
/usr/local/lib/libraylib.a

and works fine.
I can compile c examples and they work.
But I would like to use PHP.

pkg-config is located here:
/usr/bin/pkg-config

When I run ./configure I get

checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... armv7l-unknown-linux-gnueabihf
checking host system type... armv7l-unknown-linux-gnueabihf
checking target system type... armv7l-unknown-linux-gnueabihf
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20180731 -I/usr/include/php/20180731/main -I/usr/include/php/20180731/TSRM -I/usr/include/php/20180731/Zend -I/usr/include/php/20180731/ext -I/usr/include/php/20180731/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
checking for PHP extension directory... /usr/lib/php/20180731
checking for PHP installed headers prefix... /usr/include/php/20180731
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 1.1.1 (ok)
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for raylib support... yes, shared
checking whether to enable raylib support... yes, shared
checking for pkg-config... /usr/bin/pkg-config
checking for libraylib... configure: error: pkg-config not found

Not sure if this is important but pkg-config does not recognize raylib
If I run pkg-config raylib --libs I get

Package raylib was not found in the pkg-config search path.
Perhaps you should add the directory containing `raylib.pc'
to the PKG_CONFIG_PATH environment variable
No package 'raylib' found

raylib.pc doesn't seem to be generated, there is only raylib.pc.in in the Raylib download/compile folder.

Ah, thats most likely due to that the default build system for Raylib does not install the pkg-config files. You can try using CMake:

https://github.com/raysan5/raylib/wiki/Working-with-CMake

This will properly generate the pkg config files