0

I want to use libcaldav with following dependency. I have built libcaldav.0.dylib while other dependencies were installed with port or brew on MAC

otool -L  ~/lib/libcaldav.0.dylib 
~/lib/libcaldav.0.dylib:
    ~/lib/libcaldav.0.dylib (compatibility version 1.0.0, current version 1.6.0)
    /opt/local/lib/libcurl.4.dylib (compatibility version 8.0.0, current version 8.0.0)
    /opt/local/lib/libgnutls.28.dylib (compatibility version 70.0.0, current version 70.1.0)
    /opt/local/lib/libgthread-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.0.0)
    /opt/local/lib/libglib-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.0.0)
    /opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

I tried adding those files to Xcode ios app using

  • Link binary with libraries -> Xcode build phase
  • Other linker flags -> Build Settings
  • Setting appropriate search paths

However, I get following warning and error

ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/lib/libcaldav.0.dylib' for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Enviroment

  • Xcode = 6.1
  • supported Platform = iOS
  • valid architecture = arm64, armv7 and armv7s

libcaldav source

https://github.com/fd00/yacp/tree/master/libcaldav

Please help me as I have been struggling. Please give me pointers what needs to be done.

GJain
  • 5,025
  • 6
  • 48
  • 82
  • You will need to have a version of the library that is built for the ARM architecture. You are targeting a different platform, where the CPU is not a Intel processor but an ARM one. The library needs to be compiled for that. Don't be confused by the fact that you are running the iOS Simulator on your Mac. It's really trying very hard to simulate an iOS device with an ARM processor. – ecotax Nov 09 '14 at 19:03
  • I am getting that would apply to all deps as well...curl gnutls as well...that would be really hard – GJain Nov 09 '14 at 19:08
  • 1
    Be advised that `libcaldav` is licensed under the GNU GPLv2, which is **not** compatible with distribution on the iOS App Store. –  Nov 10 '14 at 01:17
  • @duskwuff thanks for your comment...you made it easy for me to decide which route to go....love SO – GJain Nov 10 '14 at 20:29

1 Answers1

0

You need to build these libraries for iOS and not OS X. Specifically, you will need to use the iOS SDK and armv7 and arm64. If you want to use them in the iOS Simulator as well, you will need to build them for i386 and x86_64 against the iOS Simulator SDK (NOT against the host SDK).

See my answer in cross compile libgcrypt static lib for use on iOS for some hints as to how to do this.

Community
  • 1
  • 1
Jeremy Huddleston Sequoia
  • 22,938
  • 5
  • 78
  • 86