oss-gate / workshop

OSSの開発に未参加または参加したことはあるけどまだ自信がない人を後押しするワークショップ用のリポジトリー
124 stars 547 forks source link

OSS Gate Workshop: Akatsuki: 2018-04-16: tomotaka-yamasaki: Cocos2d-x: Work log #808

Closed tomotaka-yamasaki closed 6 years ago

tomotaka-yamasaki commented 6 years ago

This is a work log of a "OSS Gate workshop". "OSS Gate workshop" is an activity to increase OSS developers. Here's been discussed in Japanese. Thanks.

作業ログ作成時の説明

以下のテンプレートを埋めてタイトルに設定します。埋め方例はスクロールすると見えてきます。

OSS Gate Workshop: ${LOCATION}: ${YEAR}-${MONTH}-${DAY}: ${アカウント名}: ${OSS名}: Work log

タイトル例↓:

OSS Gate Workshop: Tokyo: 2017-01-16: kou: Rabbit: Work log

OSS Gateワークショップ関連情報

nk16 commented 6 years ago

よろしくお願いします!

akihiro-nagai commented 6 years ago

💯

ghost commented 6 years ago

oh

tomotaka-yamasaki commented 6 years ago

cocos2d-xのgithubを見るぜ https://github.com/cocos2d/cocos2d-x

tomotaka-yamasaki commented 6 years ago

githubよりも公式ドキュメントのほうが良さそう。

tomotaka-yamasaki commented 6 years ago

cocos2d-xでググった https://www.google.co.jp/search?q=cocos2d-x&oq=cocos2d-x&aqs=chrome..69i57j69i60l3j69i65l2.5447j0j4&sourceid=chrome&ie=UTF-8

tomotaka-yamasaki commented 6 years ago

公式ドキュメントはこれだ http://www.cocos2d-x.org/

tomotaka-yamasaki commented 6 years ago

cocos2dクリエイターズについて書かれていた。 read moreを見ることにした http://discuss.cocos2d-x.org/t/cocos-creator-1-9-launches-facebook-instant-games-support-available-now/41862

tomotaka-yamasaki commented 6 years ago

read moreを読むと Cocos Creator 1.9 launches Facebook Instant Games support. と書かれていた。cocos creatorの1.9というバージョンでfacebookアプリが作れるようになったみたい。 みたいのはcocos2d-xのドキュメントです。

tomotaka-yamasaki commented 6 years ago

ドキュメンテーションを見た。 http://www.cocos2d-x.org/docs/creator/manual/en/

tomotaka-yamasaki commented 6 years ago

cocos2d-xには cocos2d-xとcocosとcocos creatorという3つのバージョンがあった。 サイトフッターから cocos2d-xのドキュメントに飛んだ。 http://www.cocos2d-x.org/products#cocos2d-x

tomotaka-yamasaki commented 6 years ago

cocos2dをdownloadしようと思ったら強制的にsign upを求められた。

tomotaka-yamasaki commented 6 years ago

sign upできた

tomotaka-yamasaki commented 6 years ago

downloadが終わった。zipを解凍した。

tomotaka-yamasaki commented 6 years ago

githubのプロジェクトのままっぽい

tomotaka-yamasaki commented 6 years ago

結局githubのreadmeを見る必要がありそう https://github.com/cocos2d/cocos2d-x

tomotaka-yamasaki commented 6 years ago

https://github.com/cocos2d/cocos2d-x#git-user-attention

tomotaka-yamasaki commented 6 years ago

python download-deps.py

The python version is 3.6. But python 2.x is required. (Version 2.7 is well tested) Download it here: https://www.python.org/

エラー

tomotaka-yamasaki commented 6 years ago

python 2系を入れる

tomotaka-yamasaki commented 6 years ago

pyenvでPython 2.7.10に切り替えた

tomotaka-yamasaki commented 6 years ago

download-deps.py 動いた。

tomotaka-yamasaki commented 6 years ago

https://github.com/cocos2d/cocos2d-x/blob/v3/download-deps.py で何をやっているかみた

tomotaka-yamasaki commented 6 years ago

$ git submodule update --init gitレポジトリじゃないから使えない

