Forum Xamarin.iOS

Adding kiwi and vtk ftramework dependencies to a Xamarin project

jax1jax1 USMember

Hello,

a native lib that I have built (it actually encompasses the KiwiViewer app) depends on two frameworks (kiwi and vtk framework (http://www.kitware.com/opensource/opensource.html). I want to add that lib into a Xamarin project which, so I have crated a binding project for it. However, when I specify in gcc_flags "-framework kiwi -framework vtk", the link fails with this error :

ld: framework not found kiwi
collect2: ld returned 1 exit status

error MT5201: Native linking failed. Please review user flags provided to gcc: "-framework" "kiwi" "-framework" "vtk"

Both the frameworks have been copied into /Library/Frameworks (and into /System/Library/Frameworks before that) folder, but no joy.

I have noticed that, when invoking g++ compiler (I have added -cxx option because library is a C++ one), it passes the switch : -arch i386. Could that be the problem?

Any help is greatly welcome. Thanks.

Answers

  • ConwayConway USMember ✭✭

    Our code links to some native C++ libraries. Here are the things we do in the Additional mtouch arguments field. All are added inside the double quotes of the --gcc_flags option:

    • we have another -cxx option (passed to the gcc compiler)
    • add the path to your libraries using the -L option: "-L/some/path/to/your/libraries"
    • for each library, you need -l and -force_load options. So if your library is named libkiwi.a, it would look something like "-lkiwi -force_load /some/path/to/your/libraries/libkiwi.a"

    The -framework is only used if the library that you have is in a Framework format. We use it mostly to link to Apple supplied iOS frameworks found in standard framework locations. If you are building for the device (as opposed to the simulator), I don't think you want the -arch i386.
    Hope there's something in here that helps you!

Sign In or Register to comment.