1

I have build a App based on OS X FUSE (ie I have my own file system based on OS X FUSE). When OSXFUSE is installed I can of course include the OSXFUSE.framework from /Library/Frameworks. However when I distribute the App I cannot expect the user to already have it installed, so I tried to include the framework with the bundle as follows:

  • dragged the framework from /Library/Frameworks to my project
  • created a new Copy Files build phase (with target Frameworks)
  • added the framework to that copy build phase

However when I run that on a system without FUSE installed I get an error:

dyld: Library not loaded: /Library/Frameworks/OSXFUSE.framework/Versions/A/OSXFUSE Referenced from: /Users/me/Library/Developer/Xcode/DerivedData/

Shouldn't the copy build phase prevent this? What am I missing here?

codingFriend1
  • 6,487
  • 6
  • 45
  • 67
  • The first thing to check of course is if the framework actually got copied into the app bundle. Have you tried to use "Show Package Contents" from the finder on the app bundle? Alternatively, `cd` into the bundle from Terminal. Next, you still may need to set the dyld link paths right (a while since I touched this). See my close vote comment. – Monolo May 08 '13 at 11:59
  • Pretty sure it is a dupe of this one: [How do I create a working framework with dylib files in Xcode 4](http://stackoverflow.com/questions/7562793/how-do-i-create-a-working-framework-with-dylib-files-in-xcode-4) – Monolo May 08 '13 at 12:01
  • Yes, the framework is actually copied to the app bundle (to the Frameworks folder). I read your linked questions and I added `@loader_path/../Frameworks` to the `Runpath Search Path` but that had no effect... – codingFriend1 May 08 '13 at 12:44
  • The man page quoted actually suggests to use `@executable_path` if it is to be loaded from an app bundle (as opposed to a plug-in bundle). I understand that you are building an app, and not a plug-in? – Monolo May 08 '13 at 12:55
  • I also tried `@executable_path/../Frameworks` but that doesn't work either. Also I am a bit confused. I have used various 3rd party frameworks in the past (like sparkle, dropbox, etc) and it was always enough to add them to the copy files build phase. I have never had to change any framework search paths. What is special with this OSXFUSE framework? – codingFriend1 May 08 '13 at 13:52
  • Relevant docs: https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html#//apple_ref/doc/uid/20002258-106880 – Monolo May 08 '13 at 14:18

2 Answers2

1

I finally found out that I can tell XCode explicitly to weakly link a framework by changing the required flag to optional.

This can be done in Project Overview > Target > Linked Frameworks and Libraries. Next to each framework is a dropdown-menu where you can select optional.

Change link status for framework

So my question is actually a duplicate of this How do I weak link frameworks on Xcode 4?

Community
  • 1
  • 1
codingFriend1
  • 6,487
  • 6
  • 45
  • 67
0

I believe that the OSXFuse framework needs a corresponding kernel module to work. This has to be installed separately so you would have to put together an installer package that first installs the kernel module and the preferences pane, and then installs your application.

Alternatively, you could notify the user that the module needs to be installed separately and provide a download link or something to that effect.

dandan78
  • 13,328
  • 13
  • 64
  • 78
  • I thought the actual purpose of dynamic libraries/frameworks is, that they are weakly linked. I do include the installer, but how can I notify the user about the missing FUSE library when my App won't even start up. What I would like to do is check for the FUSE installation at runtime, and ask to install it if it is not present. How can I do that? I don't want to have an installer for my App, because the FUSE component is optional. – codingFriend1 Jun 24 '13 at 08:22
  • Yeah, DLLs and their OSX equivalent are intended to enable run-time linking, but that does not mean that presence of the library is optional. As for your concrete problem, perhaps you could add a separate executable to check if the library is there and launch the application if it is, or ask the user to download it if it isn't. – dandan78 Aug 05 '13 at 08:09
  • I see. Thanks for the answer. I already have a separate executable to check for the installation and offer the download. I was just hoping that I could put all in one single app and check at runtime... – codingFriend1 Aug 05 '13 at 12:48