Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ld: framework not found AVFoundation #12

Open
hgoebl opened this issue Sep 22, 2015 · 20 comments
Open

ld: framework not found AVFoundation #12

hgoebl opened this issue Sep 22, 2015 · 20 comments

Comments

@hgoebl
Copy link

hgoebl commented Sep 22, 2015

I've got problems running the HelloCordova app following instructions in README.md.

When building, the "Extension" part complains:

Ld /Users/heinrich/Library/Developer/Xcode/DerivedData/HelloCordova-eznefkqjvrrwzlfvfsagktadqadb/Build/Products/Debug-watchos/Hello\ Watch\ Extension.appex/Hello\ Watch\ Extension normal armv7k
    cd /Users/heinrich/work/freelance/happitz/applewatchtest2/platforms/ios
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    export WATCHOS_DEPLOYMENT_TARGET=2.0
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7k -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS2.0.sdk -L/Users/heinrich/Library/Developer/Xcode/DerivedData/HelloCordova-eznefkqjvrrwzlfvfsagktadqadb/Build/Products/Debug-watchos -F/Users/heinrich/Library/Developer/Xcode/DerivedData/HelloCordova-eznefkqjvrrwzlfvfsagktadqadb/Build/Products/Debug-watchos -filelist /Users/heinrich/Library/Developer/Xcode/DerivedData/HelloCordova-eznefkqjvrrwzlfvfsagktadqadb/Build/Intermediates/HelloCordova.build/Debug-watchos/Hello\ Watch\ Extension.build/Objects-normal/armv7k/Hello\ Watch\ Extension.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/../../Frameworks -mwatchos-version-min=2.0 -dead_strip -fembed-bitcode-marker -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -ObjC -framework WatchKit -fobjc-arc -fobjc-link-runtime -fapplication-extension -Xlinker -dependency_info -Xlinker /Users/heinrich/Library/Developer/Xcode/DerivedData/HelloCordova-eznefkqjvrrwzlfvfsagktadqadb/Build/Intermediates/HelloCordova.build/Debug-watchos/Hello\ Watch\ Extension.build/Objects-normal/armv7k/Hello\ Watch\ Extension_dependency_info.dat -o /Users/heinrich/Library/Developer/Xcode/DerivedData/HelloCordova-eznefkqjvrrwzlfvfsagktadqadb/Build/Products/Debug-watchos/Hello\ Watch\ Extension.appex/Hello\ Watch\ Extension

ld: framework not found AVFoundation
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I tried to add AVFoundation to the libraries, but i cannot find it (maybe it has a weird name).

In projects settings, I cannot change the target version for Watch (see export WATCHOS_DEPLOYMENT_TARGET=2.0 above).

I'm using Xcode 7 (7A220), iOS 9 SDK, cordova 5.0.0, node 0.10.38

@hgoebl
Copy link
Author

hgoebl commented Sep 22, 2015

Xcode doesn't let me choose WatchOS 1 in deployment targets in the UI. When I edit the project package file manually and change to WATCHOS_DEPLOYMENT_TARGET=1.0, it has no effect.

@hgoebl
Copy link
Author

hgoebl commented Sep 23, 2015

After some googling I tried following command and the problems had gone:

