Swift 4.0 Link errors

1,785 views
Skip to first unread message

Allan Hoeltje

unread,
Sep 26, 2017, 3:30:12 PM9/26/17
to AudioKit Users Group
I made the leap to Swift 4.0 and Xcode 9 today and attempted to build the AK frameworks cloned from the AK master branch.  I am hitting a link errors on a long list of _obj_ symbols, the first one being:

Undefined symbols for architecture x86_64:
  "_objc_setProperty_atomic", referenced from:
      -[AKBalancerAudioUnit setOutputBus:] in AKBalancerAudioUnit.o
      -[AKBalancerAudioUnit setInputBusArray:] in AKBalancerAudioUnit.o
      -[AKBalancerAudioUnit setOutputBusArray:] in AKBalancerAudioUnit.o
      -[AKAudioUnit setOutputBus:] in AKAudioUnit.o
      -[AKAudioUnit setInputBusArray:] in AKAudioUnit.o
      -[AKAudioUnit setOutputBusArray:] in AKAudioUnit.o
      -[AKAudioUnit setDefaultFormat:] in AKAudioUnit.o
      ...
  "_objc_autorelease", referenced from:
      -[AKTremoloAudioUnit allocateRenderResourcesAndReturnError:] in AKTremoloAudioUnit.o
 …etc…

Is AudioKit not yet ready for Swift 4.0?

-Allan

Allan Hoeltje

unread,
Sep 27, 2017, 3:21:23 AM9/27/17
to AudioKit Users Group
A followup on this problem I posted yesterday when trying to build the AK framework from scratch.  What I saw yesterday was on my laptop, a MacBook Pro (mid 2015) running OS 10.12.6 with Xcode Version 9.0 Swift 4.0.

I have not resolved this yet so I switched to my desktop Mac Pro (late 2013) running the same OS, XCode, and Swift.  What I see on the desktop is very different.

From the readme "Build Frameworks from Scratch" notes:
Go to the `Frameworks` directory and run the `./build_frameworks.sh` script.

Result:
<unknown>:0: error: module file's minimum deployment target is ios11.0 v11.0: /Users/ahoeltje/Work/AudioKit-4.0/Frameworks/build/Release-iphonesimulator/AudioKit.framework/Modules/AudioKit.swiftmodule/x86_64.swiftmodule
** BUILD FAILED **
The following build commands failed:
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
CompileSwift normal x86_64
(2 failures)

Note: I get the same error if I set the iOS deployment target in the AudioKit xcodeproj to my preferred iOS 9.0

What's up with this?  Why two different error results?

Note that I am able to build AudioKit (on both the laptop and desktop) if I include 'AudioKit For iOS.xcodeproj' as a target in my Xcode project but it would be better if I could build a stand-alone framework.

-Allan

Stephane Peter

unread,
Sep 27, 2017, 3:56:15 AM9/27/17
to AudioKit Users Group
What does `Xcode-select -print-path` show on your desktop Mac? It's possible you are using a different version of the Xcode tools when using the script to compile from the command line.

Allan Hoeltje

unread,
Sep 27, 2017, 5:12:48 PM9/27/17
to AudioKit Users Group
==> xcode-select -print-path
/Applications/Xcode.app/Contents/Developer

==> xcodebuild -version
Xcode 9.0
Build version 9A235

==> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift --version
Apple Swift version 4.0 (swiftlang-900.0.65 clang-900.0.37)
Target: x86_64-apple-macosx10.9



My Xcode tool chain is the latest 9.0 on both my laptop and desktop machines.

Is no one else having this problem building AK 4.0 with the latest Xcode?

-Allan

Aurelius Prochazka Ph.D.

unread,
Sep 27, 2017, 6:05:51 PM9/27/17
to AudioKit Users Group
There are issues, but no one seems to have the exact problem you're encountering.  Building always works because we actually have an automated service checking to make sure everything builds and tests pass.  But, of course the automated service has basically a pristine macOS machine to run off of.

Aure

Allan Hoeltje

