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

SystemStackError after MacOS & Xcode upgrade #511

Open
dthuering opened this issue Oct 10, 2017 · 22 comments
Open

SystemStackError after MacOS & Xcode upgrade #511

dthuering opened this issue Oct 10, 2017 · 22 comments

Comments

@dthuering
Copy link

Hi,

today I suddenly got the following error message when running fastlane in the gym part.
Only changed MacOS to HighSierra and use XCode 9 now.

/Users/danny/.rvm/gems/ruby-2.4.2/gems/xcodeproj-1.5.2/lib/xcodeproj/project/object/build_configuration.rb:135:in `match_variable': stack level too deep (SystemStackError)
	from /Users/danny/.rvm/gems/ruby-2.4.2/gems/xcodeproj-1.5.2/lib/xcodeproj/project/object/build_configuration.rb:122:in `resolve_variable_substitution'
	from /Users/danny/.rvm/gems/ruby-2.4.2/gems/xcodeproj-1.5.2/lib/xcodeproj/project/object/build_configuration.rb:87:in `resolve_build_setting'
	from /Users/danny/.rvm/gems/ruby-2.4.2/gems/xcodeproj-1.5.2/lib/xcodeproj/project/object/build_configuration.rb:128:in `resolve_variable_substitution'
	from /Users/danny/.rvm/gems/ruby-2.4.2/gems/xcodeproj-1.5.2/lib/xcodeproj/project/object/build_configuration.rb:131:in `resolve_variable_substitution'
	from /Users/danny/.rvm/gems/ruby-2.4.2/gems/xcodeproj-1.5.2/lib/xcodeproj/project/object/build_configuration.rb:87:in `resolve_build_setting'
	from /Users/danny/.rvm/gems/ruby-2.4.2/gems/xcodeproj-1.5.2/lib/xcodeproj/project/object/build_configuration.rb:128:in `resolve_variable_substitution'
	from /Users/danny/.rvm/gems/ruby-2.4.2/gems/xcodeproj-1.5.2/lib/xcodeproj/project/object/build_configuration.rb:131:in `resolve_variable_substitution'
	from /Users/danny/.rvm/gems/ruby-2.4.2/gems/xcodeproj-1.5.2/lib/xcodeproj/project/object/build_configuration.rb:87:in `resolve_build_setting'
	 ... 8929 levels...
	from /Users/danny/.rvm/gems/ruby-2.4.2/bin/fastlane:23:in `load'
	from /Users/danny/.rvm/gems/ruby-2.4.2/bin/fastlane:23:in `<main>'
	from /Users/danny/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:15:in `eval'
	from /Users/danny/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:15:in `<main>'
@dgyesbreghs
Copy link

+1

@UnsafePointer
Copy link
Contributor

Can you share a project where we can reproduce this?

@dthuering
Copy link
Author

It is a private customer project. But I will try to reproduce.

@yonicsurny
Copy link

Coming here from fastlane/fastlane#10500 (comment).

Using gem 'xcodeproj', '1.5.1' worked for me.

@tmspzz
Copy link

tmspzz commented Oct 26, 2017

Same here, xcodeproj 1.5.1 works fine. Maybe a git bisect can help identifying the change that causes the problem?

@UnsafePointer
Copy link
Contributor

It's very likely that this is the problem: #501, but it would be really helpful to have a sample project here.

It's either the SDKROOT or PRODUCT_BUNDLE_IDENTIFIER build setting that is causing this, according to the usage, but I'm not sure what kind of setup causes the method to recurse infinitely.

@tmspzz
Copy link

tmspzz commented Oct 26, 2017

@Ruenzuo if you can share a "quick guide to debugging" I'd be glad to help. I can't share the project unfortunately.

@UnsafePointer
Copy link
Contributor

@blender can you share how you set up both build settings? Like: target value, project value and any xcconfig file that might be configured to either project or target build settings.

Alternatively, fastlane has some really good docs on how to get started with Ruby debugging: https://github.com/fastlane/fastlane/blob/master/ToolsAndDebugging.md#debug-using-pry

@tmspzz
Copy link

tmspzz commented Oct 26, 2017

We use fastlane's https://docs.fastlane.tools/actions/update_app_identifier/#update_app_identifier

In the project:

  • bundle identifier is a static string com.mycompany.realgreen not a variable ( when updating the identifier we change it to com.mycompany.realgreen.internal)
  • there is no extra xconfig
  • there are 5 targets (1 ios, 4 watchOS). iOS target is Real Green, watchOS targets are all named "Real Watch", "Real Watch (Complication)" and so on
  • project format is for some reason Xcode3.2 compatible (I'm getting suspicious here)

Relevant fastlane code:

update_app_identifier(
    plist_path: "Real Green/Info.plist", # Path to info plist file, relative to xcodeproj
    app_identifier: app_id # The App Identifier
  )

update_info_plist(
      plist_path: "Real Watch Extension/Info.plist",
      block: lambda { |plist|
        plist['NSExtension']['NSExtensionAttributes']['WKAppBundleIdentifier'] = parent_app_id
      }
    )

Edit: I see you are in Berlin. I can show you the problem in person.

@dthuering
Copy link
Author

We use a .xcconfig file to set PRODUCT_BUNDLE_IDENTIFIER.
This file is including then the .xcconfig file from CocoaPods.
Our project is quite old, so we have that XCode3.2 compatibility too. But changing it has no effect.

@UnsafePointer
Copy link
Contributor

@blender thanks a lot for the information!. I think I have an idea of what's the problem here. Nowadays CFBundleIdentifier is defined as $(PRODUCT_BUNDLE_IDENTIFIER) in the App's Info.plist and fastlane is querying for that, but some projects might still use the old style (setting the value directly in the Info.plist) and don't actually have a $(PRODUCT_BUNDLE_IDENTIFIER) build setting.

In any case, Xcodeproj shouldn't crash trying to resolve a build setting that isn't defined in the project.

I'll try to reproduce this today and create a branch you can try later.

@UnsafePointer
Copy link
Contributor

@blender didn't have luck so far. Any chance you can show me what do you get from:

cat path/to/project.xcodeproj/project.pbxproj | grep PRODUCT_BUNDLE_IDENTIFIER

@dthuering
Copy link
Author

PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER)";
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER)";
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.bakery2-tvOS";
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.bakery2-tvOS";
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.bakery2-tvOSTests";
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.bakery2-tvOSTests";

@tmspzz
Copy link

tmspzz commented Oct 26, 2017

cat Real\ Green.xcodeproj/project.pbxproj | grep PRODUCT_BUNDLE_IDENTIFIER


PRODUCT_BUNDLE_IDENTIFIER = com.mycompany.mysubcompany.realgreen;
PRODUCT_BUNDLE_IDENTIFIER = com.mycompany.mysubcompany.realgreen;
PRODUCT_BUNDLE_IDENTIFIER = "com.mycompany.Real-GreenTests";
PRODUCT_BUNDLE_IDENTIFIER = "com.mycompany.Real-GreenTests";
PRODUCT_BUNDLE_IDENTIFIER = "com.mycompany.Real-GreenUITests";
PRODUCT_BUNDLE_IDENTIFIER = "com.mycompany.Real-GreenUITests";
PRODUCT_BUNDLE_IDENTIFIER = com.mycompany.mysubcompany.realgreen.watchkitapp.watchkitextension;
PRODUCT_BUNDLE_IDENTIFIER = com.mycompany.mysubcompany.realgreen.watchkitapp.watchkitextension;
PRODUCT_BUNDLE_IDENTIFIER = com.mycompany.mysubcompany.realgreen.watchkitapp;
PRODUCT_BUNDLE_IDENTIFIER = com.mycompany.mysubcompany.realgreen.watchkitapp;

@UnsafePointer
Copy link
Contributor

@dthuering well that explains a lot. I didn't even know that was possible. I can reproduce the issue now I think.

@blender any chance you have something like @dthuering? Maybe before running update_app_identifier?

@dthuering
Copy link
Author

We have multiple .xcconfig files that set the PRODUCT_BUNDLE_IDENTIFIER and some other settings on compile time.

@tmspzz
Copy link

tmspzz commented Oct 26, 2017

@Ruenzuo that output is before I run fastlane :(

@UnsafePointer
Copy link
Contributor

@dthuering I don't understand what's the point of defining:

PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER)";

If you set PRODUCT_BUNDLE_IDENTIFIER in an xcconfig file you don't have to do that to get the value, or am I missing something obvious?

@dthuering
Copy link
Author

dthuering commented Oct 26, 2017

I see. I is overwritten by the xcconfig. When I set PRODUCT_BUNDLE_IDENTIFIER to a fixed value it works.
Thank you for your help!

@UnsafePointer
Copy link
Contributor

@dthuering Yeah, I usually leave it blank. Thank you for helping us figuring this out! Xcode works just fine with a set up like that and I guess other people also have a similar setup, so Xcodeproj should handle that.

@UnsafePointer
Copy link
Contributor

@tmspzz
Copy link

tmspzz commented Oct 30, 2017

@Ruenzuo Finished: SUCCESS 🎉

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

No branches or pull requests

5 participants