Firebase for Unity (iOS) linker errors (ARCHIVE FAILED)

2,351 views
Skip to first unread message

Kazuki Kyakuno

unread,
Sep 1, 2017, 10:05:51 AM9/1/17
to Firebase Google Group
Yesterday my app was building successfully , but Today suddenly failed my iOS build.
If someone has solved this problem , I want to know solution.

Error log:

8296:        [xcode] clang: error: linker command failed with exit code 1 (use -v to see invocation)
8297:        [xcode] ** ARCHIVE FAILED **
8298:        [xcode] The following build commands failed:
8299:        [xcode] Ld /BUILD_PATH/Library/Developer/Xcode/DerivedData/Unity-iPhone-aqdklqgrefwlhsaqpncongoegwau/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/labyriz normal armv7
8300:        [xcode] Ld /BUILD_PATH/Library/Developer/Xcode/DerivedData/Unity-iPhone-aqdklqgrefwlhsaqpncongoegwau/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/arm64/labyriz normal arm64
8301:        [xcode] (2 failures)
8302: ! build of 'default-ios' failed. compile failed

Today log (Build failed) (FirebaseInstanceID 2.0.2)

18045: [Unity] Downloading dependencies
18046: [Unity] Installing Firebase (4.1.0)
18047: [Unity] Installing FirebaseAnalytics (4.0.3)
18048: [Unity] Installing FirebaseCore (4.0.5)
18049: [Unity] Installing FirebaseInstanceID (2.0.2)
18050: [Unity] Installing FirebaseMessaging (2.0.1)
18051: [Unity] Installing GoogleToolboxForMac (2.1.1)
18052: [Unity] Installing Protobuf (3.4.0)
18053: [Unity] Installing nanopb (0.3.8)

Yesterday log (Build success) (FirebaseInstanceID 2.0.1)

18047: [Unity] Installing Firebase (4.1.0)
18048: [Unity] Installing FirebaseAnalytics (4.0.3)
18049: [Unity] Installing FirebaseCore (4.0.5)
18050: [Unity] Installing FirebaseInstanceID (2.0.1)
18051: [Unity] Installing FirebaseMessaging (2.0.1)
18052: [Unity] Installing GoogleToolboxForMac (2.1.1)
18053: [Unity] Installing Protobuf (3.4.0)
18054: [Unity] Installing nanopb (0.3.8)

Kazuki Kyakuno

unread,
Sep 1, 2017, 8:13:24 PM9/1/17
to Firebase Google Group

Looks like firebase or cocoapods added invalid linker flag "-lz}".




2017年9月1日金曜日 23時05分51秒 UTC+9 Kazuki Kyakuno:

Stewart Miles

unread,
Sep 1, 2017, 8:23:56 PM9/1/17
to Firebase Google Group
-lz links the application with the zlib system library.

Can you reproduce the failure with our quickstart samples on http://github.com/firebase/quickstart-unity ?

If not, could you share your complete command line output?  If you can't do so here, you can file a support request to share your logs.

Cheers,
Stewart

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/2057c30d-dcc7-49ee-bd75-f6858992c4a2%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Kazuki Kyakuno

unread,
Sep 1, 2017, 8:52:30 PM9/1/17
to Firebase Google Group
I could reproduce with quickstart-unity/analytics/testapp.
I attached full log.

2017年9月2日土曜日 9時23分56秒 UTC+9 Stewart Miles:
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
Build target Unity-iPhone_2017-09-02T09-48-50.rtf

ri...@osjastudio.com

unread,
Sep 4, 2017, 10:09:42 AM9/4/17
to Firebase Google Group
I remove -lz} from OTHER LINK FLAG and it work. Finally I can archive and install for testing.

David Little

unread,
Sep 5, 2017, 10:04:55 AM9/5/17
to Firebase Google Group
I am getting the same error along with other stuff being added to the "OTHER_LDFLAGS"

I have to process the Xcode project after the build to remove
"-l\"z\"}"

AND