unread,
Sep 28, 2017, 3:57:18 PM9/28/17
to AudioKit Users Group
For what it's worth, I reinstalled Xcode 9 and still encounter the build_frameworks failure.  I then removed my clone of AudioKit, re-cloned it from GitHub, but still get the same build failure.  The command-line output is attached.

I then downloaded the AudioKit.zip - which I assume is the master release for 4.0, not the developer version - and it builds successfully as expected.

My conclusion, after spending a good two days on this, is that the developer branch of AK has a build issue.

Onward.

-Allan

audioKit4-build-failure.txt

Aurelius Prochazka Ph.D.

unread,
Sep 28, 2017, 4:33:42 PM9/28/17
to AudioKit Users Group
Maybe, although the developer branch is what Travis tests and what I use, so I am doubtful.  Did you delete your DerivedData folder?  A problem would persist across Xcode9 installations because those files would have remained.

Aure 

Allan Hoeltje

unread,
Sep 28, 2017, 7:19:06 PM9/28/17
to AudioKit Users Group
> Did you delete your DerivedData folder?

I deleted the entire AudioKit folder (which is where the DerivedData lived) before I re-cloned it from GitHub.  There was no chance of a previous DerivedData folder since it was a fresh clone.  Besides, what is the "clean" in the build script doing if not removing previous binaries?

-Allan

Aurelius Prochazka Ph.D.

unread,
Sep 28, 2017, 7:44:37 PM9/28/17
to AudioKit Users Group
That depends on the Xcode set up, there is a common Derived Data folder in ~/Library/Developer/Xcode Its not part of the repo. And just because Xcode says its cleaning, you're really going to trust it?  All I'm trying to do is help you and I'm sensing a whole lot of push back.  

Aure

Allan Hoeltje

unread,
Sep 29, 2017, 11:03:50 PM9/29/17
to AudioKit Users Group
Aure,

Alas, I think I have found the problem.  But first...

> there is a common Derived Data folder

My Derived Data folder is configured relative to the Xcode project file, not the ~/Library.  I've been doing that since Xcode was released.

> And just because Xcode says its cleaning, you're really going to trust it?

If you have some doubt about leftover residual files after an Xcode clean then maybe the build script should perform a more proactive cleansing?  As it is, this was not the problem since the build was performed on a fresh AudioKit clone from GitHub - there were no residual files from any previous build.

> I'm sensing a whole lot of push back.

I think you are being a bit defensive since I have only described what I am seeing with this version and I have never seen this problem before.  I am only trying to help you.

Now, back to the problem.

The work I am doing with AudioKit involves building for iOS.  I am not concerned with MacOS (for the time being) nor tvOS.  Therefore I generally only look at the Xcode project for iOS and care only about the iOS framework.  However, the build script is also building for MacOS.

So I looked at the Xcode project file for MacOS and found two potential problems.

1) The AudioKitTest target Development Team was set to W22K9JG3J6 (unknown to me!)
2) The AudioKitTest Deployment Target was set to macOS 10.11
3) The build settings for the AudioKit itself does not specify a Team
   
and its target is set to 10.12.



After making sure the MacOS target was consistently set to 10.12 and removing the W22K9JG3J6 team I was able to get the build_frameworks.sh script to complete successfully.

It is very unfortunate that the Xcode build system did not provide a more explicit error message but now that I look at the output again it does at least hint that the error might have happened in the Signing step:

Touching AudioKit.framework
Signing /Users/ahoeltje/Work/AudioKit-4.0/Frameworks/build/Release-iphonesimulator/AudioKit.framework
Building AudioKit For iOS/AudioKitUI [Release]
Check Dependencies
Processing Info.plist
** BUILD FAILED **

The following build commands failed:

 
CompileSwift normal i386
 
CompileSwiftSources normal i386 com.apple.xcode.tools.swift.compiler
(2 failures)



Albeit the signing step for the iOS framework, not the MacOS.  Go figure?  The fix I made was to the MacOS project file, not the iOS.

So, I hope this has been helpful!

-Allan

Reply all
Reply to author
Forward
0 new messages