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

Getting started Tutorial/ Wiki for android #1

Open
mayur70 opened this issue May 10, 2019 · 6 comments · May be fixed by #2
Open

Getting started Tutorial/ Wiki for android #1

mayur70 opened this issue May 10, 2019 · 6 comments · May be fixed by #2

Comments

@mayur70
Copy link

mayur70 commented May 10, 2019

Is there any getting started tutorial/Wiki for android/Mobile target ?
There is wiki entry in hashlink but i am not familiar with all android platform setup things, i would appreciate if anyone could point to specific tutorial/Wiki to follow.

@Thanh9356
Copy link

Try to copy and edit something from cocos2d-x (just build.gradle)

@felipesaruhashi
Copy link

felipesaruhashi commented Apr 11, 2020

I tried to use this repo to build for android but without success.
What I have done so far:

  • Made a simple hello world with heaps, then run:
    $ haxe -lib heaps -hl out/main.c -main Main

  • cloned this repo as long as all submodules.

  • copied all content from out folder from my project to the out folder of this project.

  • installed all the ndk, cmake, and compilers for the build.

  • created a build folder, then inside of it, I ran:
    $ cmake .. -DANDROID_NDK={path for my ndk} -DANDROID_ABI="armeabi-v7a arm64-v8a x86" -DANDROID_PLATFORM=android-17

  • then
    $ make

It results with one error:

  • /bin/sh: native-tools/bsincgen: No such file or directory
    make[2]: *** [openal-soft/bsinc_inc.h] Error 127
    make[1]: *** [openal-soft/CMakeFiles/OpenAL.dir/all] Error 2
    make: *** [all] Error 2

I don't have much experience building c/c++ code, but my guess it is that inside the native-tools folder, there was one bsincgen.exe, and since I build on mac, it didn't recognize it.

If someone could point it out how could I solve it would be great!

I could write a tutorial on how to build it for android if I am able to complete the build.

cmake version 3.17.0
ndk: r21
haxe: 4.0.5v
os: High Sierra

Thanks!

@josuigoa
Copy link

for now this repo is windows-only, see this commit

if you have access to a windows machine I had to make some tweaks to get it working.

@qkdreyer
Copy link

I've managed to build bin2h and bsincgen for macOS, updated hashlink to master, added minimp3 dependency in CMakeLists.txt and now I'm having a new error while building the heaps-android-app project under Android Studio, about missing hashlink gc symbols :

pastebin

