libPhenom 编译
来源:互联网 发布:微信众筹源码 编辑:程序博客网 时间:2024/06/08 07:01
安装 http://c-ares.haxx.se/
安装 http://concurrencykit.org/
编译步骤:
$ ./autogen.sh$ ./configure$ make$ make check$ sudo make install
[root@s3 libphenom-master]# ./configure checking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking target system type... x86_64-unknown-linux-gnuchecking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking for a thread-safe mkdir -p... /bin/mkdir -pchecking for gawk... gawkchecking whether make sets $(MAKE)... yeschecking for style of include used by make... GNUchecking for gcc... gccchecking for C compiler default output file name... a.outchecking whether the C compiler works... yeschecking whether we are cross compiling... nochecking for suffix of executables... checking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether gcc accepts -g... yeschecking for gcc option to accept ISO C89... none neededchecking dependency style of gcc... gcc3checking for a sed that does not truncate output... /bin/sedchecking for grep that handles long lines and -e... /bin/grepchecking for egrep... /bin/grep -Echecking for fgrep... /bin/grep -Fchecking for ld used by gcc... /usr/bin/ldchecking if the linker (/usr/bin/ld) is GNU ld... yeschecking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -Bchecking the name lister (/usr/bin/nm -B) interface... BSD nmchecking whether ln -s works... yeschecking the maximum length of command line arguments... 1966080checking whether the shell understands some XSI constructs... yeschecking whether the shell understands "+="... yeschecking for /usr/bin/ld option to reload object files... -rchecking for objdump... objdumpchecking how to recognize dependent libraries... pass_allchecking for ar... archecking for strip... stripchecking for ranlib... ranlibchecking command to parse /usr/bin/nm -B output from gcc object... okchecking how to run the C preprocessor... gcc -Echecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking for dlfcn.h... yeschecking for objdir... .libschecking if gcc supports -fno-rtti -fno-exceptions... nochecking for gcc option to produce PIC... -fPIC -DPICchecking if gcc PIC flag -fPIC -DPIC works... yeschecking if gcc static flag -static works... nochecking if gcc supports -c -o file.o... yeschecking if gcc supports -c -o file.o... (cached) yeschecking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yeschecking whether -lc should be explicitly linked in... nochecking dynamic linker characteristics... GNU/Linux ld.sochecking how to hardcode library paths into programs... immediatechecking whether stripping libraries is possible... yeschecking if libtool supports shared libraries... yeschecking whether to build shared libraries... yeschecking whether to build static libraries... yeschecking for gcc... (cached) gccchecking whether we are using the GNU C compiler... (cached) yeschecking whether gcc accepts -g... (cached) yeschecking for gcc option to accept ISO C89... (cached) none neededchecking dependency style of gcc... (cached) gcc3checking whether byte ordering is bigendian... nochecking for inline... inlinechecking whether gcc and cc understand -c and -o together... yeschecking dependency style of gcc... gcc3checking for library containing pthread_create... -lpthreadchecking for library containing socket... none requiredchecking for library containing clock_gettime... -lrtchecking for library containing inet_pton... none requiredchecking for python... /usr/bin/pythonchecking for pkg-config... /usr/bin/pkg-configchecking for php... /usr/bin/phpchecking alloca.h usability... yeschecking alloca.h presence... yeschecking for alloca.h... yeschecking for inttypes.h... (cached) yeschecking locale.h usability... yeschecking locale.h presence... yeschecking for locale.h... yeschecking port.h usability... nochecking port.h presence... nochecking for port.h... nochecking pthread.h usability... yeschecking pthread.h presence... yeschecking for pthread.h... yeschecking stdbool.h usability... yeschecking stdbool.h presence... yeschecking for stdbool.h... yeschecking stddef.h usability... yeschecking stddef.h presence... yeschecking for stddef.h... yeschecking for stdint.h... (cached) yeschecking for string.h... (cached) yeschecking sys/inotify.h usability... yeschecking sys/inotify.h presence... yeschecking for sys/inotify.h... yeschecking sys/epoll.h usability... yeschecking sys/epoll.h presence... yeschecking for sys/epoll.h... yeschecking sys/event.h usability... nochecking sys/event.h presence... nochecking for sys/event.h... nochecking sys/eventfd.h usability... yeschecking sys/eventfd.h presence... yeschecking for sys/eventfd.h... yeschecking sys/param.h usability... yeschecking sys/param.h presence... yeschecking for sys/param.h... yeschecking sys/processor.h usability... nochecking sys/processor.h presence... nochecking for sys/processor.h... nochecking sys/procset.h usability... nochecking sys/procset.h presence... nochecking for sys/procset.h... nochecking sys/resource.h usability... yeschecking sys/resource.h presence... yeschecking for sys/resource.h... yeschecking sys/timerfd.h usability... yeschecking sys/timerfd.h presence... yeschecking for sys/timerfd.h... yeschecking for sys/cpuset.h... nochecking for pthread_np.h... nochecking for accept4... yeschecking for asprintf... yeschecking for backtrace... yeschecking for backtrace_symbols... yeschecking for backtrace_symbols_fd... yeschecking for clock_gettime... yeschecking for cpuset_setaffinity... nochecking for epoll_create... yeschecking for epoll_create1... yeschecking for getpagesize... yeschecking for inotify_init... yeschecking for kqueue... nochecking for localeconv... yeschecking for pipe2... yeschecking for port_create... nochecking for processor_bind... nochecking for pthread_getname_np... yeschecking for pthread_set_name_np... nochecking for pthread_setname_np... yeschecking for pthread_setaffinity_np... yeschecking for pthread_mach_thread_np... nochecking for strerror_r... yeschecking for strtoll... yeschecking for sysctlbyname... nochecking for thread_policy_set... nochecking for timerfd_create... yesconfigure: creating ./config.statusconfig.status: creating Makefileconfig.status: creating libphenom.pcconfig.status: creating include/phenom_build_config.hconfig.status: include/phenom_build_config.h is unchangedconfig.status: creating include/phenom/feature_test.hconfig.status: include/phenom/feature_test.h is unchangedconfig.status: executing depfiles commandsconfig.status: executing libtool commands
错误1:
修改cpplint.py, def CheckForHeaderGuard(filename, lines, error):
原因:未知,github上下载的最新代码, 不过这个可以忽略。
直接return
[root@s3 libphenom-master]# make install
./thirdparty/clint.sh
include/phenom/stream.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_STREAM_H [build/header_guard] [5]
corelib/log.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_CORELIB_LOG_H [build/header_guard] [5]
include/phenom/memory.h:24: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_MEMORY_H [build/header_guard] [5]
corelib/counter.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_CORELIB_COUNTER_H [build/header_guard] [5]
corelib/gimli/gimli.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_CORELIB_GIMLI_GIMLI_H [build/header_guard] [5]
include/phenom/variant.h:284: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_VARIANT_H [build/header_guard] [5]
include/phenom/dns.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_DNS_H [build/header_guard] [5]
corelib/job.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_CORELIB_JOB_H [build/header_guard] [5]
include/phenom/timerwheel.h:41: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_TIMERWHEEL_H [build/header_guard] [5]
include/phenom/printf.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_PRINTF_H [build/header_guard] [5]
include/phenom/counter.h:78: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_COUNTER_H [build/header_guard] [5]
include/phenom/job.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_JOB_H [build/header_guard] [5]
include/phenom/configuration.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_CONFIGURATION_H [build/header_guard] [5]
include/phenom/json.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_JSON_H [build/header_guard] [5]
include/phenom/defs.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_DEFS_H [build/header_guard] [5]
include/phenom/hook.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_HOOK_H [build/header_guard] [5]
include/phenom/listener.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_LISTENER_H [build/header_guard] [5]
include/phenom/thread.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_THREAD_H [build/header_guard] [5]
include/phenom/socket.h:18: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_SOCKET_H [build/header_guard] [5]
include/phenom/refcnt.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_REFCNT_H [build/header_guard] [5]
include/phenom/string.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_STRING_H [build/header_guard] [5]
include/phenom/log.h:64: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_LOG_H [build/header_guard] [5]
include/phenom/openssl.h:18: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_OPENSSL_H [build/header_guard] [5]
include/phenom/sysutil.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_SYSUTIL_H [build/header_guard] [5]
include/phenom/buffer.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_BUFFER_H [build/header_guard] [5]
include/phenom/hashtable.h:17: #ifndef header guard has wrong style, please use: _HOME_DOG_TEST_LIBPHENOM_MASTER_INCLUDE_PHENOM_HASHTABLE_H [build/header_guard] [5]
make: *** [check-lint] Error 123
错误2:
test.c:2:25: error: phenom/defs.h: No such file or directory
test.c:3:34: error: phenom/configuration.h: No such file or directory
test.c:4:24: error: phenom/job.h: No such file or directory
test.c:5:24: error: phenom/log.h: No such file or directory
test.c:6:28: error: phenom/sysutil.h: No such file or directory
test.c: In function ‘main’:
test.c:11: warning: implicit declaration of function ‘ph_library_init’
test.c:13: warning: implicit declaration of function ‘ph_config_load_config_file’
test.c:15: warning: implicit declaration of function ‘ph_nbio_init’
test.c:24: warning: implicit declaration of function ‘ph_debug_console_start’
test.c:27: warning: implicit declaration of function ‘ph_sched_run’
原因:libphenom.pc 被复制到了/usr/local/lib/pkgconfig/ 目录, 实际起作用的是 /usr/lib64/pkgconfig
解决办法:\cp /usr/local/lib/pkgconfig/libphenom.pc /usr/lib64/pkgconfig
错误3
编译:
gcc -O2 main.c `pkg-config libphenom --cflags --libs`
[root@s3 libphenom-master]# ./a.out
./a.out: error while loading shared libraries: libphenom.so.0: cannot open shared object file: No such file or directory
原因:共享库文件安装到了/usr/local/lib(很多开源的共享库都会安装到该目录下)或其它"非/lib或/usr/lib"目录下。
解决办法:
# echo "/usr/local/lib" >> /etc/ld.so.conf
# ldconfig
------------------------------------------------------------------------------------------------------------------------------------------------------------
// Always include phenom/defs.h first to correctly set up the compilation env#include "phenom/defs.h"#include "phenom/configuration.h"#include "phenom/job.h"#include "phenom/log.h"#include "phenom/sysutil.h"int main(int argc, char **argv){ // Must be called prior to calling any other phenom functions ph_library_init(); // Optional config file for tuning internals ph_config_load_config_file("/path/to/my/config.json"); // Enable the non-blocking IO manager ph_nbio_init(0); // Do stuff here to register client/server stuff. // This enables a very simple request/response console // that allows you to run diagnostic commands: // `echo memory | nc -UC /tmp/phenom-debug-console` // (on BSD systems, use `nc -Uc`!) // The code behind this is in // https://github.com/facebook/libphenom/blob/master/corelib/debug_console.c ph_debug_console_start("/tmp/phenom-debug-console"); // Run ph_sched_run(); return 0;}
运行结果:
[root@s3 pig]# echo memory | nc -UC /tmp/phenom-debug-console WHAT BYTES OOM ALLOCS FREES REALLOC threadpool/pool 9536 0 1 0 0 threadpool/ringbuf 8192 0 2 0 0 hashtable/table 2880 0 2 0 0 hook/hook 0 0 0 0 0 hook/head 0 0 0 0 0 hook/string 0 0 0 0 0 hook/unreg 0 0 0 0 0 stream/stream 272 0 2 0 0 buffer/object 120 0 3 0 0 buffer/8k 16384 0 2 0 0 buffer/16k 0 0 0 0 0 buffer/32k 0 0 0 0 0 buffer/64k 0 0 0 0 0 buffer/vsize 0 0 0 0 0 buffer/queue 48 0 2 0 0 buffer/queue_ent 64 0 2 0 0 dns/addrinfo 0 0 0 0 0 dns/string 0 0 0 0 0 socket/listener 352 0 1 0 0 socket/connect_job 0 0 0 0 0 socket/sock 704 0 1 0 0 socket/resolve_and_connect 0 0 0 0 0 stream/string 0 0 0 0 0 string/string 0 0 0 0 0 variant/json 0 0 0 0 0 variant/variant 0 0 0 0 0 variant/array 0 0 0 0 0 nbio/affine_job 0 0 0 0 0
系统环境:
[root@s3 pig]# cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
[root@s3 pig]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
- libPhenom 编译
- libPhenom库编译
- libphenom 学习笔记
- Facebook开源C语言事件框架:libPhenom
- libPhenom:Facebook开源的高性能C语言并发编程框架
- libPhenom:Facebook开源的高性能C语言并发编程框架
- 编译
- 编译
- 编译
- 编译
- 编译
- 编译
- 编译
- 编译
- 编译
- 编译
- 编译
- 编译
- AlertView 加文本输入框
- POSIX的pthread_join
- 反射练习
- Bug的类型
- 105_leetcode_interleaving string
- libPhenom 编译
- [ACM] 九度OJ 1553 时钟
- How to Turn Off Shape Protection in Visio
- content-based 的初步理解
- iOS 屏幕方向那点事儿
- N!
- PowerDesiger中导入.sql文件
- POJ 2954 Triangle(pick定理,边上整点数)
- Matlab计算机视觉/图像处理工具箱推荐