Cocoalumberjack: Support for new architecture arm64e

Created on 18 Oct 2018  ·  21Comments  ·  Source: CocoaLumberjack/CocoaLumberjack

New Issue Checklist

Issue Info

Info | Value |
-------------------------|-------------------------------------|
Platform Name | ios
Platform Version | 11.x
CocoaLumberjack Version | 3.4.2
Integration Method | carthage
Xcode Version | Xcode 10
Repro rate | all the time (100%)

Issue Description and Steps

Continuing the discussion from https://github.com/CocoaLumberjack/CocoaLumberjack/issues/930

There is a new architecture added "arm64e" on new iPhone hardware (iPhone Xs and iPhone Xs Max) because of which I am seeing an issue (undefined architecture arm64e) whenever I try building my app on these devices through Xcode 10.

The warning is

ignoring fie ./Lumberjack/CocoaLumberjack.frameowrk/CocoaLumberjack, missing required architecture arm64e in file ./Lumberjack/CocoaLumberjack.frameowrk/CocoaLumberjack (4 slices)

and corresponding errors

"_OBJC_CLASS_$_DDFileLogger", referenced from:
  "_OBJC_CLASS_$_DDLog", referenced from:
  "_OBJC_CLASS_$_DDLogFileManagerDefault", referenced from:
  "_OBJC_CLASS_$_DDTTYLogger", referenced from:
  "_OBJC_IVAR_$_DDLogMessage._flag", referenced from:
  "_OBJC_IVAR_$_DDLogMessage._message", referenced from:
  "_OBJC_IVAR_$_DDLogMessage._timestamp", referenced from:
  "_OBJC_METACLASS_$_DDLogFileManagerDefault", referenced from:

Looks like currently the framework is built for following architectures

i386 x86_64 armv7 arm64

I used xcrun -sdk iphoneos lipo -info ./CocoaLumberjack to figure it out.

Most helpful comment

@ffried

I believe this link, really!
It is not a lie 🍰

All 21 comments

Thanks @Sopan for moving the issue to a new ticket. We need to solve this.

From #930:

I thought leaving the setting (VALID_ARCHS) unfilled will use the default value which should include all the needed architectures.

@bpoplauschi is right on this. Leaving VALID_ARCHS empty does use the defaults. Xcode 10 even enforces this more by emitting a warning if it is not empty.

I've recently built a project using CocoaLumberjack against an XS Max and didn't get any warnings. Can you reproduce this in a new project? Otherwise I suspect something's off in your configuration.
Although I don't use Carthage but integrate it directly. Are you using Carthage only as resolver or does Carthage also build the frameworks in your project?

I'll try to reproduce this later today.

I've found this project: https://github.com/google-fabric/FABConfig - looks useful.
Look at their Architectures.xcconfig:

ARCHS = i386 x86_64 armv7 armv7s armv7k arm64 arm64e

ONLY_ACTIVE_ARCH_Debug = YES
ONLY_ACTIVE_ARCH_Release = NO
ONLY_ACTIVE_ARCH = $(ONLY_ACTIVE_ARCH_$(CONFIGURATION))

VALID_ARCHS[sdk=macosx*] = x86_64
VALID_ARCHS[sdk=watchos*] = armv7k
VALID_ARCHS[sdk=watchsimulator*] = i386
VALID_ARCHS[sdk=appletvos*] = arm64
VALID_ARCHS[sdk=appletvsimulator*] = x86_64
VALID_ARCHS[sdk=iphoneos*] = arm64e arm64 armv7s armv7
VALID_ARCHS[sdk=iphonesimulator*] = i386 x86_64

SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator

That might be an idea for us, easy to do now since we have the xcconfigs

Yeap, seems like this is what we need.
I added the ARCHS and VALID_ARCHS settings to our Module-Shared.xcconfig, compiled (of course the iphoneos version).
Running xcrun -sdk iphoneos lipo -info CocoaLumberjack.framework/CocoaLumberjack returns
Architectures in the fat file: CocoaLumberjack.framework/CocoaLumberjack are: armv7 armv7s arm64 arm64e

I've had something similar in my universal projects (just directly in the build settings). But with Xcode 10, I had to remove all of the VALID_ARCHS and ARCHS definitions, because Xcode kept warning to use the default.

I get no warnings with those settings. They look good. I tend to trust the Fabric team, they have strong engineers.

@bpoplauschi
I have asked about this at Bug Report - Apple Engineers said that YES, keep them all default.

You should not change architecture settings.

@bpoplauschi
That is what just they said:

Can you please try upgrading to the new build system.
You can do this by going into your project settings and selecting “New Build System” from the build system menu.
With the new build system, these builds worked correctly.
Also, you have VALID_ARCHS overridden, and you really shouldn’t be doing that.

If you want, I could expand whole conversation and fill openradar for it.

Hmmm ... not sure what to do here :)

We are using the new build system but still the arm64e architecture is not included.

I'd really like to know the setup here.

@Sopan Can you provide some answers to my questions here? I think that'll give us some hints if there's something to change on our side.

I've recently built a project using CocoaLumberjack against an XS Max and didn't get any warnings. Can you reproduce this in a new project? Otherwise I suspect something's off in your configuration.
Although I don't use Carthage but integrate it directly. Are you using Carthage only as resolver or does Carthage also build the frameworks in your project?

@lolgear:
Huh? So Xcode 10.0 does not yet support arm64e? Interesting.

@Sopan Are you using the Xcode 10.1 Beta by any chance?

@ffried

I believe this link, really!
It is not a lie 🍰

That might explain some things. But I just used Xcode 10.0 to build arm64e. Maybe they shipped it but they don't use it by default ...

I suspect the app project declares support for arm64e manually. Then Xcode somehow builds for it, but does not automatically add it for projects that do not manually specify it. But we really should just rely on Xcode's default here. Manually adding archs can cause all sorts of weird behavior. Been there done that. And we don't want to do it if not absolutely necessary. 😉

Also from the release notes:

The App Store and TestFlight don't accept submissions containing arm64e. Xcode will remove arm64e content from your app when you distribute from the Organizer window.

While Apple describes how to add the arch manually in the release notes, this is really only for preview. So if someone wants to try it, they just need to add it manually to all dependencies anyways. We shouldn't add it to a production version before it's declared ready by Apple (at which point I'm sure it'll also be automatically inferred).

I assume Xcode 10 should not build arm64e architecture and Xcode 10.1 will, so the best way is to leave it to Xcode defaults.

About this issue, I will remove it from the 3.5.0 milestone, as we can't do anything until Xcode 10.1 is out and we can check. Or maybe we can trigger a CI build with Xcode 10.1 beta.

@bpoplauschi I'm closing this. While we want support future Xcode versions, arm64e support is even in beta state in the beta of Xcode 10.1. So more like in alpha state.

@Sopan Should this still happen by the time Xcode 10.1 has proper (non-preview) support for arm64e, please do re-open. Until then, there's nothing we can do here.

@Sopan That doesn't mean you can't test your app against arm64e with the Xcode 10.1 Beta. You'd just have to manually adjust CocoaLumberjacks archs as well (as described in the release notes). Depending on how you use Carthage, you either need to fork this repo, or you can do it inline in the Checkouts folder of Carthage.

@ffried I think Xcode 10.1 will include arm64e into the default VALID_ARCHS

Was this page helpful?
0 / 5 - 0 ratings