/Users/qkdreyer/Library/Android/sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=i686-none-linux-android19 --gcc-toolchain=/Users/qkdreyer/Library/Android/sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/qkdreyer/Library/Android/sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libheapsapp.so -o /tmp/heaps-android/heaps-android-app/heapsapp/build/intermediates/cmake/debug/obj/x86/libheapsapp.so /tmp/heaps-android/heaps-android-app/heapsapp/.externalNativeBuild/cmake/debug/x86/CMakeFiles/heapsapp.dir/out/main.c.o  /tmp/heaps-android/heaps-android-app/heapsapp/.externalNativeBuild/cmake/debug/x86/libhl.a /tmp/heaps-android/heaps-android-app/heapsapp/.externalNativeBuild/cmake/debug/x86/libsdl.hdll.a /tmp/heaps-android/heaps-android-app/heapsapp/.externalNativeBuild/cmake/debug/x86/libfmt.hdll.a /tmp/heaps-android/heaps-android-app/heapsapp/.externalNativeBuild/cmake/debug/x86/libopenal.hdll.a /tmp/heaps-android/heaps-android-app/heapsapp/.externalNativeBuild/cmake/debug/x86/libui.hdll.a -llog /tmp/heaps-android/heaps-android-app/heapsapp/build/intermediates/cmake/debug/obj/x86/libSDL2.so -lm -Wl,-Bstatic -ldl -Wl,-Bdynamic -llog -landroid -lGLESv1_CM -lGLESv2 -Wl,--no-undefined /tmp/heaps-android/heaps-android-app/heapsapp/.externalNativeBuild/cmake/debug/x86/sdl2/libSDL2main.a -lEGL -lGLESv3 /tmp/heaps-android/libjpeg-turbo/obj/local/x86/libjpeg-turbo.a /tmp/heaps-android/heaps-android-app/heapsapp/build/intermediates/cmake/debug/obj/x86/libopenal.so -latomic -lm
/tmp/heaps-android/hashlink/src/hlc_main.c:122: error: undefined reference to 'hl_global_init'
/tmp/heaps-android/hashlink/src/hlc_main.c:123: error: undefined reference to 'hl_register_thread'
/tmp/heaps-android/hashlink/src/hlc_main.c:140: error: undefined reference to 'hl_global_free'
/tmp/heaps-android/out/_std/String.c:43: error: undefined reference to 'hl_alloc_obj'
/tmp/heaps-android/out/_std/String.c:58: error: undefined reference to 'hl_alloc_obj'
/tmp/heaps-android/out/_std/String.c:84: error: undefined reference to 'hl_alloc_obj'
/tmp/heaps-android/out/_std/String.c:104: error: undefined reference to 'hl_alloc_dynamic'
/tmp/heaps-android/out/_std/String.c:287: error: undefined reference to 'hl_alloc_dynamic'
/tmp/heaps-android/out/_std/String.c:337: error: undefined reference to 'hl_alloc_dynamic'
/tmp/heaps-android/out/_std/String.c:348: error: undefined reference to 'hl_alloc_dynamic'
/tmp/heaps-android/out/_std/String.c:432: error: undefined reference to 'hl_alloc_obj'
/tmp/heaps-android/out/hl/types/ArrayObj.c:349: error: undefined reference to 'hl_get_thread'
/tmp/heaps-android/out/hl/types/ArrayObj.c:368: error: undefined reference to 'hl_get_thread'
/tmp/heaps-android/out/h3d/impl/MemoryManager.c:1362: error: undefined reference to 'hl_alloc_virtual'
/tmp/heaps-android/out/h3d/mat/Texture.c:1448: error: undefined reference to 'hl_alloc_dynobj'
/tmp/heaps-android/out/h3d/mat/Texture.c:1659: error: undefined reference to 'hl_alloc_dynobj'
/tmp/heaps-android/out/h3d/mat/Texture.c:1739: error: undefined reference to 'hl_alloc_dynobj'
/tmp/heaps-android/out/sdl/Window.c:57: error: undefined reference to 'hl_get_thread'
/tmp/heaps-android/out/sdl/Window.c:225: error: undefined reference to 'hl_get_thread'
/tmp/heaps-android/out/hxd/SceneEvents.c:368: error: undefined reference to 'hl_alloc_virtual'
/tmp/heaps-android/out/hxd/SceneEvents.c:976: error: undefined reference to 'hl_alloc_virtual'
/tmp/heaps-android/out/h2d/RenderContext.c:668: error: undefined reference to 'hl_alloc_virtual'
/tmp/heaps-android/out/hxsl/Cache.c:1567: error: undefined reference to 'hl_alloc_dynbool'
/tmp/heaps-android/out/hxsl/Cache.c:1587: error: undefined reference to 'hl_alloc_dynbool'
/tmp/heaps-android/out/h3d/shader/Base2d.c:238: error: undefined reference to 'hl_alloc_dynbool'
/tmp/heaps-android/out/h3d/shader/Base2d.c:257: error: undefined reference to 'hl_alloc_dynbool'
/tmp/heaps-android/out/hxd/impl/AnyProps.c:21: error: undefined reference to 'hl_alloc_dynobj'
/tmp/heaps-android/out/hl/globals.c:5697: error: undefined reference to 'hl_add_root'
/tmp/heaps-android/out/hl/globals.c:5698: error: undefined reference to 'hl_add_root'
/tmp/heaps-android/out/hl/globals.c:5699: error: undefined reference to 'hl_add_root'
/tmp/heaps-android/out/hl/globals.c:5700: error: undefined reference to 'hl_add_root'
/tmp/heaps-android/out/main.c:534: error: undefined reference to 'hl_alloc_init'
/tmp/heaps-android/hashlink/src/std/array.c:28: error: undefined reference to 'hl_gc_alloc_gen'
/tmp/heaps-android/hashlink/src/std/buffer.c:44: error: undefined reference to 'hl_gc_alloc_gen'
/tmp/heaps-android/hashlink/src/std/buffer.c:57: error: undefined reference to 'hl_gc_alloc_gen'
/tmp/heaps-android/hashlink/src/std/buffer.c:58: error: undefined reference to 'hl_gc_alloc_gen'
/tmp/heaps-android/hashlink/src/std/cast.c:120: error: undefined reference to 'hl_is_gc_ptr'
/tmp/heaps-android/hashlink/src/std/error.c:31: error: undefined reference to 'hl_blocking'
/tmp/heaps-android/hashlink/src/std/error.c:43: error: undefined reference to 'hl_blocking'
/tmp/heaps-android/hashlink/src/std/file.c:100: error: undefined reference to 'hl_blocking'
/tmp/heaps-android/hashlink/src/std/file.c:117: error: undefined reference to 'hl_blocking'
/tmp/heaps-android/hashlink/src/std/maps.h:113: error: undefined reference to 'hl_remove_root'
/tmp/heaps-android/hashlink/src/std/maps.h:113: error: undefined reference to 'hl_remove_root'
/tmp/heaps-android/hashlink/src/std/maps.h:113: error: undefined reference to 'hl_remove_root'
/tmp/heaps-android/hashlink/src/std/obj.c:149: error: undefined reference to 'hl_remove_root'
/tmp/heaps-android/hashlink/src/std/obj.c:181: error: undefined reference to 'hl_malloc'
/tmp/heaps-android/hashlink/src/std/obj.c:217: error: undefined reference to 'hl_malloc'
/tmp/heaps-android/hashlink/src/std/obj.c:218: error: undefined reference to 'hl_malloc'
/tmp/heaps-android/hashlink/src/std/obj.c:219: error: undefined reference to 'hl_malloc'
/tmp/heaps-android/hashlink/src/std/obj.c:273: error: undefined reference to 'hl_zalloc'
/tmp/heaps-android/hashlink/src/std/obj.c:423: error: undefined reference to 'hl_zalloc'
/tmp/heaps-android/hashlink/src/std/thread.c:502: error: undefined reference to 'hl_register_thread'
/tmp/heaps-android/hashlink/src/std/thread.c:506: error: undefined reference to 'hl_unregister_thread'
/tmp/heaps-android/hashlink/src/std/types.c:364: error: undefined reference to 'hl_zalloc'

@qkdreyer
Copy link

any thoughts @ncannasse ?

@ncannasse
Copy link
Member

ncannasse commented Jun 12, 2020 via email

qkdreyer referenced this issue in qkdreyer/heaps-android Jun 15, 2020
@qkdreyer qkdreyer linked a pull request Jun 15, 2020 that will close this issue
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

Successfully merging a pull request may close this issue.

6 participants