-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
(cocoapods 1.1.1) pod install on a project generated by cmake results in broken xcconfig file references #6268
Comments
I realize that this happens due to xcconfigs are referenced at $SRCROOT/Pods/... dir, but $SRCROOT is set to HelloCocoaPods path whereas the Pods dir is in the bin directory. |
Have the same issue. Currently cocoapods is completely unusable with projects being generated by cmake. |
@GoatHunter a PR to fix would be much appreciated! I don't use cmake, so it'd also be helpful if someone with more experience could do some analysis and determine where the bug is, if a PR is too big of an ask. |
@benasher44 Hey, can't commit to a PR atm :-/, but maybe sometime in the near future. Regarding the analysis, the python script I wrote (attached to the reproduction example project) works around a bug that prevents Cocoapods from running on cmake generated project, so it can be traced back and fixed. The bug which described in easier to understand using an example:
I cd to bin, then run cmake and it generates in bin/HelloCocoaPods.xcodeproj, this causes One potential fix might be is to tell the In any case, @benasher44, considering my analysis do you think the suggested fixes above are valid or too much of a hack? |
We already have |
--project-directory doesn't help at all for me. |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍 |
Still an issue. |
I am having that issue right now with latest cocoapods.. can't get cocoapods to work at all with my cmake generated projects. |
This code fixes path issues with cmake generated projects. /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.7.0/lib/xcodeproj/project/object/helpers/groupable_helper.rb:140 def source_tree_real_path(object)
case object.source_tree
when '<group>'
if parent(object).isa == 'PBXProject'
object.project.project_dir + object.project.root_object.project_dir_path
else
real_path(parent(object))
end
when 'SOURCE_ROOT'
object.project.project_dir + object.project.root_object.project_dir_path
when '<absolute>'
nil
else
Pathname.new("${#{object.source_tree}}")
end
end /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.2/lib/cocoapods/installer/analyzer/target_inspection_result.rb:46 def initialize(target_definition, project, project_target_uuids, build_configurations, platform, archs)
@target_definition = target_definition
@project = project
@project_target_uuids = project_target_uuids
@build_configurations = build_configurations
@platform = platform
@archs = archs
@client_root = Pathname.new(project.project_dir + project.root_object.project_dir_path).realpath
end |
I can confirm that patch actually works! The only remaining problem compiling HelloCocoaPods is that the project is unable to link: ld: library not found for -lPods-HelloCocoaPods But it links successfully after copying the lib manually by the command below: cp build/Debug/libPods-HelloCocoaPods.a Debug/ |
This could help you to control xcode output location:
|
@Extrunder @KonStg would anyone like to make a PR? |
@KonStg Thanks for the tip! I have successfully compiled the app using the command below: xcodebuild -workspace HelloCocoaPods.xcworkspace -scheme ALL_BUILD BUILD_DIR=${PWD} -configuration Debug But there is still an error when compiling the app directly from Xcode. |
@dnkoutso, made two PRs based on @Extrunder fixes. |
@mad-rain cool! please add tests for both PRs. |
Its still unclear how to build a project without specifying BUILD_DIR in command line. Explicit BUILD_DIR breaks CMake paths for depend static libs. But without BUILD_DIR we're getting errors line this: Any ideas? |
Report
What did you do?
Run the following commands on the attached project:
What did you expect to happen?
xcconfig references are valid and project compiles successfully.
What happened instead?
Compilation error:
diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
CocoaPods Environment
Stack
Installation Source
Plugins
Podfile
Project that demonstrates the issue
[CocoapodsCMakeBugReproductionProject.zip]
(https://github.com/CocoaPods/CocoaPods/files/629579/CocoapodsCMakeBugReproductionProject.zip)
The text was updated successfully, but these errors were encountered: