locked
PjSip ios assemblies implementation RRS feed

  • Question

  • User144246 posted

    Hello! I've build a lot of PjSip assemblies (18) from PjSip source code from official site using gettting started guide. I added all the libs to my Xamarin ios project. But now I need to write -gcc_flags parameters and I can't figure out which exactly flags I need to write. Is there anyone who succeded in this procedure and can help me?

    Now my gccflags line looks like this one: --gccflags "-L${ProjectDir} -lMylib -framework CFNetwork -framework Foundation -framework AVFoundation -framework UIKit -framework AudioToolbox -framework CoreGraphics -forceload ${ProjectDir}/libg7221codec-apple-sdkios.a (and othe Pjsip assemblies)"

    Thank you in advance

    Wednesday, September 30, 2015 10:38 AM

Answers

  • User181 posted

    The "-l" (a lowercase L) is the linker argument. What follows it is the library name. The convention on Unix is that libraries are prefixed with "lib", and when referring to them on the link line you strip the "lib" off. So if you have a library "libfoo.a" then you link to it using "-lfoo". According to the documentation I linked to you need both the "-lfoo" and the "-force_load /path/to/libfoo.a".

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, September 30, 2015 8:19 PM
  • User181 posted

    As I said before:

    You may also need to use the "-cxx" option if the library uses C++.

    Add "-cxx" before "-gcc_flags".

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, October 1, 2015 4:22 PM

All replies

  • User181 posted

    What does the PjSip documentation say to do?

    Wednesday, September 30, 2015 6:17 PM
  • User144246 posted

    @adamkemp It says nothing about linking. I guess it is because classic ios apps using xcode do not need gcc_flags to be used, but xamarin need it. Or maybe I'm a bit dumb =(

    Wednesday, September 30, 2015 6:48 PM
  • User181 posted

    Well you were given one or more binaries, right? Somehow those have to get linked in, even in Xcode. The instructions may be completely different, but it's still helpful to know what those instructions are. So where is the documentation for how to use this component in Xcode?

    Wednesday, September 30, 2015 7:07 PM
  • User144246 posted

    @adamkemp Here are PjSip Docs. But there is no word about linking them. As I remember In XCode you just need to include libs in project. There is no need to write gcc_flags when using XCode. I don't think there is any difference linking PjSip libs or any other c-libs in xamarin ios project.

    Wednesday, September 30, 2015 7:19 PM
  • User181 posted

    Can you list the libraries that are built?

    Wednesday, September 30, 2015 7:35 PM
  • User144246 posted

    @adamkemp Sure! This is the list: libg7221codec-apple-sdkios.a libgsmcodec-apple-sdkios.a libilbccodec-apple-sdkios.a libpj-apple-sdkios.a libpjlib-util-apple-sdkios.a libpjmedia-apple-sdkios.a libpjmedia-audiodev-apple-sdkios.a libpjmedia-codec-apple-sdkios.a libpjmedia-videodev-apple-sdkios.a libpjnath-apple-sdkios.a libpjsip-apple-sdkios.a libpjsip-simple-apple-sdkios.a libpjsip-ua-apple-sdkios.a libpjsua2-apple-sdkios.a libpjsua-apple-sdkios.a libresample-apple-sdkios.a libspeex-apple-sdkios.a libsrtp-apple-sdkios.a

    And the libs itself built for armv7, armv7s, arm64 and i386

    Wednesday, September 30, 2015 7:43 PM
  • User181 posted

    You should follow the instructions here for each of those libraries. It looks like you have done "-L${ProjectDir}" and used "-force_load..." for each lib, but you haven't done "-l..." for each lib. You may also need to use the "-cxx" option if the library uses C++.

    Wednesday, September 30, 2015 8:03 PM
  • User144246 posted

    @adamkemp So did I understand you correctly? -l stands for internal name of the library in my project? I mean if I will link libraries like -gccflags "-L${ProjectDir} -framework Frameworkname1 -framework Frameworkname2 -lFirstLib -forceload ${ProjectDir}/libg7221codec-apple-sdkios.a -lSecondLib -forceload ${ProjectDir}/libgsmcodec-apple-sdk_ios.a (etc...)", In my c# wrapper I can use P/Invoke method like this: public static class CFuncs { [DllImport("FirstLib"), EntryPoint="someFuncName"] internal static extern void someFuncName() { } }

    Wednesday, September 30, 2015 8:15 PM
  • User181 posted

    The "-l" (a lowercase L) is the linker argument. What follows it is the library name. The convention on Unix is that libraries are prefixed with "lib", and when referring to them on the link line you strip the "lib" off. So if you have a library "libfoo.a" then you link to it using "-lfoo". According to the documentation I linked to you need both the "-lfoo" and the "-force_load /path/to/libfoo.a".

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, September 30, 2015 8:19 PM
  • User144246 posted

    @adamkemp well, I see. I will try this solution in 10 hours and post here either it helped or not. Anyway thank you a lot!)

    Wednesday, September 30, 2015 8:24 PM
  • User144246 posted

    @adamkem That worked!) But now I get a lot of errors like:

    Native linking error: "operator delete(void*)", referenced from: Native linking error: "vtable for cxxabiv1::siclasstypeinfo", referenced from: Native linking error: pj::Account::create(pj::AccountConfig const&, bool) in libpjsua2-apple-sdkios.a(account.o) Native linking error: void std::1::vector >::pushbackslowpath(pj::AuthCredInfo const&) in libpjsua2-apple-sdkios.a(account.o)

    ... And many many more

    Thursday, October 1, 2015 7:18 AM
  • User181 posted

    As I said before:

    You may also need to use the "-cxx" option if the library uses C++.

    Add "-cxx" before "-gcc_flags".

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, October 1, 2015 4:22 PM
  • User144246 posted

    @adamkemp Yes, that helped) Thank you very much

    Friday, October 2, 2015 7:13 AM
  • User1052 posted

    I need to integrate Voip functionalities in my app. Can PJSIP be the right way? If so is it possibile to get somewhere the dll libraries to make some test? Thanks

    Saturday, December 12, 2015 8:27 AM
  • User144246 posted

    @MatteoMonizza You can use PjSip to achieve the goal. But that would be a bit complicated. But I guess in xamarin it would be complicated anyway. You can get all you need to build app on official site pjsip.org. You build assemblies using the tutorial provided on their site. Integrate them in your app with p/invoke method and use in your app. We wrote some c-code to use libraries and made p/invoke class around that code

    Saturday, December 12, 2015 9:07 AM
  • User229704 posted

    @epolonskiy We are facing the same problem. Could you post some sample code from Xamarin to PJSIP?

    Monday, May 30, 2016 6:23 PM