akihiro-nagai commented 6 years ago
akihiro.nagai@anmb% python download-deps.py
=======================================================
==> Prepare to download external libraries!
==> version file doesn't exist
==> Ready to download 'v3-deps-142.zip' from 'https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/archive/v3-deps-142.zip'
Traceback (most recent call last):
  File "download-deps.py", line 341, in <module>
    main()
  File "download-deps.py", line 336, in main
    installer.run(workpath, external_path, opts.remove_downloaded, opts.force_update, opts.download_only)
  File "download-deps.py", line 271, in run
    self.download_zip_file()
  File "download-deps.py", line 228, in download_zip_file
    self.download_file()
  File "download-deps.py", line 117, in download_file
    u = urllib2.urlopen(self._url)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
    context=self._context)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)>

MacOS (HighSierra) のpython(2.7.10)だとこんなエラーが出る。python 2.7.14 なら大丈夫

tomotaka-yamasaki commented 6 years ago

↑ 再現するのに時間がかかりそう。 自分の2.7.10では起こらなかった。多分3系とかが入っているから? どこかでインストールしてるから?

tomotaka-yamasaki commented 6 years ago

new game を作ってみる

tomotaka-yamasaki commented 6 years ago

setup.pyを実行

.bash_profileに

Add environment variable COCOS_X_ROOT for cocos2d-x

export COCOS_X_ROOT="/Users/tomotaka.yamasaki/Downloads/workspace" export PATH=$COCOS_X_ROOT:$PATH が書かれる。

tomotaka-yamasaki commented 6 years ago

$ cocos new OSSTest -p com.yamasaki.osstest -l cpp -d OSSTest

実行

tomotaka-yamasaki commented 6 years ago

Cocos collects data when the command-line tools are used for development. This data is examined in the aggregate only and is used to continually innovate and improve Cocos products. This data is anonymous and includes, but is not limited to, a unique hardware identifier, version number our software and information on which tools and/or services in Cocos products are being used and how they are being used. We take your privacy seriously and we do not share or sell any of this data. You can opt-out from sharing this data with us, but by sharing you help contribute to growth of Cocos.

Do you agree to sent the data? [Y]es, [N]o Y

tomotaka-yamasaki commented 6 years ago

cocos2d-x-3.16ディレクトリで実行したからディレクトリ配下にできてしまった。つらい。

tomotaka-yamasaki commented 6 years ago

$ cd cocos2d-x $ ./setup.py $ source FILE_TO_SAVE_SYSTEM_VARIABLE →→$ cocos new MyGame -p com.your_company.mygame -l cpp -d NEW_PROJECTS_DIR $ cd NEW_PROJECTS_DIR/MyGame

ドキュメントどおりにやったら必ずディレクトリがおかしくなる。

tomotaka-yamasaki commented 6 years ago

tomotaka.yamasaki:OSSTest$ cocos run -p ios Building mode: debug xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance Xcode is not installed.

tomotaka-yamasaki commented 6 years ago

上記エラー時にどうすればいいかわからない

tomotaka-yamasaki commented 6 years ago

Qiitaでググってみたがエラー https://qiita.com/teradonburi/items/5b214c74cddd776cb67f#xcode-select%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BCios

tomotaka-yamasaki commented 6 years ago

tomotaka.yamasaki:OSSTest$ xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" to install updates

tomotaka-yamasaki commented 6 years ago

AppstoreでXcodeをインストールしていないからそれが原因かもしれない。

tomotaka-yamasaki commented 6 years ago

https://www.google.co.jp/search?q=xcode-select+xcode+%E6%8C%87%E5%AE%9A&oq=xcode-select+xcode+%E6%8C%87%E5%AE%9A&aqs=chrome..69i57.9177j0j4&sourceid=chrome&ie=UTF-8

tomotaka-yamasaki commented 6 years ago

ビンゴ。 https://qiita.com/gooichi/items/017cf84ec52726ccd785

$ sudo xcode-select --switch /Applications/Xcode9_2_0.app

でxcode-selectで使うxcodeを指定すれば動いた。 Xcodeの知識がないと厳しい。

tomotaka-yamasaki commented 6 years ago

ビルド中。

Build succeed. Deploying mode: debug Starting application.

tomotaka-yamasaki commented 6 years ago

シミュレーターが起動したが、アプリは起動せず。 アプリをタップすると起動時に落ちる。

tomotaka-yamasaki commented 6 years ago

Xcode GUIでビルドして見てみる。

