2012-06-22 65 views
2

我正在嘗試從openhome.org構建ohNet UPnP堆棧,以便在iPhone和iPhoneSimulator上執行。我曾在網絡上的不同地方看到,iOS上有一個端口,並且實際上在Makefile中有一些對iOS構建的引用。在$ DEVROOT和$ SDKROOT路徑進行一定的編輯後,我可以編譯很多的來源,但生成的錯誤停止:如何爲iOS構建ohNet?

g++ -pthread -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/ -arch armv6 -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/system -shared -shared-libgcc -o Build/Obj/Mac/arm/Release/libohNet.dylib Build/Obj/Mac/arm/Release/Ascii.o Build/Obj/Mac/arm/Release/AsyncC.o Build/Obj/Mac/arm/Release/AsyncPrivate.o Build/Obj/Mac/arm/Release/Bonjour.o Build/Obj/Mac/arm/Release/Buffer.o Build/Obj/Mac/arm/Release/Discovery.o Build/Obj/Mac/arm/Release/Debug.o Build/Obj/Mac/arm/Release/Converter.o Build/Obj/Mac/arm/Release/CpDeviceCore.o Build/Obj/Mac/arm/Release/CpDeviceC.o Build/Obj/Mac/arm/Release/CpDeviceStd.o Build/Obj/Mac/arm/Release/CpDeviceDvCore.o Build/Obj/Mac/arm/Release/CpDeviceDvStd.o Build/Obj/Mac/arm/Release/CpDeviceDvC.o Build/Obj/Mac/arm/Release/CpDeviceUpnpCore.o Build/Obj/Mac/arm/Release/CpDeviceUpnpC.o Build/Obj/Mac/arm/Release/CpDeviceUpnpStd.o Build/Obj/Mac/arm/Release/CpiDevice.o Build/Obj/Mac/arm/Release/CpiDeviceDv.o Build/Obj/Mac/arm/Release/CpiDeviceUpnp.o Build/Obj/Mac/arm/Release/CpiService.o Build/Obj/Mac/arm/Release/CpiStack.o Build/Obj/Mac/arm/Release/CpiSubscription.o Build/Obj/Mac/arm/Release/CpProxy.o Build/Obj/Mac/arm/Release/CpProxyC.o Build/Obj/Mac/arm/Release/CpServiceC.o Build/Obj/Mac/arm/Release/DvDevice.o Build/Obj/Mac/arm/Release/DvDeviceStd.o Build/Obj/Mac/arm/Release/DvDeviceC.o Build/Obj/Mac/arm/Release/DviDevice.o Build/Obj/Mac/arm/Release/DvInvocationC.o Build/Obj/Mac/arm/Release/DvInvocationStd.o Build/Obj/Mac/arm/Release/DviProtocolUpnp.o Build/Obj/Mac/arm/Release/DviProviderSubscriptionLongPoll.o Build/Obj/Mac/arm/Release/DvOpenhomeOrgSubscriptionLongPoll1.o Build/Obj/Mac/arm/Release/DviServer.o Build/Obj/Mac/arm/Release/DviServerUpnp.o Build/Obj/Mac/arm/Release/DviServerWebSocket.o Build/Obj/Mac/arm/Release/DviService.o Build/Obj/Mac/arm/Release/DviStack.o Build/Obj/Mac/arm/Release/DviSubscription.o Build/Obj/Mac/arm/Release/DviPropertyUpdateCollection.o Build/Obj/Mac/arm/Release/DvProvider.o Build/Obj/Mac/arm/Release/DvProviderC.o Build/Obj/Mac/arm/Release/DvServerUpnp.o Build/Obj/Mac/arm/Release/DvServerUpnpC.o Build/Obj/Mac/arm/Release/DeviceXml.o Build/Obj/Mac/arm/Release/Error.o Build/Obj/Mac/arm/Release/EventUpnp.o Build/Obj/Mac/arm/Release/Exception.o Build/Obj/Mac/arm/Release/Fifo.o Build/Obj/Mac/arm/Release/Http.o Build/Obj/Mac/arm/Release/DNSCommon.o Build/Obj/Mac/arm/Release/DNSDigest.o Build/Obj/Mac/arm/Release/mDNS.o Build/Obj/Mac/arm/Release/uDNS.o Build/Obj/Mac/arm/Release/MdnsPlatform.o Build/Obj/Mac/arm/Release/MdnsProvider.o Build/Obj/Mac/arm/Release/Maths.o Build/Obj/Mac/arm/Release/Md5.o Build/Obj/Mac/arm/Release/NetworkAdapterList.o Build/Obj/Mac/arm/Release/Network.o Build/Obj/Mac/arm/Release/Parser.o Build/Obj/Mac/arm/Release/Printer.o Build/Obj/Mac/arm/Release/ProtocolUpnp.o Build/Obj/Mac/arm/Release/Queue.o Build/Obj/Mac/arm/Release/RefCounter.o Build/Obj/Mac/arm/Release/Service.o Build/Obj/Mac/arm/Release/ServiceC.o Build/Obj/Mac/arm/Release/sha1.o Build/Obj/Mac/arm/Release/Ssdp.o Build/Obj/Mac/arm/Release/SsdpDv.o Build/Obj/Mac/arm/Release/Stack.o Build/Obj/Mac/arm/Release/Stream.o Build/Obj/Mac/arm/Release/Subscription.o Build/Obj/Mac/arm/Release/Thread.o Build/Obj/Mac/arm/Release/Timer.o Build/Obj/Mac/arm/Release/Uri.o Build/Obj/Mac/arm/Release/XmlParser.o Build/Obj/Mac/arm/Release/XmlFetcher.o Build/Obj/Mac/arm/Release/OhNet.o Build/Obj/Mac/arm/Release/OhNetCp.o Build/Obj/Mac/arm/Release/OhNetDv.o Build/Obj/Mac/arm/Release/OhNetCombined.o Build/Obj/Mac/arm/Release/OhNetC.o Build/Obj/Mac/arm/Release/OhNetCCp.o Build/Obj/Mac/arm/Release/OhNetCDv.o Build/Obj/Mac/arm/Release/OhNetCCombined.o Build/Obj/Mac/arm/Release/OsWrapper.o Build/Obj/Mac/arm/Release/Os.o 
llvm-g++-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/arm-apple-darwin11-llvm-g++-4.2': execvp: No such file or directory 
make: *** [ohNetDll] Error 255 

