不能建造的R​​abbitMQ-C适用于iOS应用 [英] Not able to build rabbitmq-c for iOS application

查看:648
本文介绍了不能建造的R​​abbitMQ-C适用于iOS应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在iOS应用程序使用RabbitMQ的。由于推荐,我用这Objective-C中的包装,其中规定:的没有什么建设。只是包括源文件和头文件到你的X code的项目,并将其链接againt librabbitmq-C。的不过,我一直无法构建应用程序为止。我使用GitHub上可用的最新稳定版本。

I am trying to use RabbitMq in an iOS app. As recommended, I am using this Objective-C wrapper, which stipulates : There is nothing to build. Just include the source and header files into your Xcode project and link it againt librabbitmq-c. However, I have been unable to build the app so far. I am using the last stable versions available on GitHub.

1 /我曾试图在自己的项目中的所有文件(包括RabbitMQ的-objc和RabbitMQ的-C),并建立像往常一样(的建议<一href=\"http://stackoverflow.com/questions/24795180/objective-c-rabbitmq-client-not-publishing-messages-to-queue?rq=1\">here).更换少数种类(UINT8到u_int8_t)和解决一些进口后(amqp.h而不是&LT; amqp.h>)用X code的建议,我结束了这个错误:命令/Applications/X$c$c.app/Contents/Developer/Toolchains/X$c$cDefault.xctoolchain/usr/bin/clang失败,退出code 254 的。我深深的清理项目,删除内容的〜/资源库/开发/ X code / DerivedData,但没有运气。

1/ I have tried to include all files (both rabbitmq-objc and rabbitmq-c) in my project, and build as usual (as suggested here). After replacing a few types (uint8 into u_int8_t) and solving a few imports ("amqp.h" instead of < amqp.h>) as suggested by XCode, I ended up with this error : Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 254. I deep cleaned project, erased content of ~/Library/Developer/Xcode/DerivedData, but no luck.

2 /我已经又试图通过命令行来构建的RabbitMQ-C与cmake的:

2/ I have then tried to build rabbitmq-c with cmake via command-line :

mkdir build && cd build
cmake ..
cmake --build . --config Release

,然后导入在我的项目动态库。当项目链接,X code抱怨的建设iPhone模拟器,但链接到的专为MacOSX的文件dylib 的。我已阅读关于如何解决这个问题的几个职位,但我不知道该怎么办才好。

And then importing as a dynamic lib in my project. When linking in the project, XCode complains that building for iOS Simulator, but linking against dylib built for MacOSX file. I have read a few post on how to address this issue, but I am not sure exactly how to proceed.

3 /我已经从而最终使用CMake.app适用于MacOS,设置生成于X code。我已经导入构建为一个动态的lib中的RabbitMQ-c.x codeproj,和头路径设置为正确的文件夹。设置其他连接标志将-ObjC -all_load之后,我仍然得到一个错误:没有这样的文件或目录: '/Users/Guillaume/Library/Developer/X$c$c/DerivedData/RabbitMQSandbox-bvhczedxhtejhxcwdqmdewzzexjj/Build/Products/Debug-iphonesimulator/librabbitmq.4.0.0.dylib'.

3/ I have thus finally used the CMake.app for MacOS, setting the generator to XCode. I have imported the rabbitmq-c.xcodeproj built as a dynamic lib, and set the header path to the correct folder. After setting the Other linker flags to -ObjC -all_load, I still get an error : no such file or directory: '/Users/Guillaume/Library/Developer/Xcode/DerivedData/RabbitMQSandbox-bvhczedxhtejhxcwdqmdewzzexjj/Build/Products/Debug-iphonesimulator/librabbitmq.4.0.0.dylib'.

我失去了希望。有人能指出我朝着正确的方向?

I am losing hope. Can somebody point me toward the right direction ?

推荐答案

我终于找到了,这里是进一步参考

I finally found it, here it is for further reference

1 /获取最新的的RabbitMQ-C 和的 RabbitMQ的-objc 库。

1/ get the latest rabbitmq-c and rabbitmq-objc libraries.

2 /确保 CMake的更新(2.6或更高)

2/ make sure Cmake is updated (2.6 or better)

3 /安装 IOS的​​cmake的

4 / RabbitMQ的中-C目录(其他城市OSX_ARCHITECTURES和IOS_PLATFORM标志模拟器或设备)

4/ in rabbitmq-c directory (change OSX_ARCHITECTURES and IOS_PLATFORM flags for simulator or device)

mkdir build.ios && cd build.ios
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/iOS.cmake 
-DIOS_PLATFORM=SIMULATOR (resp. OS) 
-DCMAKE_IOS_DEVELOPER_ROOT=/Applications/Xcode.app/Contents/Developer     
-DCMAKE_IOS_SDK_ROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.2.sdk 
-DCMAKE_OSX_ARCHITECTURES=x86_64 (resp. i386)
-DBUILD_STATIC_LIBS=True 
-DENABLE_SSL_SUPPORT=False 
-GXcode ..

5 /在build.os / librabbitmq,重命名目录调试到调试,iphonesimulator。打开x code中的librabbitmq-c.x codeproj,选择目标RabbitMQ的静电,建设,并关闭了这个项目。

5/ in build.os/librabbitmq, rename directory Debug to Debug-iphonesimulator. Open in XCode the librabbitmq-c.xcodeproj, select target rabbitmq-static, build, and close this project.

在将要使用的库librabbitmq.a项目6 /进口。在构建设置,确保总是搜索用户路径设置为Yes和用户头搜索路径包含路径到RabbitMQ的-C / librabbitmq和RabbitMQ的-C / build.ios / RabbitMQ的-C。

6/ import in project that will be using the library librabbitmq.a. In build settings, make sure that Always Search User Paths is set to Yes and that User Header Search Path contains both paths to rabbitmq-c/librabbitmq and to rabbitmq-c/build.ios/rabbitmq-c.

7 /复制在项目中的RabbitMQ-objc类,并设置了-fno-objc弧标志这些类。

7/ copy the rabbitmq-objc classes in the project, and set -fno-objc-arc flag for those classes.

8 /由 u_int8_t 替换 UINT8 的OCCURENCES,更换#进口&LT的OCCURENCES ;可可/ Cocoa.h> #进口&LT;基金会/ Foundation.h> ,更换OCCURENCES #进口&LT; amqp.h> #进口&LT; amqp_framing.h> >#进口amqp.h#进口amqp_framing.h

8/ Replace occurences of uint8 by u_int8_t, replace occurences of #import < Cocoa/Cocoa.h> by #import < Foundation/Foundation.h>, replace occurences of #import < amqp.h> and #import < amqp_framing.h> by #import "amqp.h" and #import "amqp_framing.h".

9 /在AMQPConsumer.m,添加缺少的函数参数amqp_basic_consume AMQP_EMPTY_TABLE,并在AMQPExchange.m,添加缺少

9/ In AMQPConsumer.m, add missing parameter AMQP_EMPTY_TABLE in function amqp_basic_consume, and in AMQPExchange.m, add missing

#define AMQP_EXCHANGE_TYPE_DIRECT @"direct" 
#define AMQP_EXCHANGE_TYPE_FANOUT @"fanout"
#define AMQP_EXCHANGE_TYPE_TOPIC @"topic"

10 /生成项目。

10/ Build project.

这篇关于不能建造的R​​abbitMQ-C适用于iOS应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