"$(inherited) -ObjC -l\"c++\" -l\"sqlite3\" -l\"z\" -framework \"FirebaseAnalytics\" -framework \"FirebaseCore\" -framework \"FirebaseCoreDiagnostics\" -framework \"FirebaseInstanceID\" -framework \"FirebaseNanoPB\" -framework \"StoreKit\" -framework \"SystemConfiguration\""

Yes, that is one long string. Then I just add back -l\"c++\" as I already have sqlite3 and lz. All those frameworks are just duplicates of frameworks that are already added to the project so it seems like an error to me.

I'm using Unity5.4.5f1 with Firebase 4.1.0

Mike Perry

unread,
Sep 5, 2017, 11:07:04 PM9/5/17
to Firebase Google Group
I'm seeing this same issue with my project on Unity Cloud Build, using SDK 4.1.0 and UCB set to "latest 5.6". I'm not sure how to manually fix the Xcode project after it is generated on UCB.

16264:        [xcode] ld: library not found for -lz}
16265:        [xcode] clang: error: linker command failed with exit code 1 (use -v to see invocation)
16266:        [xcode] ** ARCHIVE FAILED **
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Stewart Miles

unread,
Sep 7, 2017, 4:27:53 PM9/7/17
to Firebase Google Group
Kazuki, looking at the log you posted the link error is due to "ld: library not found for -lPods-Unity-iPhone"

The seems as if you have Xcode workspace integration enabled and you have built the Xcode project (.xcproj) rather than workspace (.xcworkspace) which is required when you're building in this mode.  Unity 5.6 and above will automatically open the Xcode workspace but if you're building in some other way you may be bitten by this.


Mike, David, rithy@ - and all those seeing ""-lz" library not found" - which Xcode version are you using?

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Kazuki Kyakuno

unread,
Sep 7, 2017, 7:47:28 PM9/7/17
to Firebase Google Group
Miles, the invalid linker flag is "-lz}" not "-lz".
This linker flag includes invalid character "}".
This is reason of linker error.

2017年9月8日金曜日 5時27分53秒 UTC+9 Stewart Miles:

Stewart Miles

