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

Swinject crashes swiftc in Xcode 9 #261

Closed
atomicbird opened this issue Jun 6, 2017 · 21 comments
Closed

Swinject crashes swiftc in Xcode 9 #261

atomicbird opened this issue Jun 6, 2017 · 21 comments
Labels

Comments

@atomicbird
Copy link

When building Swinject with Xcode 9, Swinject causes a segmentation fault in swiftc. I know this isn't your fault (the compiler shouldn't crash) but I thought I should mention it here. I've also filed this with Apple as rdar://32589507

To reproduce: Clone the repo as it is right now. Open Swinject.xcodeproj in Xcode 9. Build. Swiftc will have a segmentation fault and die, causing a build failure.

@paulz
Copy link

paulz commented Jun 6, 2017

@atomicbird, thank you for the radar link, sorry for autocomplete spelling

@amccarri
Copy link
Contributor

amccarri commented Jun 6, 2017

@atomicbird probably meant for you :)

@atomicbird
Copy link
Author

A redacted version is at http://www.openradar.me/radar?id=6150666519052288 (the original contained details of my project that I can't put on OpenRadar).

@yjm607
Copy link

yjm607 commented Jun 7, 2017

Changing code in ObjectScope.Standard.swift fixed the issue for me:

screen shot 2017-06-07 at 2 05 40 pm

@yoichitgy yoichitgy added the bug label Jun 8, 2017
@yoichitgy
Copy link
Member

Thanks everyone for investigating the issue!!!

Please use swift4 branch for now if you try Swinject with Xcode 9 beta💪

Carthage:

github "Swinject/Swinject"

CocoaPods:

pod 'Swinject', :git => 'https://github.com/Swinject/Swinject.git', :branch => 'swift4'

@andrei-kuzma
Copy link

Hi everyone,
It's a little bit confused as this branch works for swift 3.2 but not for swift 4

@yoichitgy
Copy link
Member

yoichitgy commented Jun 8, 2017

@andrei-kuzma, please take it easy. I just wondered which one in xcode9, swift4 or swift3-4 was good as the branch name, and picked swift4 for simplicity and not to stick on xcode especially for linux users.

I think we'll support Swift 3 and 4 in swift4 branch. I found some problems to compile the source as Swift 4. I think we can fix the problems with both Swift 3 and 4 supported. If the branch swift4 looks redundant, we can merge the branch to master soon.

@kerry
Copy link

kerry commented Jun 8, 2017

@yjm607 Can you create a PR with your solution? It will solve problems for the current master branch.

@yjm607
Copy link

yjm607 commented Jun 8, 2017

@kerry Sure will do. It will be my first PR to a pubic project.. Exciting!

@yjm607
Copy link

yjm607 commented Jun 8, 2017

Hmm I just realized that I don't have permission to commit to the project... looks like /swift4 branch already has my changes, but if someone else who has permission can open a PR to master that would be great.

@kerry
Copy link

kerry commented Jun 8, 2017

@yjm607 You definitely won't be able to commit to the project. You will have to create a pull request. Create a fork. Make changes there. Then create a pull request from your fork to the main repo

@yjm607
Copy link

yjm607 commented Jun 8, 2017

@kerry Maybe I'm doing something wrong here... I forked from master, made changes, and tried to push to remote. I get the following error..
screen shot 2017-06-08 at 7 51 33 am

@kerry
Copy link

kerry commented Jun 8, 2017

@yjm607 because you are pushing onto the main repo instead of your fork. See the url "https://github.com/Swinject/Swinject/", this should have been "https://github.com/yjm607/Swinject"

@yjm607
Copy link

yjm607 commented Jun 8, 2017

@kerry Thanks Kerry! I just pushed the changes:
2d85ba3

@yoichitgy
Copy link
Member

Thanks @yjm607 and @kerry for the investigation👍 Please check swift4 branch that has the same workaround😃

@yoichitgy yoichitgy added question and removed bug labels Jun 9, 2017
@atomicbird
Copy link
Author

As of today:

Engineering has determined that your bug report (32589507) is a duplicate of 32618754 and will be closed.

No telling when it'll be fixed but it looks like Swinject is handling it nicely.

@osfalt
Copy link

osfalt commented Jun 20, 2017

What about the compatibility of Swinject with branch 'swift4' and SwinjectStoryboard?

@sashagood
Copy link

sashagood commented Jun 27, 2017

Segmentation fault happens when using SwinjectStoryboard and Swinject (swift4 branch). Have anybody investigated that?

That happens if we pass the controller as protocol (ProjectsListViewInputProtocol).

container.storyboardInitCompleted(ProjectsListViewController.self) { (r, controller: ProjectsListViewInputProtocol) in
            let presenter = r.resolve(ProjectsListPresenterProtocol.self, argument: controller)!
            controller.presenter = presenter
}

@ghost
Copy link

ghost commented Jun 28, 2017

Is it possible to use SwinjectAutoregistration and satisfy dependencies while using the swift4 branch?
I asked the question (with more details) on stack overflow.

EDIT
By specifying this github repo as the source for the pod, it works fine. [See my answer] (https://stackoverflow.com/a/44825451/873436).

@yoichitgy
Copy link
Member

I confirmed Xcode 9 beta 4 resolved the original issue. If you use Xcode 9 beta 4 or later, you can use master with both Xcode 8 and 9 (beta 4).

@yoichitgy
Copy link
Member

Swinject 2.1.1 supports both Xcode 8.3 and 9 beta, and both Swift 3 and 4.
https://github.com/Swinject/Swinject/releases/tag/2.1.1

If you use Xcode beta, make sure it is beta 4 or later.

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

No branches or pull requests

9 participants