phalcon framework build error

今天在 Redhad 6.6 上遇到問題,會有類似這樣的錯誤。

/tmp/cc2QQ7Ek.s:778709: Error: no such instruction: `shlx %rdx,%rsi,%rdx’
/tmp/cc2QQ7Ek.s:779180: Error: no such instruction: `shlx %rsi,%r10,%rsi’
/tmp/cc2QQ7Ek.s:809631: Error: no such instruction: `shlx %rdx,%rcx,%rdx’
/tmp/cc2QQ7Ek.s:811422: Error: no such instruction: `shlx %rdx,%rcx,%rdx’
/tmp/cc2QQ7Ek.s:814194: Error: no such instruction: `shlx %rdx,%rsi,%rdx’
/tmp/cc2QQ7Ek.s:830004: Error: no such instruction: `shlx %rdx,%rsi,%rdx’


推測是 gcc 抓錯設定(因為上頭已經先安裝其他 library),所以改成自己 make。

在 ubuntu 之外的系統都要自己先 git clone 後下指令做編譯與安裝(official ref),指令只是很簡單的

git clone --depth=1 "git://github.com/phalcon/cphalcon.git"
cd cphalcon/build
sudo ./install

但因為 gcc 有問題,所以要改成先切換到指定的 php 版本與作業系統路徑,然後下 make 與 make install,改用cc做。

[root@localhost 64bits]# /usr/bin/php -v
PHP 7.0.23 (cli) (built: Sep 14 2017 19:04:43) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.23, Copyright (c) 1999-2017, by Zend Technologies
[root@localhost build]# cd php7/64bits/
[root@localhost 64bits]# ./configure --with-php-config=/usr/bin/php-config 
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
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... 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/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking whether to enable phalcon... yes, shared
checking whether HAVE_BUNDLED_PCRE is declared... yes
checking for ext/pcre/php_pcre.h... yes
checking whether HAVE_JSON is declared... yes
checking for ext/json/php_json.h... yes
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from cc object... ok
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 for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc 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
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing libtool commands
[root@localhost 64bits]# make
/bin/sh /var/www/cphalcon/build/php7/64bits/libtool --mode=compile cc  -I. -I/var/www/cphalcon/build/php7/64bits -DPHP_ATOM_INC -I/var/www/cphalcon/build/php7/64bits/include -I/var/www/cphalcon/build/php7/64bits/main -I/var/www/cphalcon/build/php7/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  -DHAVE_CONFIG_H  -g -O2   -c /var/www/cphalcon/build/php7/64bits/phalcon.zep.c -o phalcon.lo 
libtool: compile:  cc -I. -I/var/www/cphalcon/build/php7/64bits -DPHP_ATOM_INC -I/var/www/cphalcon/build/php7/64bits/include -I/var/www/cphalcon/build/php7/64bits/main -I/var/www/cphalcon/build/php7/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 -DHAVE_CONFIG_H -g -O2 -c /var/www/cphalcon/build/php7/64bits/phalcon.zep.c  -fPIC -DPIC -o .libs/phalcon.o
/bin/sh /var/www/cphalcon/build/php7/64bits/libtool --mode=link cc -DPHP_ATOM_INC -I/var/www/cphalcon/build/php7/64bits/include -I/var/www/cphalcon/build/php7/64bits/main -I/var/www/cphalcon/build/php7/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  -DHAVE_CONFIG_H  -g -O2   -o phalcon.la -export-dynamic -avoid-version -prefer-pic -module -rpath /var/www/cphalcon/build/php7/64bits/modules  phalcon.lo 
libtool: link: cc -shared  .libs/phalcon.o      -Wl,-soname -Wl,phalcon.so -o .libs/phalcon.so
libtool: link: ( cd ".libs" && rm -f "phalcon.la" && ln -s "../phalcon.la" "phalcon.la" )
/bin/sh /var/www/cphalcon/build/php7/64bits/libtool --mode=install cp ./phalcon.la /var/www/cphalcon/build/php7/64bits/modules
libtool: install: cp ./.libs/phalcon.so /var/www/cphalcon/build/php7/64bits/modules/phalcon.so
libtool: install: cp ./.libs/phalcon.lai /var/www/cphalcon/build/php7/64bits/modules/phalcon.la
libtool: finish: PATH="/opt/Qt5.7.0/5.7/gcc_64/bin:/opt/Qt5.7.0/5.7/gcc_64/bin:/usr/local/cuda-8.0/lib64:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/ulsee/bin:/root/bin:/sbin" ldconfig -n /var/www/cphalcon/build/php7/64bits/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /var/www/cphalcon/build/php7/64bits/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

[root@localhost 64bits]# make install
Installing shared extensions:     /usr/lib64/php/modules/
Installing header files:          /usr/include/php/
[root@localhost 64bits]# nano /etc/php.d/phalcon.ini
[root@localhost 64bits]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
                                                           [  OK  ]

Leave a Reply

Your email address will not be published. Required fields are marked *