Open kstenerud opened 2 years ago
Update: Android doesn't work either:
$ cocos run --proj-dir .. -p android
Building mode: debug
Using Android Studio project : /Users/karl/tmp/cocos-example/MyGame/..
gradle.properties not found!
I think we need to update the Readme.md.
Please use CMake now. https://docs.cocos2d-x.org/cocos2d-x/v4/en/installation/
The linked documentation has the same instructions:
"Once everything above works, you can start a new project! To do this, read our document on the Cocos Command-line tool."
On that page, the instructions are (for ios):
cocos new MyGame -p com.MyCompany.MyGame -l cpp -d ~/MyCompany
cocos compile -s ~/MyCompany/MyGame -p ios -m release -o ~/MyCompany/MyGame/bin
The cocos tool calls cmake
under the hood, but the compilation fails:
$ cocos compile -s ~/tmp/MyGame -p ios -m release -o ~/tmp/MyGame/bin
Building mode: release
running: 'cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator'
...
clang: error: no such file or directory: '/usr/lib/libz.dylib'
clang: error: no such file or directory: '/usr/lib/libiconv.dylib'
Command Ld failed with a nonzero exit code
Workarounds are given on SO: https://stackoverflow.com/questions/64842199/cocos2d-x-4-0-app-build-no-longer-works-after-upgrade-to-macos-big-sur-11-01-er
The 4.x cocos
tool as it stands now is producing a broken ios project.
If I open the project in xcode, it still fails in the linking phase, and also there's no way to select a real device (it only allows me to select the simulator). This used to work fine in 3.x (I just tested it).
I've tried this:
cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos
It runs successfully, but doesn't produce an apk.
karlmac:bin karl$ cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos
-- PROJECT_NAME:MyGame
-- PROJECT_SOURCE_DIR:/Users/karl/tmp/MyGame
-- COCOS2DX_ROOT_PATH:/Users/karl/tmp/MyGame/cocos2d
-- CMAKE_MODULE_PATH:/Users/karl/tmp/MyGame/cocos2d/cmake/Modules/
-- PROJECT_BINARY_DIR:/Users/karl/tmp/MyGame/bin
-- ENGINE_BINARY_PATH:/Users/karl/tmp/MyGame/bin/engine
-- PYTHON_PATH:/usr/bin/python2
-- COCOS_COMMAND_PATH:/Users/karl/Devel/cocos2d-x-current/tools/cocos2d-console/bin/cocos
-- HOST_SYSTEM:Darwin
-- CMAKE_GENERATOR: Xcode
-- COCOS2DX_LUAJIT_ROOT:/Users/karl/Devel/cocos2d-x-current/tools/cocos2d-console/bin/../plugins/plugin_luacompile/bin
-- cocos_mark_code_files: cocos2d
-- cocos_mark_code_files: MyGame
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/karl/tmp/MyGame/bin
I will suggest you to use cocos command to build the Xcode / Android project only, then build the app from Xcode / AS.
Hi, @kstenerud
I have just encountered the same problem recently.
It seems it's caused by a change of macOS (since BigSur), and you should modify the setting of "Other Linkers Flags" like this :
libz.dylib => -lz libiconv.dylib => -liconv
Hi, @kstenerud
I have just encountered the same problem recently.
It seems it's caused by a change of macOS (since BigSur), and you should modify the setting of "Other Linkers Flags" like this :
libz.dylib => -lz libiconv.dylib => -liconv
![]()
![]()
thanks. it's working
Steps to Reproduce:
In my case:
cocos run --proj-dir .. -p ios
Result: