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

Compile under Xcode 8 beta 1 #302

Merged
merged 3 commits into from
Jun 18, 2016
Merged

Compile under Xcode 8 beta 1 #302

merged 3 commits into from
Jun 18, 2016

Conversation

sharplet
Copy link
Contributor

@sharplet sharplet commented Jun 14, 2016

Sets "Use Legacy Swift Language Version" to YES, i.e., SWIFT_VERSION = 2.3.

This change alone causes the following linker error:

duplicate symbol __non_lazy_classes in:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o)
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o)
duplicate symbol _OBJC_METACLASS_$___ARCLite__ in:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o)
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o)
ld: 2 duplicate symbols for architecture x86_64

This appears to be caused by the "Implicitly Link Objective-C Runtime Support" build setting (a.k.a. CLANG_LINK_OBJC_RUNTIME). Disabling just this setting doesn't resolve the error, but disabling the
project-level ARC setting does resolve the linker error. As a result the -fobjc-arc compiler flag has to be set on each Objective-C file to ensure it is compiled with ARC enabled.

@sharplet
Copy link
Contributor Author

It seems likely that this is just a bug in the beta's handling of Swift 2.3, so I'll probably file a radar.

@sharplet
Copy link
Contributor Author

Radar: https://openradar.appspot.com/radar?id=5006639585296384

@NachoSoto
Copy link
Contributor

Awesome, thanks for getting this started! Let me know if I can do anything to help.

@sharplet
Copy link
Contributor Author

sharplet commented Jun 16, 2016

I just realised there's a problem with the tvOS target under Xcode 8. When I compile for tvOS, I get this warning:

warning: target specifies SWIFT_VERSION = '2.3', but it is overridden by TOOLCHAINS = 'com.apple.dt.toolchain.AppleTVOS10_0'

This means that the target is always compiled under Swift 3, which doesn't work at all.

I haven't been able to work out a way to disable this, looks like it could be a bug specific to the tvOS 10 SDK.

@sharplet
Copy link
Contributor Author

@jckarter and @ddunbar on Twitter have suggested some alternative workarounds:

Raising the deployment targets to latest resolves the issue for iOS and macOS. I can't really verify with tvOS at this point. However it's not really a change that's appropriate to push onto users, so I'm not sure we can move ahead with it.

I also tried disabling linking with standard libraries (i.e., -nostdlib), but that introduces other linker problems I'm not really sure how to resolve 😅

@ikesyo
Copy link
Member

ikesyo commented Jun 16, 2016

@sharplet #302 (comment)

It seems that #304 should fix the issue. See also Quick/Quick#548.

Sets "Use Legacy Swift Language Version" to YES, i.e., `SWIFT_VERSION = 2.3`.

This change alone causes the following linker error:

    duplicate symbol __non_lazy_classes in:
        /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o)
        /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o)
    duplicate symbol _OBJC_METACLASS_$___ARCLite__ in:
        /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o)
        /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o)
    ld: 2 duplicate symbols for architecture x86_64

This appears to be caused by the "Implicitly Link Objective-C Runtime
Support" build setting (a.k.a. `CLANG_LINK_OBJC_RUNTIME`). Disabling
just this setting doesn't resolve the error, but disabling the
project-level ARC setting does resolve the linker error. As a result the
`-fobjc-arc` compiler flag has to be set on each Objective-C file to
ensure it is compiled with ARC enabled.
@sharplet
Copy link
Contributor Author

Thanks @ikesyo tvOS is working now!

@sharplet
Copy link
Contributor Author

Alright, CI is looking good on Xcode 7.3 on all platforms. I've just pushed another commit that adds Xcode 8 to the CI matrix.

@sharplet
Copy link
Contributor Author

@Quick/contributors what are your thoughts about the idea of tagging v4.0.2 to include these changes?

@modocache
Copy link
Member

Sounds great!! Thanks for the speedy work, @sharplet and @ikesyo!

@sharplet
Copy link
Contributor Author

