2012-10-17 176 views
4

我想在Xamarin中使用Good Dynamics SDK,我不知道Objective-C,所以我在這裏有點迷路。這是對概念證明的嘗試,我不確定這實際上是否可行。Xamarin無法編譯爲本機代碼

我已經將GD文件作爲GD.a從GD.framework目錄中添加並試圖實現API綁定並從示例XCode項目中複製應用程序啓動邏輯。

儘管Mono Develop以紅色顯示了ApiDefinition的所有內容,但我還是設法讓它生成。

在構建這是錯誤的一部分登錄Full version here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -Wl,-no_pie -arch i386 -gdwarf-2 -fobjc-legacy-dispatch -fobjc-abi-version=2 -miphoneos-version-min=6.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk /var/folders/1t/cbdvyj0x4n35m7674l7wvyjc0000gn/T/tmp6df5493a.tmp/main.x86.o -o /var/folders/1t/cbdvyj0x4n35m7674l7wvyjc0000gn/T/tmp6df5493a.tmp/GDTest -framework CFNetwork -framework Foundation -framework GameKit -framework MapKit -framework MediaPlayer -framework MessageUI -framework OpenGLES -framework StoreKit -framework UIKit -framework AddressBookUI -framework SystemConfiguration -framework AddressBook -framework AudioToolbox -framework AVFoundation -framework QuartzCore -framework CoreGraphics -framework CoreLocation -framework MobileCoreServices -framework Security -framework CoreData -framework ExternalAccessory -weak_framework AssetsLibrary -weak_framework Accounts -weak_framework CoreBluetooth -weak_framework CoreTelephony -weak_framework EventKit -weak_framework EventKitUI -weak_framework CoreMotion -weak_framework GLKit -weak_framework iAd -weak_framework NewsstandKit -weak_framework Social -weak_framework Twitter -weak_framework PassKit -weak_framework CoreImage -weak_framework CoreText -weak_framework ImageIO -weak_framework CoreMedia -weak_framework CoreMIDI -weak_framework CoreVideo -weak_framework AdSupport -weak_framework QuickLook -lz -u _mono_pmip -u _CreateZStream -u _CloseZStream -u _Flush -u _ReadZStream -u _WriteZStream -liconv -lmono-2.0 -lmonotouch -L/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib -u _catch_exception_raise -force_load /var/folders/1t/cbdvyj0x4n35m7674l7wvyjc0000gn/T/tmp6df5493a.tmp/GD.a 
    Undefined symbols for architecture i386: 
     "std::basic_istream<char, std::char_traits<char> >::gcount() const", referenced from: 
      GT::AES::decode(std::basic_istream<char, std::char_traits<char> >&, std::basic_ostream<char, std::char_traits<char> >&, unsigned int&, bool)in GD.a(gtaes.o) 
      GT::AES::encode(std::basic_istream<char, std::char_traits<char> >&, std::basic_ostream<char, std::char_traits<char> >&, unsigned int&, bool)in GD.a(gtaes.o) 
     "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_of(char const*, unsigned long, unsigned long) const", referenced from: 
      -[GDSetPasswordViewController checkPasswordStrength:] in GD.a(GDSetPasswordViewController.o) 
      GD::EacpCReq::EacpCReq(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, GT::Dbb&)in GD.a(GDEacpCommands.o) 
      GD::RawSocket::connect() in GD.a(GDRawSocket.o) 
     "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::copy(char*, unsigned long, unsigned long) const", referenced from: 
      GD::Socket::toString() constin GD.a(GDSocket.o) 
     "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::data() const", referenced from: 
      -[GTContainerDH setRemotePublic521:] in GD.a(GTContainerCrypto.o) 
      -[GTContainerDH initWithP521] in GD.a(GTContainerCrypto.o) 
      -[NSData(GTContainerEncryption) GTEncryptedDataUsingDerivedKey:] in GD.a(GTContainerCrypto.o) 
      -[NSData(GTContainerEncryption) GTDecryptedDataUsingDerivedKey:] in GD.a(GTContainerCrypto.o) 
      -[GTEncryptedFile streamDidReceiveData:] in GD.a(GTEncryptedFile.o) 
      +[NSData(Base64) dataFromBase64String:] in GD.a(NSData+Base64.o) 
      +[GTJsonCommandProcessor parseNSData:] in GD.a(GTICCJsonCommandProcessor.o) 
      ... 

這對於很多那張長,它與錯誤

ld: symbol(s) not found for architecture i386 
collect2: ld returned 1 exit status 

error MT5202: Native linking failed. Please review the build log. 

完成現在我有點卡住了。有任何想法嗎?

感謝

+0

你能提供你的綁定,所以我們可以看看他們嗎?我下載了GS>框架,它是armv7 armv7s i386,所以錯誤很奇怪 – dalexsoto

+0

我已經把代碼放在這裏; https://github.com/garethrhughes/GDTest謝謝 – Gareth

回答

3

我需要將-cxx添加到iPhone構建選項中的「其他mtouch參數」。

+1

也許這是解決方案,但爲什麼? –

4

ld消息告訴你,你.a靜態庫文件不包含代碼的i386。該架構是允許您在iOS模擬器上運行代碼所必需的。

也許GD包爲不同的體系結構提供了不同的.a。在這種情況下,您可以使用lipo工具來構建包含多種體系結構的庫。

+0

mmm GD.Framework是armv7 armv7s i386也許@Gareth缺少一些東西 – dalexsoto

+0

解決了這個問題,謝謝!有一個用於iPhone的GD,另一個用於iPhoneSimulator。 – Gareth

+0

似乎沒有解決它。它不知何故停止了實際的連接。我已經從iPhoneOS平臺文件夾和iPhoneSimulatorOS平臺文件夾中添加了GD文件,並獲得相同的結果。 – Gareth