How to compile latest 2.1.x git version

[[email protected]]# php -v
PHP 7.0.4 (cli) (built: Mar  2 2016 09:16:43) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

[[email protected]]# wget https://codeload.github.com/phalcon/cphalcon/zip/2.1.x -O 2.1.x.zip

[[email protected]]# unzip 2.1.x.zip

[[email protected]]# cd cphalcon-2.1.x/build/

[[email protected]]# ./install
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012
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 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 gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for icc... no
checking for suncc... no
checking whether gcc and cc understand -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... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib64/extensions/no-debug-non-zts-20151012
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable phalcon... yes, shared
checking whether HAVE_BUNDLED_PCRE is declared... no
checking whether HAVE_JSON is declared... yes
checking for ext/json/php_json.h... yes
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
/bin/sh /opt/download/cphalcon-2.1.x/build/php5/64bits/libtool --mode=compile gcc  -I. -I/opt/download/cphalcon-2.1.x/build/php5/64bits -DPHP_ATOM_INC -I/opt/download/cphalcon-2.1.x/build/php5/64bits/include -I/opt/download/cphalcon-2.1.x/build/php5/64bits/main -I/opt/download/cphalcon-2.1.x/build/php5/64bits -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DPHALCON_RELEASE -DHAVE_CONFIG_H  -march=native -mtune=native -O2 -fomit-frame-pointer -fvisibility=hidden   -c /opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.c -o phalcon.lo
mkdir .libs
 gcc -I. -I/opt/download/cphalcon-2.1.x/build/php5/64bits -DPHP_ATOM_INC -I/opt/download/cphalcon-2.1.x/build/php5/64bits/include -I/opt/download/cphalcon-2.1.x/build/php5/64bits/main -I/opt/download/cphalcon-2.1.x/build/php5/64bits -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DPHALCON_RELEASE -DHAVE_CONFIG_H -march=native -mtune=native -O2 -fomit-frame-pointer -fvisibility=hidden -c /opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.c  -fPIC -DPIC -o .libs/phalcon.o
In file included from /opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.c:175:0:
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:428:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Mvc_Model_Validator(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:2472:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Logger_Adapter(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:3188:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Application(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:3545:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Dispatcher(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:6197:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Mvc_Router(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:7243:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Assets_Collection(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:8451:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Cli_Console(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:8494:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Cli_Dispatcher(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:8570:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Cli_Router(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:10291:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Debug_Dump(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:11039:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Forms_Form(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:11821:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Http_Response_Headers(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:12180:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Loader(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:12678:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Mvc_Collection(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:14792:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Mvc_Model_MetaData_Apc(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:14821:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Mvc_Model_MetaData_Files(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:14851:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Mvc_Model_MetaData_Libmemcached(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:14882:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Mvc_Model_MetaData_Memcache(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:14912:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Mvc_Model_MetaData_Memory(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:14942:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Mvc_Model_MetaData_Redis(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:15046:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Mvc_Model_MetaData_Xcache(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:16107:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Mvc_Router_Annotations(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:18356:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Translate_Adapter_Csv(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.h:18738:1: error: unknown type name ‘zend_object_value’
 static zend_object_value zephir_init_properties_Phalcon_Validation_Message_Group(zend_class_entry *class_type TSRMLS_DC);
 ^
/opt/download/cphalcon-2.1.x/build/php5/64bits/phalcon.zep.c:184:40: fatal error: ext/standard/php_smart_str.h: No such file or directory
 #include <ext/standard/php_smart_str.h>
                                        ^
compilation terminated.
make: *** [phalcon.lo] Error 1


15.5k

So I have to compile Zephir 0.9.2a-dev manually? The above steps work on version 1.x and 2.0.x.

yes, if u have PHP7 u can install Zephir 0.9.2a-dev and install PhalconPHP 2.1.0+

So I have to compile Zephir 0.9.2a-dev manually? The above steps work on version 1.x and 2.0.x.



61.0k
  1. Make sure php -v says php7, php-config and phpize should be "pointing" to php7 ones. if you are running ubuntu
ll /etc/alternatives/ | grep "php"
  1. git clone zephir
  2. cd zephir/parser
  3. 4.
make clean
phpize --clean
    5.
cd phalcon
git checkout 2.1.x
git pull origin 2.1.x

zehpir build --zendEngine=3

then the extension will be installed in your php7 extension enviorment. in my case its something like /opt/php-7/lib/php/extensions/no-debug-non-zts-20151012/ inside you will have phalcon.so.

place the fullpath to phalcon.so in the CORRECT php.ini and voya its mostly working.

Yes you need to use zephir to build phalcon. Current code used in your example are for php 5.x build. You need to compile first zephir classes for php7.