Ugh, both CI failures seem to be related to code signing for iOS under Xcode 8.

@sharplet
Copy link
Contributor Author

I haven't been able to reproduce the failure locally. Not sure why it fails on Xcode 8 but not Xcode 7.3.

@ikesyo
Copy link
Member

ikesyo commented Jun 16, 2016

What happens if we apply the patch, removing appletvos and appletvsimulator from SUPPORTED_PLATFORMS on Nimble-iOSTests:

diff --git a/Nimble.xcodeproj/project.pbxproj b/Nimble.xcodeproj/project.pbxproj
index 1f929f9..099d0cb 100644
--- a/Nimble.xcodeproj/project.pbxproj
+++ b/Nimble.xcodeproj/project.pbxproj
@@ -1595,7 +1595,6 @@
                METAL_ENABLE_DEBUG_INFO = YES;
                PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
                PRODUCT_NAME = NimbleTests;
-               SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvsimulator appletvos";
                SWIFT_OPTIMIZATION_LEVEL = "-Onone";
            };
            name = Debug;
@@ -1613,7 +1612,6 @@
                METAL_ENABLE_DEBUG_INFO = NO;
                PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
                PRODUCT_NAME = NimbleTests;
-               SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvsimulator appletvos";
            };
            name = Release;
        };

@sharplet
Copy link
Contributor Author

:fingers_crossed:

@ikesyo
Copy link
Member

ikesyo commented Jun 16, 2016

😩

2016-06-16 05:15:05.277 xcodebuild[1272:3682] Error Domain=IDETestOperationsObserverErrorDomain Code=3 "Canceling tests due to timeout in Checking test manager availability... If you believe this error represents a bug, please attach the log file at /Users/travis/Library/Developer/Xcode/DerivedData/Nimble-cynnqpiijwxeiicemrswimekklda/Logs/Test/83D7476C-50D3-4831-B4EC-4673EEC57661/Session-NimbleTests-2016-06-16_051302-HzlhfC.log" UserInfo={NSLocalizedDescription=Canceling tests due to timeout in Checking test manager availability... If you believe this error represents a bug, please attach the log file at /Users/travis/Library/Developer/Xcode/DerivedData/Nimble-cynnqpiijwxeiicemrswimekklda/Logs/Test/83D7476C-50D3-4831-B4EC-4673EEC57661/Session-NimbleTests-2016-06-16_051302-HzlhfC.log}
2016-06-16 05:15:05.316 xcodebuild[1272:6197] Connection peer refused channel request for "dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface"; channel canceled <DTXChannel: 0x7f9649aa3c00>

@sharplet
Copy link
Contributor Author

Ok, so everything is fine on CI for all platforms except iOS on Xcode 8. Everything is peachy on my machine. @Quick/contributors what do you say we go ahead and merge this then push a new release?

@modocache
Copy link
Member

Let's do it! 🚀

On Sat, Jun 18, 2016 at 4:14 PM -0400, "Adam Sharp" notifications@github.com wrote:

Ok, so everything is fine on CI for all platforms except iOS on Xcode 8. Everything is peachy on my machine. @Quick/contributors what do you say we go ahead and merge this then push a new release?


You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@sharplet sharplet merged commit a8761c8 into master Jun 18, 2016
@sharplet sharplet deleted the xcode-8 branch June 18, 2016 20:46
@briancroom
Copy link
Member

Awesome!

@NachoSoto
Copy link
Contributor

👏🏻

@sharplet
Copy link
Contributor Author

After checking the changes since v4.0.1, I think it would be best to bump to v4.1.0. Working on the release notes now!

@ikesyo ikesyo mentioned this pull request Jul 6, 2016
Megal pushed a commit to Megal/Nimble that referenced this pull request Jul 31, 2019
Compile under Xcode 8 beta 1
phatblat pushed a commit to phatblat/Nimble that referenced this pull request May 3, 2020
Bridge example metadata to Objective-C
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

Successfully merging this pull request may close these issues.

5 participants