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

Not able to build for android #71

Closed
arsfeld opened this issue Jul 29, 2013 · 11 comments
Closed

Not able to build for android #71

arsfeld opened this issue Jul 29, 2013 · 11 comments

Comments

@arsfeld
Copy link

arsfeld commented Jul 29, 2013

I'm trying to build an Openfl project in Fedora 19, with Haxe 3 and Neko 2. I'm getting this:

sh: arm-linux-androideabi-g++: command not found

And my ~/.hxcpp_config.xml

<xml>
    <section id="vars">

        <set name="ANDROID_SDK" value="/opt/android-sdk" />
        <set name="ANDROID_SETUP" value="true" />
        <set name="ANDROID_NDK_ROOT" value="/opt/android-ndk" />
        <set name="ANT_HOME" value="/usr/bin" />
        <set name="JAVA_HOME" value="/usr/lib/jvm/java-1.7.0-openjdk.x86_64" />
    </section>
</xml>

It works for Linux/C++ tough. Any ideas?

Here is the full log:

[arosenfeld@alexandre-pc ludo haxe]$ openfl test -debug android
haxelib run hxcpp Build.xml haxe -Ddebug -Dactuate="1" -Dandroid="1" -Dformat="1" -Dhaxe3="1" -DhaxeJSON="1" -Dhaxe_release="1" -Dhaxe_ver="3." -Dhscript="1" -Dmobile="1" -Dnme="1" -Dnme_install_tool="1" -Dopenfl="1" -Dopenfl-compatibility="1" -Dopenfl-native="1" -Dopenfl_compatibility="1" -Dopenfl_native="1" -Dopenfl_ver="1.0.6" -Dpolygonal-ds="1" -Dpolygonal-printf="1" -Dpolygonal_ds="1" -Dpolygonal_printf="1" -Dsqlite="1" -Dstablexui="1" -Dsvg="1" -Dtools="1"
Creating obj/android-debug/__pch/haxe/hxcpp.h.gch...
arm-linux-androideabi-g++ -Iinclude --sysroot=/opt/android-ndk/platforms/android-5/arch-arm -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include -DHXCPP_DEBUG -DHXCPP_VISIT_ALLOCS -I/usr/share/haxe/lib/hxcpp/3,0,2//include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -D_LINUX_STDDEF_H  -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fomit-frame-pointer -fexceptions -fno-strict-aliasing -finline-limit=10000 -DANDROID -Wa,--noexecstack -O0 -DNDEBUG -c -frtti -o obj/android-debug/__pch/haxe/hxcpp.h.gch /usr/share/haxe/lib/hxcpp/3,0,2//include/hxcpp.h
sh: arm-linux-androideabi-g++: command not found
Called from ? line 1
Called from BuildTool.hx line 1529
Called from BuildTool.hx line 673
Called from a C function
Called from BuildTool.hx line 708
Called from BuildTool.hx line 842
Called from BuildTool.hx line 885
Called from BuildTool.hx line 194
Uncaught exception - Error creating pch: 127 - build cancelled
Error: Build failed
@sergey-miryanov
Copy link

Did you setup openfl android environment? openfl setup android?

@louisbl
Copy link

louisbl commented Jul 30, 2013

What OS (32/64b) and what version of the Android NDK are you using ?
The toolchains path have changed from the 8e version as it now support 64bit version. You should change the "android-toolchain.xml" file if you have android ndk 8e or 9:

/usr/share/haxe/lib/hxcpp/3,0,2/build-tool/android-toolchain.xml

to reflect this changes by appending "-x86_64" to the host folder:

30: <path name="${ANDROID_NDK_ROOT}/toolchains/arm-linux-androideabi-${TOOLCHAIN_VERSION}/prebuilt/${ANDROID_HOST}/bin"/>
30: <path name="${ANDROID_NDK_ROOT}/toolchains/arm-linux-androideabi-${TOOLCHAIN_VERSION}/prebuilt/${ANDROID_HOST}-x86_64/bin"/>

@Henry-T
Copy link

Henry-T commented Aug 4, 2013

