IOS下Libevent编译步骤,及引入Xcode备忘

来源:互联网 发布:位面淘宝txt下载 编辑:程序博客网 时间:2024/06/06 09:49
    0.先用:ls -al /usr/lib | grep libevent 查看是否已安装,如果已安装且版本低于1.3,则先通过:rpm -e libevent —nodeps 进行卸载。
  
  1.下载libevent安装包:libevent-2.0.22-stable.tar.gz,然后解压。
  
  2.切换到解压后的 libevent 主目录:cd libevent-2.0.22-stable
  
  3.依次执行:
  ./configure –prefix=/usr (或 ./configure --program-prefix=/usr)
  make
  make install






----ARM64
./configure --prefix=/Users/XX/lv --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc CFLAGS="-arch arm64 -pipe -std=c99 -Wno-extended-offsetof -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=6.0 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk" AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar LDFLAGS="-arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk -miphoneos-version-min=6.0"


---lipo

lipo -create /Users/XX/lv/lib/libevent_pthreads.a /Users/XX/build/built/iPhoneOS10.0-arm64.sdk/lib/libevent_pthreads.a -output /Users/xx/lv-all/libevent_pthreads.a


*注意替换路径


生成IOS平台的库文件(libevent_core.a,libevent_extra.a,libevent_pthreads.a)放到$path/ios/libraries中,注意:是IOS的库文件,不是linux的


   头文件放到$path/ios/libevent


  xcode中增加head search path 和 添加刚才的3个库文件