Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

build phalcon in windows, using ZEPHIR 0.9.4b, why the output php_phalcon.dll is so large?

hello, does any one encount questions like me? I TRY TO BUILD PHALCON 3.0 FROM SOURCE IN WINDOWS,USING ZEPHIR (0.9.4b).

  1. build php 5.6.24 with VS2012.
  2. config zephir enviroment as description in zephir documnet.
  3. use " zephir compile " to build phalcon .

The output php_phalcon.dll size is 126M bytes. I don't know how to reduce the output dll files size. any advises? thanks a lot.

below this line is the major config from /cphalcon/ext/Makefile:

PHP_SRC_DIR =E:\1\cphalcon\ext
PHP_CL=cl.exe 
PHP_COMPILER_SHORT=VC11 
PHP_ARCHITECTURE=x64 
LINK=D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\link.exe 
NMAKE=nmake.exe 
MAKE_LIB=lib.exe 
BISON=bison.exe 
RE2C=re2c.exe 
RE2C_FLAGS= 
ZIP=zip.exe 
MC=C:\Program Files (x86)\Windows Kits\8.0\bin\x64\mc.exe 
MT=C:\Program Files (x86)\Windows Kits\8.0\bin\x64\mt.exe 
PHP_PREFIX=C:\php 
BASE_INCLUDES=/I E:\php-sdk\phpdev\vc11\x64\obj\Release\php-5.6.24-devel-VC11-x64/include /I E:\php-sdk\phpdev\vc11\x64\obj\Release\php-5.6.24-devel-VC11-x64/include/main /I E:\php-sdk\phpdev\vc11\x64\obj\Release\php-5.6.24-devel-VC11-x64/include/Zend /I E:\php-sdk\phpdev\vc11\x64\obj\Release\php-5.6.24-devel-VC11-x64/include/TSRM /I E:\php-sdk\phpdev\vc11\x64\obj\Release\php-5.6.24-devel-VC11-x64/include/ext  
CFLAGS_PHP_OBJ=$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS) 
DLL_LDFLAGS=/dll  
LIBS=kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib 
PHP_ZTS_ARCHIVE_POSTFIX=-nts 
PHP_LDFLAGS=$(DLL_LDFLAGS) /nodefaultlib:libcmt 
BUILD_DIR=x64\Release 
PHPDLL=php5.dll 
PHPLIB=php5.lib 
PHP_BUILD=E:\1\cphalcon\ext\no 
CFLAGS=/nologo /FD $(BASE_INCLUDES) /D _WINDOWS /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3   /wd4996   /MP  /LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0 /I "E:\1\cphalcon\ext\no\include"  
LDFLAGS=/libpath:"\"E:\1\cphalcon\ext\no\lib\""  
SNAPSHOT_TEMPLATE=no 
PHP_DIR=E:\php-sdk\phpdev\vc11\x64\obj\Release\php-5.6.24-devel-VC11-x64 
CFLAGS_PHP=/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS /D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500 /D COMPILE_DL_PHALCON 
CFLAGS_BD_1_CPHALCON_EXT= /Fd$(BUILD_DIR)\1\cphalcon\ext\ /Fp$(BUILD_DIR)\1\cphalcon\ext\ /FR$(BUILD_DIR)\1\cphalcon\ext\


60.8k
edited Aug '16

eather its window's fault or you are using php-debug. I know under linux with debug someone said its 300 mb, without it its ~3mb for me.

Write php -v in cmd

VC linker in Windows joins all objects file into single giant file, this in contrast of GCC which properly generates a small file. This is why we have to create a single file with all the Phalcon code to end up with a small file: https://github.com/phalcon/cphalcon/tree/master/build

Andy Gutierrez , thanks. I would try it again, as your reference.

VC linker in Windows joins all objects file into single giant file, this in contrast of GCC which properly generates a small file. This is why we have to create a single file with all the Phalcon code to end up with a small file: https://github.com/phalcon/cphalcon/tree/master/build

Andy , many thanks. I have build php_phalcon.dll from cphalcon/build/64bits source code sucesssed. :-)