我不明白爲什麼編譯過程要建立ohNetDll這個平臺,也不知道如何退出該部分/目標。動態庫不支持iOS應用程序,當然也不是Windows本機的dll。

如果您已經在iOS上構建/移植/使用過ohNet,請告知如何操作?我想在ohNet論壇上發佈這個問題,但我無法註冊(因爲我沒有提交安全問題,即使在表單上沒有地方這樣做!)。

源,文檔和API指南都會尋求ohNet非常有前途的,所以我希望你能勸...

回答

2

「的$ DEVROOT的一些編輯和$ SDKROOT路徑之後,我可以編譯 很多來源...「

對於iPhoneOS平臺,請設置以下環境變量。

export ROOTDIR="/Applications/Xcode.app/Contents/Developer" 
export PLATFORM="iPhoneOS" 
export MAX_VERSION="5.1" 
export DEVROOT=${ROOTDIR}/Platforms/${PLATFORM}.platform/Developer 
export SDKROOT=${DEVROOT}/SDKs/${PLATFORM}${MAX_VERSION}.sdk 

然後,在源的根目錄下,文件「Makefile」文件中,找到以下部分,並確保它看起來相同的,因爲這一個:

ifeq ($(MACHINE), Darwin) 
ifeq ($(mac-arm),1) 
    # Darwin, ARM -> iOS 
    platform ?= iOS 
    linkopts_ohNet =  
    devroot=$(DEVROOT) 
    sdkroot=$(SDKROOT) 
    platform_cflags = -I$(sdkroot)/usr/lib/gcc/arm-apple-darwin10/4.2.1/include/ -I$(sdkroot)/usr/include/ -I/usr/bin/arm-apple-darwin10-gcc -miphoneos-version-min=2.2 -pipe -no-cpp-precomp -isysroot $(sdkroot) -DPLATFORM_MACOSX_GNU -DPLATFORM_IOS -I$(sdkroot)/usr/include/c++/4.2.1/armv6-apple-darwin10/ 
    # It seems a bit weird that iOS uses a sub-dir of Build/Obj/Mac, is that deliberate? --AW 
    osbuilddir = Mac/arm 
    objdir = Build/Obj/Mac/arm/$(build_dir)/ 
    platform_linkflags = -L$(sdkroot)/usr/lib/ -arch armv7 -L$(sdkroot)/usr/lib/system 
    compiler = $(devroot)/usr/bin/llvm-gcc-4.2 -arch armv7 -isysroot $(SDKROOT) -o $(objdir) 
    # No support for linking Shared Objects for ARM MAC 
    # link = $(devroot)/usr/bin/llvm-gcc-4.2 -pthread -Wl $(platform_linkflags) 
    ar = $(devroot)/usr/bin/ar rc $(objdir) 
    native_only = yes 

要點這裏:

  1. $ DEVROOT和$ SDKROOT對於您的iOS SDK版本是正確的。
  2. 變量$ native_only被設置爲yes。這避免了在Mac主機上嘗試(並且不可避免地失敗)建立ohNetDll時的錯誤和提早退出。

然後,在終端上,在源根目錄(即含有生成文件的一個)類型:

make mac-arm=1 

希望這有助於...

道格