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

Error: git submodule update --init #437

Open
ghost opened this issue Jul 29, 2014 · 4 comments
Open

Error: git submodule update --init #437

ghost opened this issue Jul 29, 2014 · 4 comments

Comments

@ghost
Copy link

ghost commented Jul 29, 2014

I cloned the source code and did as the doc says:

git submodule update --init
fatal: reference is not a tree: b51de15acb37d72719b03314771e4caa04e57a33
Unable to checkout 'b51de15acb37d72719b03314771e4caa04e57a33' in submodule path 'libs/cocos2d-iphone'

This error persists no matter how hard I try and whatever I try. Please fix it!

@patrickhoey
Copy link

This fatal: reference is not a tree: b51de15acb37d72719b03314771e4caa04e57a33 was quite annoying.

I have made some initial fixes that will at least get you past getting all the proper submodules:
3351040

There is a multi-step process in order to make this work (detached HEAD) with the latest for tag “release-1.1-RC0”

  1. Under the root directory of this repository, edit the “.gitmodules” with the following diffs:
diff --git a/.gitmodules b/.gitmodules
index 70efbcf..e61c729 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,12 +1,12 @@
 [submodule "CocosBuilder/libs/cocos2d-iphone"]
        path = CocosBuilder/libs/cocos2d-iphone
-       url = https://github.com/cocos2d/cocos2d-iphone.git
+       url = git://github.com/cocos2d/cocos2d-iphone-classic.git
 [submodule "CocosBuilder/libs/ssziparchive"]
        path = CocosBuilder/libs/ssziparchive
-       url = https://github.com/vlidholt/ssziparchive
+       url = git://github.com/vlidholt/ssziparchive
 [submodule "CocosBuilder/libs/Fragaria"]
        path = CocosBuilder/libs/Fragaria
-       url = https://github.com/vlidholt/Fragaria.git
+       url = git://github.com/vlidholt/Fragaria.git
 [submodule "Examples/CocosBuilderExample/libs/CCBReader"]
        path = Examples/CocosBuilderExample/libs/CCBReader
        url = git://github.com/cocos2d/CCBReader.git
  1. $ cd CocosBuilder/libs/cocos2d-iphone
  2. $ git checkout 9bd04c2286e32a8bc5ba90f85de1170b91d86d1f

@mattscott
Copy link

I have followed all these instructions, but when doing step 3 inside the cocos2d-iphone directory, I get:

$ git checkout 9bd04c2286e32a8bc5ba90f85de1170b91d86d1f
fatal: reference is not a tree: 9bd04c2286e32a8bc5ba90f85de1170b91d86d1f

$ git branch

  • v3.5.0

When I go look at the cocos2d-iphone-classic project, there is no branch v3.5.0.

@mattscott
Copy link

Okay just worked through this.

Make sure you pull branch v3.5.0.

Step 1: Follow patrickhoey's Step 1 and modify .gitmodules

Step 2: Make sure you're in the root directory of the CocosBuilder project and run:
git submodule update --init --recursive

This will error on cocos-iphone-classic.

Step 3: cd CocosBuilder/libs/cocos2d-iphone

Step 4: git checkout 5e8fdee5cdc4450ad32f5a8579ee6a0fdcbb1cfa

Step 5: Get a copy of this project in an entirely separate directory. There have been files removed at some point that need to be re-added.
https://github.com/cocos2d/cocos2d-iphone-classic

Step 6: Copy the following files from the cocos2d-iphone-classic project:
cocos-iphone-classic/cocos2d/ccFPSImages.m --> CocosBuilder/libs/cocos2d-iphone/cocos2d/ccFPSImages.m
cocos-iphone-classic/cocos2d/Support/uthash.h --> CocosBuilder/libs/cocos2d-iphone/cocos2d/Support/uthash.h
cocos-iphone-classic/cocos2d/Support/utlist.h --> CocosBuilder/libs/cocos2d-iphone/cocos2d/Support/utlist.h

This worked for me.

@skxatbj
Copy link

skxatbj commented May 22, 2018

I followed mattscott's step , but it still has some compiled errors, so I checked the source code and all compile steps, the main reason is cocos2d-iphone lib is changed, so we must find the right cocos2d-iphone lib!

Step1: Make sure you're in the root directory of the CocosBuilder project and run:
git submodule update --init --recursive

here will report error: fatal: reference is not a tree: b51de15acb37d72719b03314771e4caa04e57a33. it means can not find this commit. OK, we just jump this submodule(modify .gitmodules and .git/config, delete cocos2d-iphone submodule, may be you should use cmd: git rm --cached CocosBuilder/libs/cocos2d-iphone), and get other submodule cocosbuilder will used.

Step2: We get all submodule except cocos2d-iphone. We know cocos2d-iphone address is https://github.com/cocos2d/cocos2d-iphone.git, so run in CocosBuilder/libs dir:
git clone https://github.com/cocos2d/cocos2d-iphone.git

Step3: We must find the commit b51de15acb37d72719b03314771e4caa04e57a33, but it already not in commit(git checkout b51de15acb37d72719b03314771e4caa04e57a33 will not find this commit). But! run: git log | grep -A 10 -B 10 'b51de15acb37d72719b03314771e4caa04e57a33', I found one commit(611dd8f53ddc5be2fe7af963c0775e68597bb052) is map to this commit! In cocos2d-iphone dir, we checkout this commit

Step4: Compile source code, but it lack ccFPSImages.m uthash.h utlist.h file. So follow mattscott's Step6 to get these file.

Step5: All is compiled OK, but when I run the cocosbuilder which I compiled, it report error: cocos2d: ERROR: 0:11: '' : syntax error: #extension must always be before any non-preprocessor token ...
the solution is in stackoverflow:
https://stackoverflow.com/questions/30864055/coco2d-2-1-and-xcode-7-ios-9-crash-ccshader

OK, recompile and run, success!!

Thanks @mattscott

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

3 participants