我正在尝试在我的mac(10.13.3)上编译libevhtp
(https://github.com/criticalstack/libevhtp),但cmake
进程似乎不考虑/usr/local/include
(因此找不到所需的libevent
标题):
16:43:42 me:~/Development/libevhtp/build> cmake -DCMAKE_INCLUDE_PATH=/usr/local/include ..
-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is AppleClang 9.1.0.9020039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find ONIGURUMA (missing: ONIGURUMA_LIBRARY ONIGURUMA_INCLUDE_DIR)
-- Looking for strndup
-- Looking for strndup - found
-- Looking for strnlen
-- Looking for strnlen - found
-- Looking for include file stdlib.h
-- Looking for include file stdlib.h - found
-- Looking for include file string.h
-- Looking for include file string.h - found
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file errno.h
-- Looking for include file errno.h - found
-- Looking for include file strings.h
-- Looking for include file strings.h - found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found
-- Looking for include file limits.h
-- Looking for include file limits.h - found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for include file stdarg.h
-- Looking for include file stdarg.h - found
-- Looking for include file sys/tree.h
-- Looking for include file sys/tree.h - not found
-- Looking for include file sys/queue.h
-- Looking for include file sys/queue.h - found
-- Looking for include file sys/un.h
-- Looking for include file sys/un.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of int
-- Check size of int - done
-- Check size of long
-- Check size of long - done
-- Check size of short
-- Check size of short - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Performing Test has_c99
-- Performing Test has_c99 - Success
-- Performing Test has_stack_protector
-- Performing Test has_stack_protector - Success
...
-- Found LIBEVENT: /usr/local/lib/libevent.dylib;/usr/local/lib/libevent_openssl.dylib;/usr/local/lib/libevent_core.dylib;/usr/local/lib/libevent_extra.dylib;/usr/local/lib/libevent_pthreads.dylib;/usr/local/lib/libevent_extra.dylib
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_INCLUDE_DIR)
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Could NOT find ONIGURUMA (missing: ONIGURUMA_LIBRARY ONIGURUMA_INCLUDE_DIR)
-- ONIGURUMA NOT FOUND, DISABLING REGEX SUPPORT
尝试编译:
16:51:34 me:~/Development/libevhtp/build> make
[ 20%] Building C object CMakeFiles/evhtp.dir/evhtp.c.o
/Users/myself/Development/libevhtp/evhtp.c:30:10: fatal error: 'event2/dns.h' file not found
#include <event2/dns.h>
^~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/evhtp.dir/evhtp.c.o] Error 1
make[1]: *** [CMakeFiles/evhtp.dir/all] Error 2
make: *** [all] Error 2
但该文件存在:
16:51:36 me:~/Development/libevhtp/build> ll /usr/local/include/event2/dns.h
-rw-r--r-- 1 myself admin 26K Jan 26 2017 /usr/local/include/event2/dns.h
我不熟悉cmake,所以我不知道如何解决这个问题。我试过cmake -DCMAKE_INCLUDE_PATH=/usr/local/include ..
,但没有帮助。