This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

c6run on Android, porting libvpx



Hello, I am working on porting some vp8 codec library onto DSP environment.

The first method I am using is to implement a XDM interface with viddec2 template.

And then I saw the new compile tools c6run. But when I tried to build a ARM library with

c6runlib-cc and c6runlib-ar (the output is a test library called hello.a), and use the

"include prebuilt library" option in Android.mk. It seems the application can not access

the functions defined in c6runlib output files. The error message is "undefined reference test(int,int)"

where test() is a function defined in the test library hello.a.

Is there any procedure I am missing or that the output of c6runlib is not capable of running on

the Android environment ? Any tips or hints will be really appreciated ! Many thanks.

The Android environment I am building are 2.1 and 2.2 with rowbaot filesystem.

 

best regards,

Akai

  • Akai,

    This may be an issue with mixing C and C++ code (or compilers).  Can you provide a little more detail of how you are building things?

    Please note that we have not tried building C6Run apps for use on Android, but since the kernel is Linux, it should conceivably work as a native code executable.

    Regards, Daniel

  • Daniel,

    Hello, thanks a lot for the reply. I have made some more tests after receiving your reply.

    It seems the previous undefined reference issue was actually caused by mixing C and C++ code.

    (The original c6runlib output file was hello.lib, and I included the header into another .cpp file)

    So this time I tried to include the header hello.lib file into another .c file to see if it is caused by mixing C and C++ code.

    The original undefined error was gone and it appears some new errors as follow:

    I will describe some details about my building library and paste the error log below

     

    c6runlib output: libhello.a  (related files: hello.c, hello.o, hello.h)      

    Since Android.mk only taking .a files as prebuilt static library, so I renamed libhello.lib into libhello.a. Is it doable?

     

    content of hello.c:

    --

    #include <stdlib.h>

    #include "hello.h"


    int test(int a, int b)
    {
            return a+b;
    }

    --

     

    content of hello.h:

    --

    #ifndef _HELLO_H_
    #define _HELLO_H_

    #ifdef __cplusplus
    extern "C" {
    #endif

    extern int test(int a, int b);

    #endif

    --

     

    In this testing case I am trying to include the header file of libhello into another Android library libjpeg

    Android.mk of libjpeg:

    --

    LOCAL_PATH := $(call my-dir)

    JPEG_TOP := $(LOCAL_PATH)

    include $(CLEAR_VARS)

    LOCAL_PREBUILT_LIBS := libhello.a
    include $(BUILD_MULTI_PREBUILT)

    include $(JPEG_TOP)/Android.jpeg.mk

    --

     

    Adding the following 2 lines into Android.jpeg.mk:

    --

    LOCAL_SRC_FILES := \
            jdinput.c

    LOCAL_STATIC_LIBRARIES :=       \
            libhello

    --

     

    The SRC file which includes the hello.h header file is jdinput.c

    --

    #include "hello.h"

      int a,b,c;

      a = 1;
      b = 2;
      c = test(a,b);

    --

     

    The following is the error log occured while building the Android filesystem:

    --

    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=2.2
    TARGET_PRODUCT=beagleboard
    TARGET_BUILD_VARIANT=eng
    TARGET_SIMULATOR=
    TARGET_BUILD_TYPE=release
    TARGET_BUILD_APPS=
    TARGET_ARCH=arm
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_BUILD_TYPE=release
    BUILD_ID=MASTER
    ============================================
    build/core/Makefile:19: warning: overriding commands for target `out/target/product/beagleboard/system/usr/keylayout/qwerty.kl'
    sdk/emulator/keymaps/Android.mk:13: warning: ignoring old commands for target `out/target/product/beagleboard/system/usr/keylayout/qwerty.kl'
    Copy: out/target/product/beagleboard/system/usr/keylayout/qwerty.kl
    host C++: mksnapshot <= external/v8/src/platform-linux.cc
    host Executable: mksnapshot (out/host/linux-x86/obj/EXECUTABLES/mksnapshot_intermediates/mksnapshot)
    true
    Install: out/host/linux-x86/bin/mksnapshot
    target arm C: libjpeg <= external/jpeg/jdinput.c
    target Prebuilt: libhello (out/target/product/beagleboard/obj/STATIC_LIBRARIES/libhello_intermediates/libhello.a)
    true
    target SharedLib: libjpeg (out/target/product/beagleboard/obj/SHARED_LIBRARIES/libjpeg_intermediates/LINKED/libjpeg.so)
    out/target/product/beagleboard/obj/STATIC_LIBRARIES/libhello_intermediates/libhello.a(C6Run.o): In function `LOCAL_installSignalHandlers':
    C6Run.c:(.text+0x12c): undefined reference to `sigemptyset'
    C6Run.c:(.text+0x134): undefined reference to `sigfillset'
    out/target/product/beagleboard/obj/STATIC_LIBRARIES/libhello_intermediates/libhello.a(cmem.o470MV): In function `validate_init':
    cmem.c:(.text+0x8c): undefined reference to `stderr'
    out/target/product/beagleboard/obj/STATIC_LIBRARIES/libhello_intermediates/libhello.a(cmem.o470MV): In function `CMEM_getNumBlocks':
    cmem.c:(.text+0x144): undefined reference to `stderr'
    out/target/product/beagleboard/obj/STATIC_LIBRARIES/libhello_intermediates/libhello.a(cmem.o470MV): In function `getBlock':
    cmem.c:(.text+0x1d8): undefined reference to `stderr'
    out/target/product/beagleboard/obj/STATIC_LIBRARIES/libhello_intermediates/libhello.a(cmem.o470MV): In function `CMEM_getVersion':
    cmem.c:(.text+0x25c): undefined reference to `stderr'
    out/target/product/beagleboard/obj/STATIC_LIBRARIES/libhello_intermediates/libhello.a(cmem.o470MV): In function `CMEM_cacheInv':
    cmem.c:(.text+0x2dc): undefined reference to `stderr'
    out/target/product/beagleboard/obj/STATIC_LIBRARIES/libhello_intermediates/libhello.a(cmem.o470MV):cmem.c:(.text+0x35c): more undefined references to `stderr' follow
    out/target/product/beagleboard/obj/STATIC_LIBRARIES/libhello_intermediates/libhello.a(cmem.o470MV): In function `CMEM_init':
    cmem.c:(.text+0x9dc): undefined reference to `__errno_location'
    cmem.c:(.text+0xa40): undefined reference to `__errno_location'
    cmem.c:(.text+0xa70): undefined reference to `stderr'
    .....

    collect2: ld returned 1 exit status
    make: *** [out/target/product/beagleboard/obj/SHARED_LIBRARIES/libjpeg_intermediates/LINKED/libjpeg.so] Error 1

    --

    Any suggestion would be really appreciated. Thanks.

     

  • Kevin,

    This seems like a more fundamental issue with the link step.  Perhaps this is related to differences between the C runtime libraries between GNU Linux and Android Linux (GLibC versus Bionic).  Did you build the libhello library using the Android toolchain?  Did you build the C6Run backend libraries with the same toolchain?

    Unfortunately, I'm not familiar enough with the Android build procedures to tell what is the likely issue.

    Regards, Daniel

  • to Daniel:

     

    Thanks a lot for the reply.

    The toolchain used for Android system building is arm-eabi-gcc and the toolchain used for c6runlibs is arm-none-linux-gnueabi.

    So maybe that`s the problem.

    I will try to see if it is possible to switch the toolchain from arm-none-linux-gnueabi to arm-eabi-gcc for c6runlib.

     

    best regards,

    Akai

  • Hi Kevin,

    Did you manage to solve this problem?

    I am trying to build the C6Run kernel modules with the Android toolchain.  The system builds uImage, but not the dsplinkk.ko or cmemk.ko kernel modules...

    Best regards,

    Dean.

  • Hi, Dean,

    I have finished my library porting with old method using "Codec Engine" instead of c6run.
    The libc used by traditional ARM Linux based environment has slgihtly difference with Android,
    so I guess some of the library/app built by c6run may not be able to run on Android directly.
    For your case, check the files under external/ti-dsp/. If you git your code from Rowboat Android DSP
    projects, there should be corresponding Codec Engine files as well as the source code needed for dsplink. (DVSDK that is)

    best regards,
    Kevin