libPhenom 编译

安装 http://c-ares.haxx.se/

安装 http://concurrencykit.org/

编译步骤:

$ ./autogen.sh
$ ./configure
$ make
$ make check
$ sudo make install
[[email protected] libphenom-master]# ./configure
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 a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
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 gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /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 gcc object... ok
checking how to run the C preprocessor... gcc -E
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 gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc 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... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking whether byte ordering is bigendian... no
checking for inline... inline
checking whether gcc and cc understand -c and -o together... yes
checking dependency style of gcc... gcc3
checking for library containing pthread_create... -lpthread
checking for library containing socket... none required
checking for library containing clock_gettime... -lrt
checking for library containing inet_pton... none required
checking for python... /usr/bin/python
checking for pkg-config... /usr/bin/pkg-config
checking for php... /usr/bin/php
checking alloca.h usability... yes
checking alloca.h presence... yes
checking for alloca.h... yes
checking for inttypes.h... (cached) yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking port.h usability... no
checking port.h presence... no
checking for port.h... no
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking stdbool.h usability... yes
checking stdbool.h presence... yes
checking for stdbool.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for string.h... (cached) yes
checking sys/inotify.h usability... yes
checking sys/inotify.h presence... yes
checking for sys/inotify.h... yes
checking sys/epoll.h usability... yes
checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking sys/event.h usability... no
checking sys/event.h presence... no
checking for sys/event.h... no
checking sys/eventfd.h usability... yes
checking sys/eventfd.h presence... yes
checking for sys/eventfd.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/processor.h usability... no
checking sys/processor.h presence... no
checking for sys/processor.h... no
checking sys/procset.h usability... no
checking sys/procset.h presence... no
checking for sys/procset.h... no
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking sys/timerfd.h usability... yes
checking sys/timerfd.h presence... yes
checking for sys/timerfd.h... yes
checking for sys/cpuset.h... no
checking for pthread_np.h... no
checking for accept4... yes
checking for asprintf... yes
checking for backtrace... yes
checking for backtrace_symbols... yes
checking for backtrace_symbols_fd... yes
checking for clock_gettime... yes
checking for cpuset_setaffinity... no
checking for epoll_create... yes
checking for epoll_create1... yes
checking for getpagesize... yes
checking for inotify_init... yes
checking for kqueue... no
checking for localeconv... yes
checking for pipe2... yes
checking for port_create... no
checking for processor_bind... no
checking for pthread_getname_np... yes
checking for pthread_set_name_np... no
checking for pthread_setname_np... yes
checking for pthread_setaffinity_np... yes
checking for pthread_mach_thread_np... no
checking for strerror_r... yes
checking for strtoll... yes
checking for sysctlbyname... no
checking for thread_policy_set... no
checking for timerfd_create... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libphenom.pc
config.status: creating include/phenom_build_config.h
config.status: include/phenom_build_config.h is unchanged
config.status: creating include/phenom/feature_test.h
config.status: include/phenom/feature_test.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

错误1:

修改cpplint.py, def CheckForHeaderGuard(filename, lines, error):

原因:未知,github上下载的最新代码, 不过这个可以忽略。

直接return