akihiro-nagai commented 6 years ago
ubuntu@ip-172-31-0-96% cocos run -p linux
Building mode: debug
running: 'cmake -DCMAKE_BUILD_TYPE=Debug -DDEBUG_MODE=ON ..'

/bin/sh: 1: cmake: not found
Error running command, return code: 127.
akihiro-nagai commented 6 years ago

cmake 必要って書いてあった

akihiro-nagai commented 6 years ago
-- glfw3 GLFW3_LIBRARIES: /home/ubuntu/src/cocos2d-x/mygame/MyGame/cocos2d/external/glfw3/prebuilt/linux/libglfw3.a
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find OpenGL (missing: OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.5/Modules/FindOpenGL.cmake:172 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  cocos2d/cmake/Modules/CocosBuildHelpers.cmake:351 (find_package)
  cocos2d/cmake/Modules/BuildModules.cmake:15 (cocos_find_package)
  cocos2d/cmake/Modules/CocosBuildSet.cmake:57 (BuildModules)
  CMakeLists.txt:37 (CocosBuildSet)

-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/src/cocos2d-x/mygame/MyGame/linux-build/CMakeFiles/CMakeOutput.log".
Error running command, return code: 1.

↓ sudo apt-get install libglfw3-dev libglfw3 ↓ Could NOT find GLEW ↓ sudo apt-get install libglew-dev libcurl4-openssl-dev

running: '/home/ubuntu/src/cocos2d-x/mygame/MyGame/bin/debug/linux/TemplateCpp'

/bin/sh: 1: /home/ubuntu/src/cocos2d-x/mygame/MyGame/bin/debug/linux/TemplateCpp: not found
Error running command, return code: 127.
tomotaka-yamasaki commented 6 years ago

シミュレーターが起動したが、アプリは起動せず。 アプリをタップすると起動時に落ちる。

CoreData: annotation:  Failed to load optimized model at path '/Applications/Xcode9_2_0.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo'
Instruments Usage Error: No template (-t) specified
instruments, version 9.2 (63753)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]]
running: 'xcrun simctl install "3EAD6326-3790-47CE-BACB-4ADA1CE7B4F5" "/Users/tomotaka.yamasaki/Downloads/workspace/OSSTest/bin/debug/ios/OSSTest-mobile.app"'
tomotaka-yamasaki commented 6 years ago

Xcode GUIでsimulator起動すると問題ない。 iphone6でも8でも動作する。 CUIではiPhone8 plusで起動しているが、アプリ起動直後クラッシュ。

Build succeed.
Deploying mode: debug
Starting application.
CoreData: annotation:  Failed to load optimized model at path '/Applications/Xcode9_2_0.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo'
Using simulator: iPhone 8 Plus (11.2)
running: 'xcrun instruments -w "3EAD6326-3790-47CE-BACB-4ADA1CE7B4F5"'

CoreData: annotation:  Failed to load optimized model at path '/Applications/Xcode9_2_0.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo'
instruments[43489]: Waiting for device to boot...
Instruments Usage Error: No template (-t) specified
instruments, version 9.2 (63753)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]]
running: 'xcrun simctl install "3EAD6326-3790-47CE-BACB-4ADA1CE7B4F5" "/Users/tomotaka.yamasaki/Downloads/workspace/OSSTest/bin/debug/ios/OSSTest-mobile.app"'

running: 'xcrun simctl launch "3EAD6326-3790-47CE-BACB-4ADA1CE7B4F5" "com.yamasaki.osstest"'

com.yamasaki.osstest: 43733
tomotaka-yamasaki commented 6 years ago

xcrun instrumentsコマンドが使えていないみたい。

tomotaka-yamasaki commented 6 years ago

xcrun instruments エラーでググる。 https://www.google.co.jp/search?q=xcrun+instruments+%E3%82%A8%E3%83%A9%E3%83%BC&oq=xcrun+instruments+%E3%82%A8%E3%83%A9%E3%83%BC&aqs=chrome..69i57.5712j0j7&sourceid=chrome&ie=UTF-8

tomotaka-yamasaki commented 6 years ago

特に有益な情報はなかった

tomotaka-yamasaki commented 6 years ago

xcrun instruments で起動しているdevice idが悪い? https://github.com/phonegap/ios-sim/issues/209