Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Custom build configurations in parent project #121

Closed
maikg opened this Issue · 20 comments

9 participants

Maik Gosenshuis Eloy Durán webdevotion Ben Scheirman Nick Peelman Francis Chong Ernest Surudo Fabio Pelosin Jason Silberman
Maik Gosenshuis

I get an error when trying to build my application with custom build configurations.

ld: library not found for -lPods

As noted here, this can be fixed by also adding custom build configurations with the same names to the Pods project, but these changes get overwritten whenever I run pod install.

I noticed in that the Debug and Release build configurations are explicitly created for the Pods project. Would it be possible to also create any custom build configurations that are defined in the parent project during this step? Or as an alternative, define them in the Podfile?

I'd give this a go myself but I could really use some input.

Eloy Durán
Owner

Good point. The problem is that, currently, we don’t do anything with the app project, except when asked to setup with pod install MyApp.xcodeproj. But that should change, also because of ticket #76.

If you want to start work on that, then please do go ahead :)

As an immediate workaround, you can add the configuration in a post_install hook in your Podfile with code similar to what you linked to.

Eloy Durán
Owner

FYI, I’m currently using the workaround on a project:

post_install do |installer|
  settings = Xcodeproj::Project.send(:build_settings, Pod::Platform.new(:ios), :debug)
  configs  = installer.project.build_configurations
  configs.new('name' => 'Spec', 'buildSettings' => settings.merge('CONFIGURATION_BUILD_DIR' => '$(BUILD_DIR)/Debug$(EFFECTIVE_PLATFORM_NAME)'))
end
Eloy Durán
Owner

Actually, that’s not complete, I’ll have to update that tomorrow.

Maik Gosenshuis

Any update on the complete workaround?

webdevotion

@alloy please add the complete workaround, same problem here.
Thanks!

Eloy Durán
Owner

Sorry guys, I’m currently sick and not able to think clear. If you want to look into this, then please check the exact diffs before adding the config by hand and afterwards, then use the above as a starting point.

Eloy Durán
Owner

@maikg Did you get a chance to look into this?

Ben Scheirman

I got around this in my app by adding this build setting to my App Store configuration's Library Search Path setting:

$(BUILT_PRODUCTS_DIR)/../Release-iphoneos
Maik Gosenshuis

@alloy Sorry for responding to this so late. I haven't got around to this yet. I think I prefer a shortcut that allows me to overwrite the default build configuration list in my Podfile, since parsing the parent xcodeproj would involve extending the Xcodeproj project extensively (if I'm not mistaken).

Would that solution work for you?

Eloy Durán
Owner

@maikg The majority of the code needed to add the necessary configurations present in the user project is already in the multiple-platforms branch, but it’s currently still a bit rough, so let’s wait a bit more until I’m done with the current work.

Eloy Durán alloy was assigned
Nick Peelman

Is there any thoughts on the workaround, since it looks like it might be a while before we see the ability to set this in the podfile?

I just spent the afternoon twiddling with this:

post_install do |installer|
  settings = Xcodeproj::Project.send(:build_settings, Pod::Platform.new(:ios), :debug)
  configs  = installer.project.build_configurations
  configs.new('name' => 'Spec', 'buildSettings' => settings.merge('CONFIGURATION_BUILD_DIR' => '$(BUILD_DIR)/Debug$(EFFECTIVE_PLATFORM_NAME)'))
end

to no avail. I could sometimes get a Staging configuration to show up, but it wouldn't be properly duplicated from the Debug configuration, as it gets when you do it manually in Xcode. I had all manner of scariness implemented over the course of the afternoon with little in the way of success. Curious if anybody else has any luck with it, or if @alloy was willing to throw me a bone :)

Francis Chong

@peelman adding a library search path work for me

Nick Peelman

Thanks, but that won't work for us. We want to be able to do automated builds; having to manually intervene with Xcode after running pod install kind of ruins that play.

Francis Chong

@peelman you just have to add the library search path to your custom configuration once, later run of pod install should still be okay.

Eloy Durán
Owner

@peelman See #215 for an example of what @siuying means.

Nick Peelman

Doh, yeah I misread / misinterpreted that when i first read it. I just did some testing and it appears that works for us. Looking forward to being able to define configurations, but this appears to be a solid work around for the time being.

Eloy Durán
Owner

Closed by 81d3550.

Eloy Durán alloy closed this
Ernest Surudo

Sorry to bring this up so late, but what can I do to an existing project with this problem? I upgraded to the newest version of cocoapods.... now what?

Fabio Pelosin
Owner

@elsurudo This xcodeproj del directive of the Podfile should get you on the right track.

Please use the mailing list to ask questions about CP usage. The issues are reserved for features and bugs.

Jason Silberman

Any word on this?

Samuel E. Giddins segiddins locked and limited conversation to collaborators
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Something went wrong with that request. Please try again.