NDK 8e get installed on openfl setup. You can make a clean install with that command, most people won't get bothered by errors this way.
http://haxeflixel.com/forum/help/what-do-these-build-errors-mean

@arsfeld
Copy link
Author

arsfeld commented Aug 5, 2013

I was getting in trouble because I was downloading the NDK manually. By the way, the lack of support for x64 is a much bigger pain in Fedora, since I couldn't find a way to install all 32-bit libraries like I would in Ubuntu (and error messages were quite cryptic).
Now I'm back to building and testing in a Fedora machine, thanks!

@arsfeld arsfeld closed this as completed Aug 5, 2013
@arsfeld
Copy link
Author

arsfeld commented Aug 5, 2013

By the way, for reference, to properly build and test Android targets with openfl and Fedora, I had to:

  • Use Android NDK r8e (and just like @Henry-T said, it's included in openfl setup)
  • Download JDK from Oracle's website also with openfl setup, since the OpenJDK from yum did not work (many websites also suggest this, otherwise you get Error: Could not find or load main class org.apache.tools.ant.launch.Launcher)
  • Install glibc.i686 libzip.i686 libstdc++.i686 ncurses-libs.i686

@drkibitz
Copy link

drkibitz commented Aug 5, 2013

@arsfeld I have x64 installed on fedora 19.

@drkibitz
Copy link

drkibitz commented Aug 5, 2013

@arsfeld you may have been able to find a thread/issue about it, as I described how I got it working, but unfortunately its in a repo that suddenly disappeared last weekend, openfl-tools.

@arsfeld
Copy link
Author

arsfeld commented Aug 5, 2013

@drkibitz what a waste of time we both trying to solve these issues independently. I did a search about openfl and Fedora but found nothing.
Did you do anything special that I didn't?

@drkibitz
Copy link

drkibitz commented Aug 6, 2013

@arsfeld I don't know if I did anything special, but here's what I did.
I used the prebuilt x64 binaries for Neko 2.0 and Haxe 3.0 here:

I dropped them into their respective directories here:

  • /usr/local/lib64/neko
  • /usr/local/lib64/haxe

Then I created a file /etc/profile.d/haxe.sh with contents:

export NEKOPATH="/usr/local/lib64/neko"
export HAXEPATH="/usr/local/lib64/haxe"
export HAXE_STD_PATH="/usr/local/lib64/haxe/std:."

And of course made sure my current session had those same vars defined.

Then I created the file /etc/ld.so.conf.d/neko.conf with contents:

/usr/local/lib64/neko

Then ran ldconfig make the changes take effect.

Then I manually created symlinks here /usr/local/bin:

  • haxe -> ../lib64/haxe/haxe
  • haxedoc -> ../lib64/haxe/haxedoc
  • haxelib -> ../lib64/haxe/haxelib
  • neko -> ../lib64/neko/neko
  • nekotools -> ../lib64/neko/nekotools

Then I installed openfl with:

haxelib install openfl
haxelib run openfl setup

Then removed the symlink here /usr/bin/openfl, and created a new one in /usr/local/bin like the others:

  • openfl -> ../lib64/haxe/openfl

That's about it.
If I remember right, I'm pretty sure I only had to yum install gcc-g++ to build for linux with openfl test linux.

On this fedora 19 box, I have all the samples building for linux and html5, in an automatic job. Here's the deployed artifacts (html5 only):

@drkibitz
Copy link

drkibitz commented Aug 6, 2013

@arsfeld I have not tried android yet on this box, so if there are x64 problems there, I have to think they are specific to the android target.

@arsfeld
Copy link
Author

arsfeld commented Aug 7, 2013

Hm, these are good steps to install in Fedora, I was wondering how I could install haxe and neko in a better way. But yes, that part did also worked fine for me, didn´t had to change much from the default installation instructions.
My problem is that the Android NDK r8e, which is the last one supported by openfl, doesn´t support x64 machines, which means you have to manually install the 32bit libraries.
So, it´s only the Android target that requires more seting up in Fedora.

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

5 participants