I got the build successful with cocos2d-x v2.2.2. Then I follow this tutorial to build cocos2d-x v3.0 beta 2 project
The command project-creator worked fine and I can create all supported platform projects.
Everything is ok except I have an error with build_native.py script:
line 25
print "Can't know cpuinfo, use default 1 cpu"
^
SyntaxError: invalid syntax
As I don't have any experiment with python, so I have no idea with this bug.
Here is my environment detail:
Latest python for windows 3.3.4
Windows 8, 64 bit
Latest android sdk r22.3, ndk r9c
Already set these environment variables: ANDROID_SDK_ROOT, NDK_ROOT, ANDROID_SDK_ROOT/platform_tools, ANDROID_SDK_ROOT/tools
For the variable NDK_MODULE_PATH, I can't find folder likeplatform\third_party\android\prebuilt in cocos2d-x v3.0, so I don't know what to do with it
Do I miss something?
Update: after searching on google, I found that on python 3, print should be use as method, like print(""), then I replace all tabs by spaces to avoid inconsistent use of tabs and spaces in indentation error. But I still got another exception:
The Selected NDK toolchain version was 4.8 !
make.exe: *** D:\SycnDir\game: No such file or directory. Stop.
Traceback (most recent call last):
File "D:\My Games\proj.android\build_native.py", line 166, in <module>
build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
File "D:\My Games\proj.android\build_native.py", line 153, in build
do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
File "D:\My Games\proj.android\build_native.py", line 89, in do_build
raise Exception("Build dynamic library for project [ " + app_android_root +
" ] fails!")
Exception: Build dynamic library for project [ D:\My Games\proj.android ] fails!
Finally I can make it worked. The exception is raised on these lines:
if os.system(command) != 0
raise Exception(“Build dynamic library for project [ " + app_android_root + " ] fails!”)
And I figure out space characters on my folder path caused ndk build failed. I can't believe this stupid bug make me waste two days. Now I just move my project into a folder without space and it worked like a charm.
The cocos2d-x 3.0 beta only works with Python 2.7 at this point. I suggest going back to Python 2.7 instead of trying to debug the script for Python 3.0.
Related
I'm trying to explore the tensorflow android demo. I want to adapt the app using android studio.
However when I simply follow the instructions I get compilation errors no matter what I do:
Trying to compile tensorflow using bazel and NDK r12b:
$bazel build -c opt //tensorflow/examples/android:tensorflow_demo
ERROR: /home/myUser/libs/tensorflow_android/WORKSPACE:3:1: //external:io_bazel_rules_closure: no such attribute 'urls' in 'http_archive' rule.
ERROR: /home/myUser/libs/tensorflow_android/WORKSPACE:3:1: //external:io_bazel_rules_closure: missing value for mandatory attribute 'url' in 'http_archive' rule.
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '#io_bazel_rules_closure//closure': error loading package 'external': Could not load //external package.
INFO: Elapsed time: 0.129s
Trying to compile a newer version of bazel following this advice:
$bazel version
Build label: 0.2.3-jdk7 // This is my current version of bazel
via apt-get:
$sudo apt-get upgrade bazel
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
E: Unable to locate package bazel
from source (tried bazel-0.4.2 and bazel-0.5.0):
$./compile.sh
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO: ./compile.sh compile /path/to/bazel
🍃 Building Bazel from scratch
ERROR: JDK version (1.7) is lower than 1.8, please set $JAVA_HOME.
or
$bazel build //src:bazel
ERROR: /home/myUser/libs/bazel/bazel-0.4.2/tools/build_rules/genproto.bzl:45:16: Traceback (most recent call last):
File "/home/myUser/libs/bazel/bazel-0.4.2/tools/build_rules/genproto.bzl", line 42
rule(gensrcjar_impl, attrs = {"src": at..."), <2 more arguments>), "_proto_compiler": attr.label(default = Label("//third_party/p..."), <4 more arguments>), "_jar": attr.label(default = Label("#bazel_tools//t..."), <4 more arguments>), "_jdk": attr.label(default = Label("#bazel_tools//t..."), ...)}, ..."})
File "/home/myUser/libs/bazel/bazel-0.4.2/tools/build_rules/genproto.bzl", line 45, in rule
attr.label(allow_files = proto_filetype, sing...)
allow_files should be a boolean or a filetype object.
ERROR: /home/myUser/libs/bazel/bazel-0.4.2/src/BUILD:130:1: error loading package 'src/main/protobuf': Extension file 'tools/build_rules/genproto.bzl' has errors and referenced by '//src:embedded_tools'.
ERROR: Loading failed; build aborted.
INFO: Elapsed time: 0.251s
switching aroung java-versions to see whether the bazel compiling issues come from there:
$sudo update-alternatives --config java
There are 4 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1074 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
* 2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1072 manual mode
3 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1069 manual mode
4 /usr/lib/jvm/java-8-oracle/jre/bin/java 1074 manual mode
No luck so far :-/. Has anyone successfully compiled tensorflow for android from source?
What version of Tensorflow, NDK, bazel, java are required / compatible with each other? Do I really need bazel? (never worked with it anyway) Can't I just compile the android demo in android-studio like any other app?
I'm using Ubuntu 14.04, Cuda8.0, cudnn_v5.1, Titan X Pascal (not sure if these things matter)
Installing Bazel on Ubuntu can be done without compiling.
Follow all steps of the dedicated documentation: Install Bazel on Ubuntu
I wanted to build the JXcore libraries for android, and i have encountered an error.
I have met all the Prerequisites:
I'm running ubuntu 16.04, with gcc 5.4.0, python 2.7.12,GNU Make 4.1.
This are the steps i have followed:
I have downloaded android ndk, and extracted it in ~/Downloads/android-ndk-r12b
cloned the jxcore library in ~/Downloads/jxcore
cd into jxcore
ran build_scripts/android-configure.sh ../android-ndk-r12b/, this script finished successfully
Then i needed to run build_scripts/android_compile.sh ../android-ndk-r12b/ --embed-leveldown
And i hit an error in the last step, this is the log:
Compiling Android ARM7
Traceback (most recent call last):
File "./configure", line 1119, in <module>
configure_node(output)
File "./configure", line 645, in configure_node
configure_arm(o)
File "./configure", line 569, in configure_arm
elif is_arm_hard_float_abi():
File "./configure", line 491, in is_arm_hard_float_abi
if compiler_version() >= (4, 6, 0):
File "./configure", line 560, in compiler_version
version = tuple(map(int, proc.communicate()[0].split('.')))
ValueError: invalid literal for int() with base 10: 'x\n'
compilation aborted for arm target
Does anyone know what causes this, or a fix for it ?
I ran into the same problem. I did a quick and dirty fix just to get going.
Open the "configure" file in your jxcore folder. Go to line number 560 as in the last entry in your log. Comment out line 560 with the # in front.
Insert a changed version of that line underneath as shown below:
line 560: #version = tuple(map(int, proc.communicate()[0].split('.')))
line 561: version = tuple(map(int, "4.9.0".split('.')))
... basically what happens is that your version of CC goes something like "4.9.x" and as Python fails to convert the "x" to an integer the process stops. I just replaced the "x" with a "0". However you might want to check your version just to be safe. Therefore place print proc.communicate()[0] right before line 560 before you make the other changes. Then your actual version number will be printed out in your log, when you run the program again.
I hope that may help you.
I'm trying to get the tensorflow Android example running but I keep running into this issue:
ERROR: /home/administrator/TensorFlow_Git/tensorflow/examples/android/BUILD:41:1: output 'tensorflow/examples/android/libpthread.so' was not created.
ERROR: /home/administrator/TensorFlow_Git/tensorflow/examples/android/BUILD:41:1: not all outputs were created.
Version Details:
OS: Ubuntu 14.04LTS;
bazel version 0.2.1;
tensorflow version: tensorflow-0.7.1-cp34-none-linux_x86_64.whl
Excerpt of WORKSPACE file:
android_sdk_repository(
name = "androidsdk",
api_level = 23,
build_tools_version = "23.0.3", #also wget'ed 23.0.1, same result
path = "/home/administrator/Android/Sdk",)
android_ndk_repository(
name="androidndk",
path="/home/administrator/Downloads/android-ndk-r10e", #also tried android-ndk-r11c but README not found error
api_level=21)
I can successfully compile and deploy android apps via android studio.
If I comment out the part in the BUILD file and copy the libpthread.so file from the internet to the target location the error changes to the following:
ERROR:
/home/administrator/TensorFlow/tensorflow/tensorflow/examples/android/BUILD:12:1:
output 'tensorflow/examples/android/libtensorflow_demo.so' was not
created.
ERROR: /home/administrator/TensorFlow/tensorflow/tensorflow/examples/android/BUILD:12:1:
not all outputs were created.
Not sure if this is a bug but I guess not.
I have no idea what and where something went wrong but there were broken link files pointing to a non existing directory with libtensorflow_demo.so.
The solution for me was to start all over with a fresh VM with enough diskspace (20GB is clearly not enough), enough memory (default is pretty low) and all cores assigned (default is 1) with the current Ubuntu 16.04 LTS and Android Studio. Also tensorflow v8.0 which came out meanwhile seems to be a bit less troublesome.
I had an issue with the VM where I had 0byte left and had blackscreen before login. I fixed that but it was during an installation and maybe it was the installation of bazel that messed up something. I can't tell.
I am trying to build project of cocos2dx in my eclipse.whenever I am try to run ./create-android-project.sh command on my terminal its gives me an error saying :-
Now cocos2d-x supports Android 2.2 or upper version
./create-android-project.sh: line 103: /home/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/sdk/tools/android: No such file or directory
input target id:
I have made every change as per suggested in this tutorial :- http://www.raywenderlich.com/33750/cocos2d-x-tutorial-for-ios-and-android-getting-started
I have changed the following lines :-
# set environment paramters
NDK_ROOT_LOCAL="/home/laschweinski/android/android-ndk-r8d"
ANDROID_SDK_ROOT_LOCAL="/home/laschweinski/android/android-sdk-linux_86"
to
NDK_ROOT_LOCAL="/home/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/android-ndk-r10d"
ANDROID_SDK_ROOT_LOCAL="/home/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/sdk"
in create-android-project.sh shell script.
have also provided path of my NDK in build_native.sh.
Can anyone tell me that where I am lacking in building this project. Any help will be appreciated. I am working on Ubuntu.
Thanks.
Can't build streamer tutorial_3 for android on mac
I,ve got all environment variables needed.
My eclipse can't to resolve some symbols, but to some of them i can get by pushing F3. It's very strange for me.
Here is the command line output:
23:04:06 **** Build of configuration Default for project Tutorial3 ****
/Users/antonivanuskin/android-develop/android-ndk-r10/ndk-build all
GStreamer : [GEN] => gst-build-armeabi/gstreamer_android.c
GStreamer : [COMPILE] => gst-build-armeabi/gstreamer_android.c
GStreamer : [LINK] => gst-build-armeabi/libgstreamer_android.so
lto1: fatal error: bytecode stream generated with LTO version 2.2 instead of the expected 3.0
compilation terminated.
lto-wrapper: /Users/antonivanuskin/android-develop/android-ndk-r10/toolchains/arm- linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc returned 1 exit status
/Users/antonivanuskin/android-develop/android-ndk-r10/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.gold: fatal error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [buildsharedlibrary_armeabi] Error 1
23:04:10 Build Finished (took 3s.740ms)*
I use ndk-10r and gst-1.4.0.
I know that there is no interfaces/xoverlay in new streamer.
EDIT
I've built ok, but steel got underlines of many glib-types and GST-macross. Here is a screenshot:
what is interesting that i have no underlined headers, for example: i've include pthread.h but have got underlined pthread_t and phtread_key_t....
i think that i have not install some general libraries on my mac, something like libc or what ever...may it couse this problem? The problem is that i can't run my app from eclipse. and for more: i use DS-5 CE IDE
This is most likely because we build the android 1.4.x cerbero packages with the r9d NDK.
You might want to use the r9d NDK until we provide binaries built with a more recent NDK (started some builds to see if everything goes through fine).