Cocos2d-x v4 cocoapod not working

Cocos2d-x v4 cocoapod not working
0

Getting this error ld: library not found for -lPods- clang: error: linker command failed with exit code 1 (use -v to see invocation)

I did just like what in this documentation says.

https://docs.cocos2d-x.org/cocos2d-x/v4/en/upgradeGuide/migration.html

Using latest cocoapod and cmake. Tried in 2 computers.

Please help. Anyone managed to successfully integrate cocoapod in V4?

1 Like

We can ask @zhangxm and @coulsonwang to have a look.

Can you describe the issue in more detail?

Hey @coulsonwang,

I followed all these following instructions.

  1. fetch and pull latest v4 branch.
  2. use cmake to generate project.
  3. open new generated project, Select your target in the TARGETS group, go to Build Settings tab
  • add $(inherited) to Other Linker Flags field in the Linking section if no exist.
  • add $(inherited) to Header Search Paths and Library Search Paths fields in the Search Paths if no exist.
  • Add $(inherited) to Preprocessor Macros filed in the Apple Clang - Preprocessing section if no exist.
  1. skip this if you have already install the [CocoaPods](https://docs.cocos2d-x.org/cocos2d-x/v4/en/upgradeGuide/https:/cocoapods.org.
  2. create a default Podfile
pod init
  1. manage your dependencies in the Podfile.
  2. install the pods.
pod install
  1. open the .xcworkspace and compile it, you will get the following error message, error: ../gamePods/Pods/Target Support Files/Pods-gamePods/Pods-gamePods.debug.xcconfig: unable to open file (in target "gamePods" in project "gamePods") (in target 'gamePods') To fix it, click Pods folder in your game project, and in the right panel you will see its location, click the folder icon, then select the correct path of Pods in the appeared window(Pods path is locate at the same directory as .xcworkspace ).
  2. Compile again, got the new error message, error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. To fix it, modify the .xcconfig file to move PODS_PODFILE_DIR_PATH and PODS_ROOT from last two lines to first two lines, and set the values to
PODS_PODFILE_DIR_PATH = ${SRCROOT}/"path_of_Pods"
PODS_ROOT = ${SRCROOT}/"path_of_Pods"/Pods

“path_of_Pods” specifies the path of your Pods folder. Generally it’s your build directory.

I was able to clear all those error listed. But after doing all these step, there is a new error.

Please test in your system if you can @coulsonwang. I tested in 2 mac system.

It seems that the library Pods-DiceCraft can’t be found, you can have a double check to make sure there is a Pods-DiceCraft.
We don’t use CocoaPods to manage the dependency. If you can provide the test demo, we can help to test.

@coulsonwang https://www.dropbox.com/s/dew8bu5yy5t1tge/Differences.zip?dl=0

Please check this demo project.

I had download the demo and will test it tomorrow.

1 Like

Here has a fix for this issue. And this PR offers a way to fix path issues with CMake generated projects.

@coulsonwang Thank you. this fix will work for debug/run. but not able to archive. Is there any chance you support old xcode project method(Non CMAKE). Also any plans to release new cocos 3.x version?

For V4, the answer is not.

@minggo will reply you the plans about release new cocos 3.x version

I tried to register ‘CocoaPod’ in the latest ‘HelloWorld’ but it failed.
Have you been successful?