[[email protected] 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`

[[email protected] 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;
}

运行结果:

[[email protected] 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 

系统环境:

[[email protected] pig]# cat /etc/issue

CentOS release 6.4 (Final)

Kernel \r on an \m

[[email protected] 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 编译

时间: 2024-12-13 19:21:24

libPhenom 编译的相关文章

C++工程编译之“error LNK2001: 无法解析的外部符号”

今天一整天都在折腾“error LNK2001: 无法解析的外部符号”,就在头疼不已的时候,总算是找到问题原因了:各个动态链接库的编译方式必须统一才行,要不然很容易对库函数的引用产生冲突.简单来说就是,如果使用的第三方函数库编译方式采用/MD,那么主工程也应该使用/MD.我使用了libevent,而主工程默认采用/MT,所以需要忽略一大堆的函数库,我还纳闷呢,怎么会这么奇怪!!今天总算是解决了长久以来的困惑了. 下面引用一篇文章的描述:[Z]VC运行库版本不同导致链接.LIB静态库时发生重复定义

基于源码编译openssl

openssh依赖于openssl,由于ssl频繁曝出漏洞,牵扯到openssh.而自身也存在漏洞... 00.下载openssl https://www.openssl.org/source/ https://github.com/openssl/openssl/releases https://www.openssl.org/source/openssl-1.0.2l.tar.gz 01.准备工作 yum -y install perl perl-devel gcc gcc-c++ 02.编

maven依赖本地非repository中的jar包-依赖jar包放在WEB-INF/lib等目录下的情况客户端编译出错的处理

maven依赖本地非repository中的jar包 http://www.cnblogs.com/piaolingxue/archive/2011/10/12/2208871.html 博客分类: MAVEN 今天在使用maven编译打包一个web应用的时候,碰到一个问题: 项目在开发是引入了依赖jar包,放在了WEB-INF/lib目录下,并通过buildpath中将web libariary导入. 在eclipse中开发没有问题,但是使用maven编译插件开始便宜总是报找不到WEB-INF

Windows下VC编译OpenDDS

OpenDDS是一个OMG组织DDS标准的C++开源实现,OpenDDS同时也提供Java支持.OpenDDS依赖ACE抽象层来提供不同平台的兼容性,同时也依赖于TAO(例如TAO的IDL编译器).当前OpenDDS有ociweb ObjectComputing维护,官方网站http://www.opendds.org/.目前OpenDDS支持的平台有Windows,Linux family,Android,VxWorks等,可用的编译器包括VC,gcc,QNX gcc等. 1. OpenDDS

ffmpeg 3.2.4 + libx264 windows 编译总结

___________________________编译环境__________________________________ NDK 环境:android-ndk-r13b MinGW环境:Basic Setup下Mark了所有的项目,FFmpeg需要使用msys环境进行编译 ffmpeg :3.2.4 下载地址 libx264:官网最新 _____________________________________________________________________ ______

Hadoop:Windows 7 32 Bit 编译与运行

所需工具 1.Windows 7 32 Bit OS(你懂的) 2.Apache Hadoop 2.2.0-bin(hadoop-2.2.0.tar.gz) 3.Apache Hadoop 2.2.0-src(hadoop-2.2.0-src.tar.gz) 3.JDK 1.7 4.Maven 3.2.1(apache-maven-3.2.1-bin.zip) 5.Protocol Buffers 2.5.0 6.Unix command-line tool Cygwin(Setup-x86.e

Java注解(3)-注解处理器(编译期|RetentionPolicy.SOURCE)

注解的处理除了可以在运行时通过反射机制处理外,还可以在编译期进行处理.在编译期处理注解时,会处理到不再产生新的源文件为止,之后再对所有源文件进行编译. Java5中提供了apt工具来进行编译期的注解处理.apt是命令行工具,与之配套的是一套描述"程序在编译时刻的静态结构"的API:Mirror API(com.sun.mirror.*).通过Mirror API可以获取到被注解的Java类型元素的信息,从而提供自定义的处理逻辑.具体的处理工具交给apt来处理.编写注解处理器的核心是两个

Ubuntu 16.04编译Android 7.1.2

折腾了很久,终于搞定了这个环境.记录一下. 准备工作: 1. 首先在Ubuntu官网上下载Ubuntu16.04的官方镜像.官网下载地址(这个找了很久,这里可以直接下载ISO镜像):https://launchpad.net/ubuntu/+cdmirrors 2. 建议直接安装到自己硬盘上(推荐双系统),不要在虚拟机上搞,除非你有足够大的SSD.我之前在虚拟机上试过,电脑的性能完全发挥不出来,后来搞了双系统,发现一切都是那么舒服. 3. Android源码下载方法:https://lug.us

Firefly-RK3288开发板Android编译环境搭建开荒

入手了Firefly-RK3288的开发板,自己从零开始搭建编译环境开荒 第一步:安装Ubuntu12.04,使用安装盘安装(安装的过程就不详写了,下面贴图) 安装完后,更新ubuntu 第二步:从官网上下载SDK,进行编译环境的安装 下载SDK有两种方式,一是下载压缩包,二是通过git下载. 我选择了下载压缩包.SDK百度云下载地址:http://pan.baidu.com/s/1eQjBGQI?qq-pf-to=pcqq.c2c 在等待代码下载完成的同时,开始按照官方的步骤进行环境安装.为了