unread,
Sep 7, 2017, 7:56:52 PM9/7/17
to Firebase Google Group
Ah gotcha, sorry I missed that (it's Stewart by the way, Miles is my last name ;).

Which pods version is installed on your machine.

i.e the output of the following command:

pod --version


I have:

$ pod --version
1.2.0

I'm wondering whether the xcconfig parser in https://github.com/googlesamples/unity-jar-resolver/blob/master/source/IOSResolver/src/IOSResolver.cs#L2295 is getting tripped up by a change in the file that CocoaPods generates.

Cheers,
Stewart

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Mike Perry

unread,
Sep 7, 2017, 9:56:14 PM9/7/17
to Firebase Google Group
Thanks for your help Stewart. In my case, this invalid character error only occurs when I use Unity Cloud Build. I can build to iOS locally without errors.

Locally, I'm using Unity 5.6.3p2, Firebase 4.1.0, and Xcode 8.3.3. I appear to be using pod version 1.3.1, installed in ~/.gems/ruby/2.0.0/bin. In my project's iOS Resolver settings, I have what I believe are the default settings:

Podfile Generation: checked
Cocoapods Integration set to: Xcode Workspace
Use Shell to Execute Cocoapod Tool: unchecked
Auto Install Cocoapods Tool in Editor: checked

I've imported the FirebaseAuth and FirebaseDatabase assets. Before importing Firebase, I could build to iOS and Android locally and on Unity Cloud Build without errors. After importing Firebase, I can still build iOS and Android locally, but only Android succeeds on Unity Cloud Build. On UCB for iOS, I now get the "-lz}" linker error (with the errant closure bracket).

FWIW, locally, I inspected the Pod .xcconfig files, and I do not see the invalid character.

Thanks again for your help!
-Mike

Kazuki Kyakuno

unread,
Sep 8, 2017, 3:38:17 AM9/8/17
to Firebase Google Group
Stewart , I am truly sorry for writing your name incorrectly.

I attached full log of cloud build.
Pod version seems 1.3.1.

[Unity] '/BUILD_PATH/.rvm/gems/ruby-2.1.1/bin/pod --version' completed with code 0
[Unity] 1.3.1


2017年9月8日金曜日 8時56分52秒 UTC+9 Stewart Miles:
CloudBuildFullLog.txt

Mike Perry

unread,
Sep 13, 2017, 9:39:22 PM9/13/17
to Firebase Google Group
Hi gang, checking in to see if anyone has found a resolution for this issue. As of today, I am still seeing failures of iOS builds on Unity Cloud Build due to the invalid bracket character as described above ("-lz}").

Inspecting the iOSResolver.cs script, my guess is that there is an error with constructing the linkFlags Hashset<string>. But I'm not familiar with this code, and can only offer a guess, and not a solution.

I'm curious: Is anyone successfully building a Unity Firebase iOS project on Unity Cloud Build?

What is the best action to take at this point?

thanks for your help,
Mike

Bartosz Stoliński

unread,
Sep 14, 2017, 10:24:09 AM9/14/17
to Firebase Google Group
Hello everyone,

Mike, I was finally able to build iOS on UCB today. In project we are using Firebase and Appodeal, Unity version is 5.5.0f3.
I was experiencing issues with "-lz}" flag, removed that flag in PostprocessBuild method but then I was seeing "duplicate" errors caused by GoogleToolboxForMac.

The only solution was to disable CocoaPods in Assets/PlayServicesResolver/iOSResolver/settings. However this only worked locally on my Mac.

Luckily there is a trick you can use to disable CocoaPods on UCB. You have to create a method similar to Postprocess build and set it in your build target's advanced settings on UCB.
The method that worked for me was:

public static void OnPreExport(UnityEngine.CloudBuild.BuildManifestObject manifest) {
        Google.IOSResolver.PodfileGenerationEnabled = false;
        Google.IOSResolver.AutoPodToolInstallInEditorEnabled = false;
        Google.IOSResolver.CocoapodsIntegrationMethodPref = IOSResolver.CocoapodsIntegrationMethod.None;
    }



However, after this you have to manually add Firebase frameworks to your project in PostprocessBuild method. Details on how to do this are here.

I hope this will help!
Auto Generated Inline Image 1

Stewart Miles

unread,
Sep 14, 2017, 2:49:29 PM9/14/17
to Firebase Google Group
The other solution is to pin to FirebaseInstanceID 2.0.1, cross posting from https://github.com/firebase/quickstart-unity/issues/112

The problem is in the parser here https://github.com/googlesamples/unity-jar-resolver/blob/6e56d2d22fb246e9ee8ace390dd04a379fb8a114/source/IOSResolver/src/IOSResolver.cs#L317 which is tripped up by FirebaseInstanceID.


Since this is caused by a transitive dependency upon FirebaseInstanceID you can add the pod with the modulemap that does not break our poor excuse for a modulemap parser.

Open up Firebase/Editor/AppDeps.cs and add the following line to the iOS section to force the use of the FirebaseInstanceID pod at version 2.0.1.

        Google.VersionHandler.InvokeStaticMethod(
            iosResolver, "AddPod",
            new object[] { "FirebaseInstanceID" }, 
            new Dictionary<string, object>() { 
                { "version", "2.0.1" },
                { "minTargetSdk", null },
                { "sources", null }
            });

Cheers,
Stewart


2017年9月14日木曜日 7時24分09秒 UTC-7 Bartosz Stoliński:

Mike Perry

unread,
Sep 14, 2017, 9:33:53 PM9/14/17
to Firebase Google Group
Great news. Bartosz, thanks for the details for disabling cocoapods. Very helpful if we end up going that route.

Stewart, the AppDeps.cs workaround is working great for me. I can now build successfully to iOS via Unity Cloud Build.

Thank you for your help!
-Mike

Stewart Miles

unread,
Sep 19, 2017, 2:36:24 PM9/19/17
to Firebase Google Group
Version 1.2.50 of https://github.com/googlesamples/unity-jar-resolver should now resolve this issue, you can import this into your projects now to allow you to remove the workarounds.  We're in the process of rolling this up into the Firebase SDK and will post and update when the release is ready.
Reply all
Reply to author
Forward
0 new messages