[Xamarin iOS] demo-particle-xamarin-ios linking problem

Options
aleksei_semikashev
edited June 2014 in DotNet
Hi All!

Compiling and running DotNetExample on Windows is fine. But when i try to do the same with XamarinExample on Mac, I`m getting linking error:
Compiling to native code
/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" --cache "/Work/PhotonSample/demo-particle-xamarin.ios/obj/iPhone/Release/mtouch-cache" --nomanifest --nosign -dev "/Work/PhotonSample/demo-particle-xamarin.ios/bin/iPhone/Release/demoparticlexamarinios.app" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -r "/Work/PhotonSample/libs/debug/Photon3DotNet.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/Mono.Security.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/OpenTK.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/OpenTK-1.0.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/Mono.Data.Sqlite.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/Mono.Data.Tds.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/MonoTouch.Dialog-1.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/MonoTouch.NUnitLite.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.ComponentModel.Composition.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.ComponentModel.DataAnnotations.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Data.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Data.Services.Client.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Json.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Net.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Net.Http.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Numerics.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Runtime.Serialization.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.ServiceModel.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.ServiceModel.Web.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Transactions.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Web.Services.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Windows.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.Linq.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.Serialization.dll" -r "/Work/PhotonSample/libs/Release/PhotonLoadBalancingApi.iOS.dll" -linksdkonly -sdk "7.1" -targetver "3.2" --abi=armv7 "/Work/PhotonSample/demo-particle-xamarin.ios/bin/iPhone/Release/demoparticlexamarinios.exe"
Xamarin.iOS 7.2.2 Business Edition using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -Wl,-no_pie  -miphoneos-version-min=3.2 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk  /Work/PhotonSample/demo-particle-xamarin.ios/obj/iPhone/Release/mtouch-cache/demoparticlexamarinios.exe.armv7.o /Work/PhotonSample/demo-particle-xamarin.ios/obj/iPhone/Release/mtouch-cache/monotouch.dll.armv7.o /Work/PhotonSample/demo-particle-xamarin.ios/obj/iPhone/Release/mtouch-cache/mscorlib.dll.armv7.o /Work/PhotonSample/demo-particle-xamarin.ios/obj/iPhone/Release/mtouch-cache/System.dll.armv7.o /Work/PhotonSample/demo-particle-xamarin.ios/obj/iPhone/Release/mtouch-cache/System.Core.dll.armv7.o /Work/PhotonSample/demo-particle-xamarin.ios/obj/iPhone/Release/mtouch-cache/PhotonLoadBalancingApi.iOS.dll.armv7.o /Work/PhotonSample/demo-particle-xamarin.ios/obj/iPhone/Release/mtouch-cache/Photon3DotNet.dll.armv7.o /Work/PhotonSample/demo-particle-xamarin.ios/obj/iPhone/Release/mtouch-cache/registrar.armv7.o /Work/PhotonSample/demo-particle-xamarin.ios/obj/iPhone/Release/mtouch-cache/main.armv7.o -o /Work/PhotonSample/demo-particle-xamarin.ios/bin/iPhone/Release/demoparticlexamarinios.app/demoparticlexamarinios -framework CFNetwork -framework Foundation -framework CoreGraphics -framework UIKit -lz -liconv -u _monotouch_log -u _monotouch_release_managed_ref -u _monotouch_create_managed_ref -u _egconnect -u _eggetState -u _egdisconnect -u _egservice -u _egsend -u _egread -u _CreateZStream -u _CloseZStream -u _Flush -u _ReadZStream -u _WriteZStream -u _monotouch_start_wwan /Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonoboehm-2.0.a /Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonotouch.a -dead_strip
Undefined symbols for architecture armv7:
  "_egread", referenced from: -u command line option
  "_egsend", referenced from: -u command line option
  "_egservice", referenced from: -u command line option
  "_egdisconnect", referenced from: -u command line option
  "_eggetState", referenced from: -u command line option
  "_egconnect", referenced from: -u command line option
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error MT5210: Native linking failed, undefined symbol: _egread. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5210: Native linking failed, undefined symbol: _egsend. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5210: Native linking failed, undefined symbol: _egservice. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5210: Native linking failed, undefined symbol: _egdisconnect. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5210: Native linking failed, undefined symbol: _eggetState. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5210: Native linking failed, undefined symbol: _egconnect. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5202: Native linking failed. Please review the build log.

Further investigations show that Photon3DotNet.dll containts methods in SocketUdpNativeDynamic class:
[DllImport("PhotonSocketPlugin")]
    private static extern IntPtr egconnect([MarshalAs(UnmanagedType.LPStr)] string address);
    [DllImport("PhotonSocketPlugin")]
    private static extern void egdisconnect(IntPtr pConnectionHandler);
    [DllImport("PhotonSocketPlugin")]
    private static extern byte eggetState(IntPtr pConnectionHandler);
    [DllImport("PhotonSocketPlugin")]
    private static extern int egread(IntPtr pConnectionHandler, byte[] arr, int size);
    [DllImport("PhotonSocketPlugin")]
    private static extern void egsend(IntPtr pConnectionHandler, byte[] arr, int size);
    [DllImport("PhotonSocketPlugin")]
    private static extern int egservice(IntPtr pConnectionHandler);

It seems I need PhotonSocketPlugin library, but i can`t find it anywhere.
Any suggestions?

If it could help I attach soft I use:
Xamarin Studio
Version 4.2.5 (build 0)
Installation UUID: 7fc0f7dd-c0ce-4f40-a525-5efa9056f8ea
Runtime:
	Mono 3.2.6 ((no/9b58377)
	GTK+ 2.24.23 (Raleigh theme)
	Package version: 302060000

Apple Developer Tools
Xcode 5.1.1 (5085)
Build 5B1008

Xamarin.iOS
Version: 7.2.2.2 (Business Edition)
Hash: db4427f
Branch: 
Build date: 2014-04-22 12:49:14-0400

Build Information
Release ID: 402050000
Git revision: 95ac543f224a70960a9ab71e24ce341eb87de06f
Build date: 2014-05-02 13:05:15-04
Xamarin addins: b81285ac0156281956135adb96685f98922893a1

Operating System
Mac OS X 10.9.2

Comments

  • Tobias
    Options
    Ow. That problem is known but so far only for Unity.
    The problem is that we first had to include 2 classes which import native libraries when we need them but that code breaks compilation even if we don't use it when the native libs are not available.

    I think I can provide you with a new lib on Monday.
    Sorry for the issues and the delay.
  • Thank you for your reply, Tobias.

    Looking forward for a new lib. :)
  • Tobias
    Options
    Aleksei: Please download the updated assembly from:
    https://dl.dropboxusercontent.com/u/4295285/Photon3DotNet-NoNativeSockets_v4-0-0-0.zip

    Disclaimer: This is the current version we have and I didn't explicitly test it on Xamarin iOS export. I just made sure it doesn't try to import the native libs which are only available for Unity builds.
    This is meant as quick fix but should work by all means.

    I am not around for a week but we should be able to update the SDKs properly in the next weeks.
  • I`ve tried new lib. Sample compiles and runs just fine.

    Thank you for quick response, Tobias. :)
  • Tobias
    Options
    Excellent. Thanks for letting us know.
    (Late reply this time, due to vacation.)