Gen exportcode for Linux based Android application


    Nov 18 2014 | 8:08 am
    Hello,
    This is more the question for the developers of gen programming environment. What I'm trying to achieve is to compile gen exported code as an android .so library using ndk-build command in cygwin. What I get is a numerous undefined reference errors for gen functions I use in my project. The question is:
    Does the original intent of compiling gen exported code for Android is misleading? Isn't the UNIX based archetecture structure for which it is more reccommended to use the gen exported code as seen from wiki examples differs from Linux one in the namespace area?
    I made a research myself, tried out different namespace combinations and still unable to compile gen exported code for android.
    Sorry, I cant be more precise in formulation as I'm writng from my daily job place. But I will likely to receive any feedback with possible solutions to this problem.
    Best

    • Nov 18 2014 | 4:46 pm
      So, here I'm back from work and here is the error log from cygwin console:
      $ ndk-build Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 11 in ./AndroidManifest.xml [armeabi] SharedLibrary : libcompositorwindow.so C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function safepow(double, double):jni/genlib_ops.h:97: error: undefined reference to 'gen_msp_pow' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Noise::reset():jni/genlib_ops.h:543: error: undefined reference to 'systime_ticks()' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Noise::reset():jni/genlib_ops.h:543: error: undefined reference to 'systime_ticks()' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Delay::~Delay():jni/genlib_ops.h:686: error: undefined reference to 'genlib_data_setcursor' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Delay::~Delay():jni/genlib_ops.h:688: error: undefined reference to 'genlib_data_release' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Delay::reset(char const*, long):jni/genlib_ops.h:696: error: undefined reference to 'genlib_obtain_reference_from_string' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Delay::reset(char const*, long):jni/genlib_ops.h:697: error: undefined reference to 'genlib_obtain_data_from_reference' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Delay::reset(char const*, long):jni/genlib_ops.h:699: error: undefined reference to 'genlib_report_error(char const*)' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Delay::reset(char const*, long):jni/genlib_ops.h:709: error: undefined reference to 'genlib_data_resize' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Delay::reset(char const*, long):jni/genlib_ops.h:712: error: undefined reference to 'genlib_data_getinfo' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Delay::reset(char const*, long):jni/genlib_ops.h:719: error: undefined reference to 'genlib_report_error(char const*)' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Delay::reset(char const*, long):jni/genlib_ops.h:724: error: undefined reference to 'genlib_data_getcursor' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Delay::reset(char const*, long):jni/genlib_ops.h:726: error: undefined reference to 'genlib_report_error(char const*)' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Delay::reset(char const*, long):jni/genlib_ops.h:731: error: undefined reference to 'set_zero64(double*, long)' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Data::~Data():jni/genlib_ops.h:995: error: undefined reference to 'genlib_data_release' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Data::getinfo():jni/genlib_ops.h:1024: error: undefined reference to 'genlib_data_getinfo' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Data::getinfo():jni/genlib_ops.h:1029: error: undefined reference to 'genlib_report_error(char const*)' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Data::reset(char const*, long, long):jni/genlib_ops.h:1001: error: undefined reference to 'genlib_obtain_reference_from_string' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Data::reset(char const*, long, long):jni/genlib_ops.h:1002: error: undefined reference to 'genlib_obtain_data_from_reference' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Data::reset(char const*, long, long):jni/genlib_ops.h:1008: error: undefined reference to 'genlib_data_resize' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function Data::setbuffer(void*):jni/genlib_ops.h:1017: error: undefined reference to 'genlib_data_setbuffer' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function DataLocal::resize(long, long):jni/genlib_ops.h:1050: error: undefined reference to 'genlib_report_message(char const*)' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function DataLocal::resize(long, long):jni/genlib_ops.h:1053: error: undefined reference to 'sysmem_resizeptr(void*, unsigned long)' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function DataLocal::resize(long, long):jni/genlib_ops.h:1055: error: undefined reference to 'sysmem_newptr(unsigned long)' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function DataLocal::resize(long, long):jni/genlib_ops.h:1065: error: undefined reference to 'set_zero64(double*, long)' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function compositorwindow_ce_3_2::State::reset(double, int):jni/compositorwindow.cpp:4976: error: undefined reference to 'genlib_reset_complete' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function compositorwindow_ce_3_2::create(double, long):jni/compositorwindow.cpp:22011: error: undefined reference to 'sysmem_newptr(unsigned long)' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function compositorwindow_ce_3_2::State::~State():jni/genlib_ops.h:1187: error: undefined reference to 'sysmem_freeptr(void*)' C:/Users/Ruslan/Documents/Android/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/compositorwindow/compositorwindow.o: in function compositorwindow_ce_3_2::destroy(CommonState*):jni/compositorwindow.cpp:22133: error: undefined reference to 'sysmem_freeptr(void*)' collect2: ld returned 1 exit status /cygdrive/c/Users/Ruslan/Documents/Android/android-ndk-r10/build/core/build-binary.mk:647: ошибка выполнения рецепта для цели «obj/local/armeabi/libcompositorwindow.so» make: *** [obj/local/armeabi/libcompositorwindow.so] Ошибка 1
      I would like Cycling '74 to shed a light on if it is possible to compile gen exportcode for Android.
      Thanks in advance.
    • Nov 19 2014 | 6:10 am
      So noone on this one? I think if Cycling would not want to participate in the life of the developments made with the use of gen~ the whole idea of this programming environment is undefined.
    • Nov 21 2014 | 12:11 pm
      I found out due to the log file I just posted that it is an error in the linker of C++ compiler. There are several scenarios according to this:
      • First, I can delete an old .o object file in Android project folder
      • Second, the NDK compiler may use shared libraries for standard gen functions, which is also improper behavior
      • The problem can be in name mangling if some of the external gen libraries written with C
      So it could be that Android linker is not compatible with Cycling '74 code or the architecture of written code doesn't include one of the possible C files.
      I will continue this thread if some other users would like to compile their exportcode for Android.
    • Nov 21 2014 | 1:03 pm
      Have you tried emailing support?
    • Nov 21 2014 | 1:22 pm
      I found that a subject of management the exportcode material is beyond the standard bug report feature. I know there are enough Cycling '74 guys on the forum as well as those who successfully compiled gen code for iOS. Android is a new beast for the community, however I encountered several topics with this approach as well.
    • Nov 23 2014 | 6:25 pm
      So, I tried first and third problem solutions and I would like to say that they unfortunately doesn't work. Deleting object file doesn't make any sense.. For the third solution I tried extern "C" linkage for problematic functions - it started to solve errors but after all the same problems appeared on the same places. So this name mangling solution doesn't work.
    • Nov 26 2014 | 12:41 pm
      I suspect that the problem is not in code but in Android.mk file. I named only main .cpp file in Android.mk and I see that there is no links for genlib.cpp file inside the C++ code structure, so it needs to be included in LOCAL_SRC_FILES variable also. I'll try this at the evening and will report if this will be successful.
    • Nov 27 2014 | 6:41 am
      So the final statement makes it. I was able to compile .so library file. However it is not an end of the game. Now the problem is in running this native application on Android virtual device. It complains in Eclipse about Main class. I haven't included one in a .cpp file, because it will introduce problems with name mangling I think. However if it is possible to compile for Linux I can continue the development in other direction building a hardware rather than Android application. I will think on possibilities and report here.
    • Aug 21 2017 | 6:06 am
      Thanks for sharing how to make android app without coding
    • Aug 29 2017 | 6:06 am
      So, I tried first and third problem solutions and I would like to say that they unfortunately doesn't work. Deleting object file doesn't make any sense.. For the third solution I tried extern "C" linkage for problematic functions - it started to solve errors but after all the same problems appeared on the same places. So this name mangling solution doesn't work.