Closed matheusfaustino closed 6 years ago
If it helps, I've followed the following procedure (this is for PHP 7.2):
mkdir -p /opt/ && cd /opt
# Install libui dependency
git clone git://github.com/andlabs/libui
cd libui
# ui extension currently only works with alpha3.5 version of libui
git checkout alpha3.5
mkdir -p build
cd build
cmake ..
make
cd ..
# Copy/install header and generated shared object files to system folders, this is for Ubuntu/Debian:
install ui.h /usr/include/
install ui_unix.h /usr/include/
install build/out/libui.so /usr/lib/
install build/out/libui.so.0 /usr/lib/
Then the ui extension installation:
/opt
git clone git://github.com/krakjoe/ui
cd ui
patch -p1 < ../box.patch
phpize
./configure
make
cp /opt/ui/modules/ui.so /usr/local/lib/php/extensions/no-debug-non-zts-20170718/
echo 'extension=ui' > /usr/local/etc/php/conf.d/ui.ini
Patch file (already sent as a pull request):
--- a/classes/box.c
+++ b/classes/box.c
@@ -185,7 +185,7 @@
} /* }}} */
#if PHP_VERSION_ID >= 70200
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(php_ui_box_is_padded_info, 0, 0, _IS_BOOL, NULL, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(php_ui_box_is_padded_info, 0, 0, _IS_BOOL, 0)
#else
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(php_ui_box_is_padded_info, 0, 0, _IS_BOOL, NULL, 0)
#endif
And the following should output the ini configs:
php --ri ui
Output:
ui
ui support => enabled
Hi @petk, thanks for your help and for your time. The libui installation worked well on your way, but the extension, sadly, no :( .
I forgot to mention the env I'm trying to do that. It's basically a fresh install of Ubuntu 18.04.
PHP Version (it's 7.2.5):
PHP 7.2.5-0ubuntu0.18.04.1 (cli) (built: May 9 2018 17:21:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.5-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
Even after all your tutorial I still getting the same error and I run make in the extension folder, after the ./configure.
/bin/bash /opt/ui/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/ui -DPHP_ATOM_INC -I/opt/ui/include -I/opt/ui/main -I/opt/ui -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /opt/ui/ui.c -o ui.lo
libtool: compile: cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/ui -DPHP_ATOM_INC -I/opt/ui/include -I/opt/ui/main -I/opt/ui -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /opt/ui/ui.c -fPIC -DPIC -o .libs/ui.o
In file included from /opt/ui/ui.c:76:0:
./classes/descriptor.h:27:2: error: unknown type name ‘uiDrawTextFontDescriptor’
uiDrawTextFontDescriptor d;
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/ui/ui.c:77:0:
./classes/font.h:24:2: error: unknown type name ‘uiDrawTextFont’
uiDrawTextFont* f;
^~~~~~~~~~~~~~
./classes/font.h:25:2: error: unknown type name ‘uiDrawTextFontMetrics’
uiDrawTextFontMetrics m;
^~~~~~~~~~~~~~~~~~~~~
/opt/ui/ui.c: In function ‘zif_fontFamilies’:
/opt/ui/ui.c:385:2: error: unknown type name ‘uiDrawFontFamilies’; did you mean ‘uiDrawTextAlign’?
uiDrawFontFamilies* families;
^~~~~~~~~~~~~~~~~~
uiDrawTextAlign
/opt/ui/ui.c:394:13: warning: implicit declaration of function ‘uiDrawListFontFamilies’; did you mean ‘zif_fontFamilies’? [-Wimplicit-function-declaration]
families = uiDrawListFontFamilies();
^~~~~~~~~~~~~~~~~~~~~~
zif_fontFamilies
/opt/ui/ui.c:394:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
families = uiDrawListFontFamilies();
^
/opt/ui/ui.c:395:30: warning: implicit declaration of function ‘uiDrawFontFamiliesNumFamilies’ [-Wimplicit-function-declaration]
for (familiy = 0; familiy < uiDrawFontFamiliesNumFamilies(families); familiy++) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ui/ui.c:396:39: warning: implicit declaration of function ‘uiDrawFontFamiliesFamily’; did you mean ‘zif_fontFamilies’? [-Wimplicit-function-declaration]
add_next_index_string(return_value, uiDrawFontFamiliesFamily(families, familiy));
^~~~~~~~~~~~~~~~~~~~~~~~
zif_fontFamilies
/opt/ui/ui.c:396:39: warning: passing argument 2 of ‘add_next_index_string’ makes pointer from integer without a cast [-Wint-conversion]
In file included from /usr/include/php/20170718/main/php.h:40:0,
from /opt/ui/ui.c:25:
/usr/include/php/20170718/Zend/zend_API.h:450:14: note: expected ‘const char *’ but argument is of type ‘int’
ZEND_API int add_next_index_string(zval *arg, const char *str);
^~~~~~~~~~~~~~~~~~~~~
/opt/ui/ui.c:399:2: warning: implicit declaration of function ‘uiDrawFreeFontFamilies’; did you mean ‘zif_fontFamilies’? [-Wimplicit-function-declaration]
uiDrawFreeFontFamilies(families);
^~~~~~~~~~~~~~~~~~~~~~
zif_fontFamilies
Makefile:195: recipe for target 'ui.lo' failed
make: *** [ui.lo] Error 1
I think this is the issue of not checking out the Alpha 3.5 version of libui from the Git repository. There are removed uiDrawText* things so maybe that's the reason.
Or another reason, try also checking out the latest release v2.0.0 of the ui extension...
@petk
You are right, my problem has been solved
I can't get it done :/ Could you say what you did @dormscript , please?
@matheusfaustino , using the way @petk said. Check out https://github.com/andlabs/libui/releases/tag/alpha3.5, do not use the latest commit.
Just tried, and successed.
sadly, I could not make it. I don't know what more I can try :/
Here is the error (it's the same of before):
/bin/bash /opt/ui/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/ui -DPHP_ATOM_INC -I/opt/ui/include -I/opt/ui/main -I/opt/ui -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /opt/ui/ui.c -o ui.lo
libtool: compile: cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/ui -DPHP_ATOM_INC -I/opt/ui/include -I/opt/ui/main -I/opt/ui -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /opt/ui/ui.c -fPIC -DPIC -o .libs/ui.o
In file included from /opt/ui/ui.c:76:0:
./classes/descriptor.h:27:2: error: unknown type name ‘uiDrawTextFontDescriptor’
uiDrawTextFontDescriptor d;
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/ui/ui.c:77:0:
./classes/font.h:24:2: error: unknown type name ‘uiDrawTextFont’
uiDrawTextFont* f;
^~~~~~~~~~~~~~
./classes/font.h:25:2: error: unknown type name ‘uiDrawTextFontMetrics’
uiDrawTextFontMetrics m;
^~~~~~~~~~~~~~~~~~~~~
/opt/ui/ui.c: In function ‘zif_fontFamilies’:
/opt/ui/ui.c:385:2: error: unknown type name ‘uiDrawFontFamilies’; did you mean ‘uiDrawTextAlign’?
uiDrawFontFamilies* families;
But the types are there, in the files inside /usr/include/
:
/usr/include: sudo grep -r 'uiDrawTextFontDescriptor' .
./ui.h:typedef struct uiDrawTextFontDescriptor uiDrawTextFontDescriptor;
./ui.h:struct uiDrawTextFontDescriptor {
./ui.h:_UI_EXTERN uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc);
./ui.h:_UI_EXTERN void uiDrawTextFontDescribe(uiDrawTextFont *font, uiDrawTextFontDescriptor *desc)
I already tried libui@alpha3.5 and libui@alpha3.1 with ui@v2.0.0 and ui@develop (with and without patch). I don't know if it's a problem with ubuntu... I think I'll try with arch.
Thank you all for the time and patience.
I just tested what @petk told to do on Arch and it worked like a charm. Maybe the problem is related with ubuntu or debian, I dunno know.
I test the build on a fresh ubuntu 18.04 installation and it worked too. :/ Well, probably is something about my machine.
I built it under window 10 without problem.
Hi, I'm gonna close it. The build worked on my osx and that is fine. Sadly, on my ubuntu it didn't. Maybe a problem with ubuntu, ubuntu is a little weird. But, thanks everyone and thanks @petk for tutorial.
@matheusfaustino For me, the problem on my Ubuntu based distro was the location of the header files when installing libui.
Try to store them in /usr/local/include
:
install ui.h /usr/local/include
install ui_unix.h /usr/local/include
install build/out/libui.so /usr/lib/
install build/out/libui.so.0 /usr/lib/
Note: to run the snake demo on Elementary 0.4.1 Loki (based on Ubuntu 16.04) I had to compile the HarfBuzz library by myself.
When I tried to run it, I've get the following message:
php: symbol lookup error: /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined symbol: hb_glib_script_to_script
Following the clue that I found here, I've downlaoded the 1.0.6 version as my system was using the 1.0.* branch, then compiled and installed with the following commands:
./configure --prefix=/usr --with-gobject &&
make
sudo make install
And, voilà!
box.patch
Hello @petk, I want to know where is box.patch? Thanks!
@wenzhizhong it was the diff in the next code section above. This one:
--- a/classes/box.c
+++ b/classes/box.c
@@ -185,7 +185,7 @@
} /* }}} */
#if PHP_VERSION_ID >= 70200
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(php_ui_box_is_padded_info, 0, 0, _IS_BOOL, NULL, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(php_ui_box_is_padded_info, 0, 0, _IS_BOOL, 0)
#else
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(php_ui_box_is_padded_info, 0, 0, _IS_BOOL, NULL, 0)
#endif
Hello guys, first of all, thank you very much for your work and time to create this. But sadly, I'm getting an error when I tried to install it in my linux, could you help me with that?
I'm following the tutorial of installation from here http://php.net/manual/en/ui.setup.php. I installed the last version of Libui.
Thank you in advance.
Error message: