编译HHVM扩展时缺少头文件

时间:2015-07-06 22:40:50

标签: php c++ hhvm

我在这里找到了HHVM的这个齿轮扩展https://github.com/longlong2010/hhvm-gearman,并且考虑尝试一下,现在当我尝试为HHVM构建它但我得到了这个错误。

vagrant@vagrant-ubuntu-trusty-64:~/hhvm/extension-gearman$ cmake . && make
-- Configuring for HHVM API version 20150212
-- gearman Include dir: /usr/include/libgearman
-- libgearman library: /usr/lib/x86_64-linux-gnu/libgearman.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vagrant/hhvm/extension-gearman
[100%] Building CXX object CMakeFiles/gearman.dir/gearman.cpp.o
/home/vagrant/hhvm/extension-gearman/gearman.cpp:17:45: fatal error: hphp/runtime/base/base-includes.h: No such file or directory
 #include "hphp/runtime/base/base-includes.h"
                                             ^
compilation terminated.
make[2]: *** [CMakeFiles/gearman.dir/gearman.cpp.o] Error 1
make[1]: *** [CMakeFiles/gearman.dir/all] Error 2
make: *** [all] Error 2

我的config.cmake文件的内容是

FIND_PATH(GEARMAN_INCLUDE_DIR NAMES gearman.h 
    PATHS /usr/include/libgearman /usr/local/include/libgearman)

FIND_LIBRARY(GEARMAN_LIBRARY NAMES gearman PATHS /usr/lib /usr/local/lib)

IF (GEARMAN_INCLUDE_DIR)
    MESSAGE(STATUS "gearman Include dir: ${GEARMAN_INCLUDE_DIR}")
    MESSAGE(STATUS "libgearman library: ${GEARMAN_LIBRARY}")
ELSE()
    MESSAGE(FATAL_ERROR "Cannot find libgearman library")
ENDIF()

include_directories(${GEARMAN_INCLUDE_DIR})


HHVM_EXTENSION(gearman gearman.cpp)
HHVM_SYSTEMLIB(gearman ext_gearman.php)

target_link_libraries(gearman ${GEARMAN_LIBRARY})

***** EDIT ****** 我通过用hphp / runtime / ext / extension.h替换hphp / runtime / base / base-includes.h来解决上述问题

但是现在我在编译过程中遇到了这个错误

[100%] Building CXX object CMakeFiles/gearman.dir/gearman.cpp.o
In file included from /usr/include/hphp/runtime/ext/extension.h:23:0,
                 from /home/vagrant/hhvm/extension-gearman/gearman.cpp:18:
/usr/include/hphp/runtime/vm/native.h: In instantiation of ‘void HPHP::Native::registerBuiltinFunction(const char*, Fun) [with Fun = bool (*)(HPHP::ObjectData*, HPHP::String&)]’:
/home/vagrant/hhvm/extension-gearman/gearman.cpp:351:4:   required from here
/usr/include/hphp/runtime/vm/native.h:368:3: error: static assertion failed: Arguments on builtin function were not understood types
   static_assert(
   ^
/usr/include/hphp/runtime/vm/native.h: In instantiation of ‘void HPHP::Native::registerBuiltinFunction(const char*, Fun) [with Fun = bool (*)(HPHP::ObjectData*, HPHP::String&, long int)]’:
/home/vagrant/hhvm/extension-gearman/gearman.cpp:360:4:   required from here
/usr/include/hphp/runtime/vm/native.h:368:3: error: static assertion failed: Arguments on builtin function were not understood types
make[2]: *** [CMakeFiles/gearman.dir/gearman.cpp.o] Error 1
make[1]: *** [CMakeFiles/gearman.dir/all] Error 2
make: *** [all] Error 2
ta*, HPHP::String&, long int)]’:
/home/vagrant/hhvm/extension-gearman/gearman.cpp:360:4:   required from here
/usr/include/hphp/runtime/vm/native.h:368:3: error: static assertion failed: Arguments on builtin function were not understood types
make[2]: *** [CMakeFiles/gearman.dir/gearman.cpp.o] Error 1
make[1]: *** [CMakeFiles/gearman.dir/all] Error 2
make: *** [all] Error 2

1 个答案:

答案 0 :(得分:0)

好的我自己修复了,在新版本的HHVM 3.6和3.7中传递的函数应该是指针字符串常量而不仅仅是字符串我只需要替换这个

bool HHVM_METHOD(GearmanWorker, addServer, String& host, int64_t port) {...

用这个

bool HHVM_METHOD(GearmanWorker, addServer, const String& host, int64_t port) {...