sudo rm -Rf  ~/Library/Developer/Xcode/DerivedData/*

@hgoebl hgoebl closed this as completed Sep 23, 2015
@hgoebl
Copy link
Author

hgoebl commented Sep 24, 2015

Seems like this is not a reliable solution. Again have the same problem.

Had to enable bitcode, because Xcode was complaining that WatchOS2 needs this.

Is this correct: we need bitcode disabled, because MMWormhole doesn't support it. Version 2.0.0 released a few days ago, so could this be a chance to work around this problem?

Sorry, I'm a newbe in iOS development, just wanted to provide Watch (1.0) support for our ionic app.

@hgoebl hgoebl reopened this Sep 24, 2015
@hgoebl
Copy link
Author

hgoebl commented Sep 24, 2015

Tried to force WATCH_DEPLOYMENT_TARGET = 1.0, but with the same outcome 😞

@EddyVerbruggen
Copy link
Contributor

Sounds to me that the easiest short term solution might be to use XCode 6 (downloadable from Apple, installable next to XCode 7).

In the meanwhile I'll try to find a solution. One way would be to package the wormhole source files with the plugin, instead of the compiled binary. That's will requires some work in our hooks though.

Note that if I include a static compiled wormhole lib with bitcode enabled, it can't be built with XCode 6 anymore.. and I need this to be XCode 6 compatible for the time being.

@hgoebl
Copy link
Author

hgoebl commented Sep 24, 2015

Yes, Xcode 6.4 works.

It's a hassle to configure target family, at the moment the simulator for watch is only black, I don't see any log output from watch, my iPhone lost the pairing to the watch, I have to add some UID to a profile and this all costs so much time...

But anyway, @EddyVerbruggen thank you very much for your help ❤️

@hgoebl hgoebl closed this as completed Sep 24, 2015
@EddyVerbruggen
Copy link
Contributor

@hgoebl It's a nightmare, I know. Thanks for sharing your adventures! 👍

@Mojo90
Copy link

Mojo90 commented Oct 3, 2015

Hi I am using this Plugin: https://github.com/leecrossley/cordova-plugin-apple-watch and made a Pull Request with new MMWormhole. In Simulator everything was fine but Build on Device was not possible with the same Linker Error --> Deleted AVFoundation and CoreMedia from Build Settings of Watch and Extension Target worked for me fine 😎 maybe it helps you...

@hgoebl
Copy link
Author

hgoebl commented Oct 3, 2015

Thanks @Mojo90 I'll try this. Currently working on other tasks, so it'll take some time...

@thomasbaggio
Copy link

@EddyVerbruggen same problem... not able to solve :-(

@EddyVerbruggen
Copy link
Contributor

Reopening as it's currently not Xcode 7 compatible as we all found out.

I still require this to be Xcode 6 compatible, but I'd like to add Xcode 7 support soon.

In the meanwhile though, please use Xcode 6 which you can install from here: http://adcdownload.apple.com/Developer_Tools/Xcode_6.4/Xcode_6.4.dmg

@EddyVerbruggen EddyVerbruggen reopened this Nov 7, 2015
@NorthMcCormick
Copy link

Any updates on this? Removing AVFoundation and CoreMedia are letting me build, but it's only a matter of time before I find out if they're required :/

@robertoandrade
Copy link

AVFoundation is not even a supported framework for the Watch targets... how does one "remove" it as some reported (ie: @NorthMcCormick and @Mojo90)?

@Mojo90
Copy link

Mojo90 commented Dec 15, 2015

Thus I removed them from Watch and Extension Target because it is not supported by the Watch ;-) And I think won't get any trouble from this removal and than I was able to build on the devices

@robertoandrade
Copy link

What i mean is that AVFoundation doesn't even show up on the list when trying to add it to the list of Frameworks on the targets. So I'm wondering how you guys managed to remove it in the first place ;)

@robertoandrade
Copy link

Ok, I think I just found the culprit. On the "Project" definition of the Cordova xcode project, it seems like they automatically add a Build Settings > Linking > Other Linker Flags value containing parameters to be passed to the linker: -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -ObjC

This gets inherited by all targets in the project, including the WatchKit extension ones. So you need to override the Other Linker Flags build setting for the targets and remove such "weak framework" references given those targets are not really using any of the Cordova stack.

@Mojo90
Copy link

Mojo90 commented Dec 15, 2015

👌🏿
I also just managed it like so. Thank god that there is a search field ;)

@santekotturi
Copy link

@robertoandrade & @Mojo90 could you elaborate on how to override the Other Linker Flags? I see the Linking section of Project files but not sure what to delete/edit. Thanks in advance

@robertoandrade
Copy link

@skotturi if you go into your main app's target 'Build Settings' tab and search for "linker" you'll see the Other Linker Flags setting has all the values we mentioned above as the picture below:

image

Now if you switch over to the watch app's target as well as the extension, you'll see they also inherit those settings given it's defined at the "project" level. So for those two targets, just remove the "weak" framework reference, can probably just leave the -ObjC flag as follows:

image

@JasonTolliver
Copy link

@robertoandrade you just saved me hours... thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants