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

Can't set Pods project SDK_ROOT with post_install #3432

Closed
kevinkirkup opened this issue Apr 19, 2015 · 4 comments
Closed

Can't set Pods project SDK_ROOT with post_install #3432

kevinkirkup opened this issue Apr 19, 2015 · 4 comments
Labels
t3:discussion These are issues that can be non-issues, and encompass best practices, or plans for the future.

Comments

@kevinkirkup
Copy link

I'm having an issue setting the SDKROOT (BaseSDK) in the top level Pods Project configuration.
I've tried using a post_install script and this seems to work for the SDKROOT of each of the targets but not the project level setting.

In Xcode, the Base SDK is listed as No SDK (Latest OS X) but I'm build for iOS and this causes the build to fail with this warning:

Pods was rejected as an implicit dependency for 'libPods.a' because its architectures
'arm64' didn't contain all required architectures 'armv7 arm64'

which leads to this error:

ld: library not found for -lPods-CocoaLumberjack

Here is the podfile that I'm using:

platform :ios, '8.3'

pod 'CocoaLumberjack', '~> 1.8'
pod 'TRSDialScrollView', '>= 1.0'

# Only add Kiwi to Unit Test projects
target :UnderPressureTests, :exclusive => true do
  pod 'Specta', '~> 0.5'
  pod 'Expecta', '~> 0.4'
  pod 'OCMock', '~> 3.1.2'
end

post_install do |installer|
  installer.project.targets.each do |target|
    p target.name
    target.build_configurations.each do |config|
      config.build_settings['SDKROOT'] = 'iphoneos'
    end
  end
end

I've compared the Pods/Pods.xcodeproj/project.pbxproj before and after the change and it looks like SDKROOT is not present for the Project target listed in the project.pbxproj file before I manually change it in Xcode.

Any ideas?

@kevinkirkup
Copy link
Author

Update
I was able to use the latest version of xcodeproj to modify the project file and include the base SDK.

require 'xcodeproj'

project = Xcodeproj::Project.open("MyProject.xcodeproj")
project.build_configurations.each { |c| c.build_settings['SDKROOT'] = 'iphoneos' }
project.save

So this looks like I'm trying to modify the wrong build_configurations in the post_install.
Still not sure why the Base SDK is not being set by default.

@kylef kylef added the t3:discussion These are issues that can be non-issues, and encompass best practices, or plans for the future. label May 7, 2015
@fatuhoku
Copy link

fatuhoku commented Aug 4, 2015

+1 This hasn't really worked for me. What's the best way to edit the Pod.xcodeproj?

@segiddins
Copy link
Member

The best way to edit Pods.xcodeproj is using the Podfile post-install hook.

@kevinkirkup you never shared a project that exhibits this issue, and given I've never encountered it myself, I'm going to have to close the issue for now. If it persists, however, I'll re-open.

@revolter
Copy link
Contributor

In Xcode 14, this Pods project warning started showing up:

**Project 'Pods' - Enable Dead Code Stripping
Enabling dead code stripping is recommended. This will update the DEAD_CODE_STRIPPING setting.

We wanted to get rid of this warning, and noticed that DEAD_CODE_STRIPPING is YES by default on iOS, but NO on macOS.

So we successfully used this workaround in `Podfile:

post_install do |installer|
    installer.pods_project.build_configurations.each do |build_configuration|
        build_configuration.build_settings['SDKROOT'] = 'iphoneos'
    end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t3:discussion These are issues that can be non-issues, and encompass best practices, or plans for the future.
Projects
None yet
Development

No branches or pull requests

5 participants