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.

TDA4VM: Question regarding integrating DSP libraries (such as VLIB) into PSDKRA 6.2

Part Number: TDA4VM
Other Parts Discussed in Thread: SYSBIOS

Customer attempting to integrate the VLIB library into the PSDKRA (note that this is in PC Emulation mode). Question from the customer regarding how to deal the following errors encountered during complie:

#1 Error

[GCC] Compiling C99 main.c
In file included from /work/TI/psdk_rtos_auto_j7_06_02_00_21/vxlib_c66x_1_1_4_0/packages/ti/vlib/vlib.h:84:0,
                 from /work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/apps/basic_demos/app_fast_detection/main.c:69:
/work/TI/psdk_rtos_auto_j7_06_02_00_21/vxlib_c66x_1_1_4_0/packages/ti/vlib/src/VLIB_afast12_detectCorners/VLIB_afast12_detectCorners.h:89:2: error: #error invalid target
 #error invalid target
  ^

#2 Error

[GCC] Compiling C99 main.c
In file included from /work/TI/psdk_rtos_auto_j7_06_02_00_21/vxlib_c66x_1_1_4_0/packages/ti/vlib/src/VLIB_afast12_detectCorners/c66/../../common/VLIB_types.h:108:0,
                 from /work/TI/psdk_rtos_auto_j7_06_02_00_21/vxlib_c66x_1_1_4_0/packages/ti/vlib/src/VLIB_afast12_detectCorners/c66/VLIB_afast12_detectCorners.h:84,
                 from /work/TI/psdk_rtos_auto_j7_06_02_00_21/vxlib_c66x_1_1_4_0/packages/ti/vlib/src/VLIB_afast12_detectCorners/VLIB_afast12_detectCorners.h:85,
                 from /work/TI/psdk_rtos_auto_j7_06_02_00_21/vxlib_c66x_1_1_4_0/packages/ti/vlib/vlib.h:84,
                 from /work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/apps/basic_demos/app_fast_detection/main.c:69:
/work/TI/psdk_rtos_auto_j7_06_02_00_21/vxlib_c66x_1_1_4_0/packages/ti/vlib/src/VLIB_afast12_detectCorners/c66/../../common/VLIB_platforms.h:11:37: fatal error: c6xsim/C6xSimulator.h: No such file or directory
     #include "c6xsim/C6xSimulator.h"
                                     ^
compilation terminated.
concerto/finale.mak:306: recipe for target '/work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/debug/module/apps.basic_demos.app_fast_detection/main.o' failed

  • Responses from the app team - please see below.

    John H. Gardner said:
    #1 Error

    These errors are because the concerto.mak file that you are using for compiling the files which include the VLIB/VXLIB/DSPLIB header files are missing the proper definitions. The below is taken from one of the concerto files in the SDK which is compiling the files which use VXLIB headers.  Same is needed in this case:

     

    ifeq ($(TARGET_CPU), $(filter $(TARGET_CPU), X86 x86_64))

    CFLAGS      += -D_HOST_BUILD -D_TMS320C6600 -DTMS320C66X -DHOST_EMULATION

    endif

    John H. Gardner said:
    #2 Error

    The compile error is saying it can’t find the header file based on the include paths that are being passed to the compiler.  You need to add include paths for where this header is.

     

    This is the same header which is being used already in vxlib, so you can “find . –name C6xSimulator.h” in the vxlib root folder (or full SDK if you are not sure where it is), and the result will show:

     

    ./packages/ti/vxlib/src/common/c6xsim/C6xSimulator.h

     

    So the solution is the add the following lines to the concerto.mak file:

     

    IDIRS       += $(VXLIB_PATH)/packages/ti/vxlib/src/common/c6xsim

    IDIRS       += $(VXLIB_PATH)/packages/ti/vxlib/src/common

     

  • After the mentioned steps were executed we still see a linking issue.


    Linking /work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/release/vx_app_demo
    /work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/release/module/apps.basic_demos.app_demo/main.o: In function `app_demo':
    main.c:(.text+0xa41): undefined reference to `VLIB_findFundamentalMat'
    collect2: error: ld returned 1 exit status
    concerto/finale.mak:206: recipe for target '/work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/release/vx_app_demo' failed
    make: [/work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/release/vx_app_demo] Error 1 (ignored)

  • Royston,

    All of these issues are related to changes that one needs to make to the makefile to link code against a library.  Concerto is just a simplified wrapper around 'make'.  You can see documentation on concerto here:

    https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/latest/exports/docs/psdk_rtos_auto/docs/user_guide/developer_notes_concerto.html

    In general, when you want to add functions to a build that come from a static library, here are the steps to do the same:

    Changes in source code (I assume these are already done based on your comments, but including for completeness):

    1. Add calls to functions in library in c file of your choice
    2. Include headers for calls in same c file

    Now, if the above is all that is done, then the compiler and linker will throw errors since make doesn't know where the new header files and libraries are, so we need to tell make where to find these files/symbols.  Here are the things to add to concerto.mak file:

    1. Include paths: add paths to makefile to indicate where the compiler should look for the headers needed to find the prototypes that were added
      1. This is done using IDIRS
      2. e.g.

        IDIRS       += $(VXLIB_PATH)/packages/ti/vxlib/src/common/c6xsim

        IDIRS       += $(VXLIB_PATH)/packages/ti/vxlib/src/common

    2. Libraries: add name of static or shared libraries to link to to indicate what is the name of the static libraries
      1. This is done using STATIC_LIBS or SHARED_LIBS, respectively
      2. These macros assume that the convention of the library name is lib<libname>.a, and only libname portion is put as the STATIC_LIB;  if this name doesn't apply, you can either change the name of the library to use this convention, or use ADDITIONAL_STATIC_LIBS
      3. e.g.
        1. STATIC_LIBS += vlib_x86_64 c6xsim_x86_64_C66
        2. or
        3. ADDITIONAL_STATIC_LIBS += vlib.a

    3. Library paths: add the paths where the libraries above are located
      1. This is done using LDIRS
      2. e.g. LDIRS       := <path to vlib library>
    4. Preprocessor defines: Sometimes, the header files have #ifdef XYZ, in order for the code to compile against the proper preprocessor macros, some macros should be defined. 
      1. This is done using DEFS if you want concerto to add -D before the value, or CFLAGS to define exactly what goes on compiler command line
      2. e.g. CFLAGS      += -D_HOST_BUILD -D_TMS320C6600 -DTMS320C66X -DHOST_EMULATION

    So for  your issue above, the linker can't find the symbol that is part of the VLIB library.  This means that you may not have listed the vlib library as a STATIC_LIB or ADDITIONAL_STATIC_LIBS (in the case of vlib, you probably should use ADDITIONAL_STATIC_LIBS since the name does not match the convention.  Please add this to the makefile, and  also make sure that the path is there with LDIRS.

    Regards,

    Jesse

  • Jesse,

    As per your suggestion we did add the following to concerto.mak, but the issue still persists,

    ifeq ($(TARGET_CPU), $(filter $(TARGET_CPU), X86 x86_64))
    CFLAGS += -D_HOST_BUILD -D_TMS320C6600 -DTMS320C66X -DHOST_EMULATION
    endif

    IDIRS += $(VLIB_PATH)/packages/ti/vlib/src/common/c6xsim

    IDIRS += $(VLIB_PATH)/packages/ti/vlib/src/common

    LDIRS += $(VLIB_PATH)/packages/ti/vlib/lib

    STATIC_LIBS += vlib_x86_64 c6xsim_x86_64_C66 (or/and) ADDITIONAL_STATIC_LIBS += vlib.a

    These steps were also used to try to include DSPlib and VXlib, but failed to do so.

    Regards,

    Royston

  • Royston,

    Perhaps you can share your concerto.mak file.  The e.g. means (for example).  My intention was not to give you lines you can copy paste into the makefile, but give instruction on how to update the makefile generically, for whatever libraries you have, so I put some example as a patter for you to follow.  When I look at the library names for the x86_64 in vlib package, I see:

    vlib.a86_64W

    so you should put

    ADDITIONAL_STATIC_LIBS += vlib.a86_64W

    You also need to look at the library names for the other libraries you want in the packages, and put appropriately.

    Jesse

  • Are you building for Linux PC?  if so, then the library that is packaged in vlib is for windows.  You will need to first build the library for PC linux, and then put the name of the library there.

  • I'm noticing that the vlib doesn't already have a linux makefile for building the library since it was released before we started adding linux makefiles, but vxlib does.  The one in vxlib is /packages/ti/vxlib/lib/vxlib.a86l.mk.  What I suggest is to compare this file to vlib.a86_64W, and modify the vlib one to take the linux specific commands (like gcc, etc) from the vxlib one.  Then you can follow the instructions in the vlib instructions for building the library.

    Once this library is built, then it should be able to be linked by your program with the commands in concerto.mak that we talked about earlier.

  • Directions for building library are at following document in the package: vxlib_c66x_1_1_4_0/docs/doxygen/html/gnu_build.html

  • Hi Jesse,

    Yes Jesse, we are building this for a Linux PC, but the VLIB_C66X_3_3_2_0 that I downloaded on your pervious suggeston does not conatin the /packages/ti/vlib/lib/vlib.a86l.mk file itself.

    What do you suggest we do in this senario? Is adding a file similar to vxlib.a86l.mk(e.g.: vlib.a86l.mk) enough or are there any other changes we need to do since this file was not present at all previously for a LINUX PC?

    Since you mentioned the this library was released before you started adding linux makefiles, is there a latest version of the library that you released after which you started adding the make files for LINUX PC?

  • Royston Pereira said:
    What do you suggest we do in this senario? Is adding a file similar to vxlib.a86l.mk(e.g.: vlib.a86l.mk) enough or are there any other changes we need to do since this file was not present at all previously for a LINUX PC?

    Yes, this should be enough to make a vlib.a86l.mk based upon the vxlib.a86l.mk and the file list from the existing vlib mk file.  That should be all that is needed.

    The VLIB release online is the latest one. We have not made an update with linux makefile.  My point was that we added this linux makefile to VXLIB pacakge, and since we did that, we had not made any more vlib packages.

    Jesse

  • Hi Jesse,

    As per your suggestion we added /packages/ti/vlib/lib/vlib.a86l.mk and tried to built the library, but it did not suceed.

    As there was no "makefile" present in /packages/ti/vlib/ we did add it and tried to build the same as per the instruction at vxlib_c66x_1_1_4_0/docs/doxygen/html/gnu_build.html, but it did not build.

    Is there anthing else we need to change/try to have VLIB(and DSPLIB) build for linux?

  • Royston Pereira said:
    As there was no "makefile" present in /packages/ti/vlib/ we did add it and tried to build the same as per the instruction at vxlib_c66x_1_1_4_0/docs/doxygen/html/gnu_build.html, but it did not build.

    From the above, I assume you copied the makefile from vxlib into vlib, and modified the references to vxlib inside to vlib?  Is that right?

    If not, then please do this as this would be required.

    By the way, did you try to build the vxlib itself to see if it works for vxlib first?  I just tried in vxlib by doing following command:

    make lib/vxlib.a86l

    And it worked.

    I would think that for vlib, the command would be:

    make lib/vlib.a86l

  • Yes we did copy and modify vxlib into vlib file accodingly.

    make lib/vxlib.a86l and make lib/vlib.a86l does work for us.

    But the issue still persists,

    Linking /work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/release/vx_app_demo
    /work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/release/module/apps.basic_demos.app_demo/main.o: In function `app_demo':
    main.c:(.text+0xa41): undefined reference to `VLIB_findFundamentalMat'
    collect2: error: ld returned 1 exit status
    concerto/finale.mak:206: recipe for target '/work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/release/vx_app_demo' failed
    make: [/work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/release/vx_app_demo] Error 1 (ignored)

  • I am seeing that VLIB doesnot contain a c(source) file like vxlib: "/packages/ti/vxlib/src/vx/VXLIB_absDiff_i8u_i8u_o8u/c66/VXLIB_absDiff_i8u_i8u_o8u.c"

    Rather VLIB contains "packages/ti/vlib/src/VLIB_afast9_detectCorners/VLIB_afast9_detectCorners_d.c", which we have provided to the vlib.x86l.mk file which produces warnings while building.

    I dont see a "packages/ti/vlib/src/VLIB_afast9_detectCorners/c66/VLIB_afast9_detectCorners.c" file which should be the source file for the VLIB, as the folder structure of VLIB is meant to be the same as VXLIB.

  • It looks like you are using the public object only vlib package, with only test files in source, but algorithm files are distributed only in libraries.

    John will send you a secure download link to the source package distribution momentarily.

  • We would want to have the packages with source files for VLIB, DSPLIB and LINALG.

    Thank you

  • Jesse Villarreal said:

    It looks like you are using the public object only vlib package, with only test files in source, but algorithm files are distributed only in libraries.

    John will send you a secure download link to the source package distribution momentarily.

    Hi Jesse,
    We did recieve the vlib source package, and were able to build it on the linux system as per your previous instructions and did the necessary changes to the makefile for vlib and added /ti/vlib/lib/vlib.a86l.mk file (as per the vxlib.a86l.mk file with required changes).

    We are able to build the vlib succesfully, but we see the below "incompatible" issue while building our source code.

    Linking /work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/release/vx_app_fast_detection
    /usr/bin/ld: skipping incompatible /work/TI/psdk_rtos_auto_j7_06_02_00_21/vlib_c66x_3_3_2_0/packages/ti/vlib/lib/vlib.a86l when searching for -l:vlib.a86l
    /usr/bin/ld: cannot find -l:vlib.a86l
    collect2: error: ld returned 1 exit status
    concerto/finale.mak:206: recipe for target '/work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/release/vx_app_demo' failed
    make: [/work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/release/vx_app_fast_detection] Error 1 (ignored)

    The linker is able to locate the library, but it states that the library is not compatible.

    What would you suggest to do in this case?


    Regards,
    Royston

  • Jesse Villarreal said:

    I'm noticing that the vlib doesn't already have a linux makefile for building the library since it was released before we started adding linux makefiles, but vxlib does.  The one in vxlib is /packages/ti/vxlib/lib/vxlib.a86l.mk.  What I suggest is to compare this file to vlib.a86_64W, and modify the vlib one to take the linux specific commands (like gcc, etc) from the vxlib one.  Then you can follow the instructions in the vlib instructions for building the library.

    Once this library is built, then it should be able to be linked by your program with the commands in concerto.mak that we talked about earlier.



    Just to have a clear understanding:

    We are currently building our code on a LINUX system.
    The code is meant to run on the C66x core, which uses SYSBIOS
    Aditionally the A72 core has LINUX as its OS.

    Regards,
    Royston Pereira

  • I thought this  whole time you were trying to solve build errors for PC emulation mode since your original build errors were for x86_64 target.  By default, the PC emulation mode is already disabled in 6.2 release, so it must have been enabled by setting BUILD_EMULATION_MODE=yes.  If you are building only target, you should set BUILD_EMULATION_MODE=no

    concerto/finale.mak:306: recipe for target '/work/TI/psdk_rtos_auto_j7_06_02_00_21/vision_apps/out/PC/x86_64/LINUX/debug/module/apps.basic_demos.app_fast_detection/main.o' failed

  • Regarding the incompatibility issue, this happens if the compiler version or options have an incompatible mismatch between the the settings that created the library, and the settings creating the executable which links the library.

    In this case, I notice that the makefile for the library has an option "-m32" which builds the library in 32 bit mode, however the SDK makefiles are using 64 bit mode.  You can build the library for 64 bit mode to match if you remove the "-m32" option from the library makefile.

  • Hi Jesse,

    I am able to build and run VXLIB and VLIB with your instructions.

    I am currently trying to have DSPLIB integrated and run it on PC_emulation mode at the moment.
    I dont see any x86 files in "ti/dsplib/lib/".

    What do you recommend I should do? 

  • Royston,

    I think you can create them based on the VXLIB mk file.  You may also need to update the top level "makefile" to call into the new one you create.

    Regards,

    Jesse

  • Jesse,

    I did try and create a dsplib.a86l.mk file and added the changes to the makefile.

    But i am facing this issue for it

    make[1]: *** No rule to make target './src/DSPF_dp_lud//c66/DSPF_dp_lud.c', needed by 'package/lib/lib/dspliba86l/./src/DSPF_dp_lud//c66/DSPF_dp_lud.o86l'. Stop.
    make[1]: Leaving directory '/work/TI/psdk_rtos_auto_j7_06_02_00_21/dsplib_c66x_3_4_0_0/packages/ti/dsplib'
    makefile:102: recipe for target 'lib/dsplib.a86l' failed
    make: *** [lib/dsplib.a86l] Error 2

    Thanks,
    Royston

  • One thing I notice is that in the error above, c66 is lowercase, but in the package it is C66 folder (capital).  Could this be the issue?

    Also, I thought that if there are too many hurtles going this route with new makefile, a fallback option would be to copy the function folders you need from DSPlib into VLIB, and compile it as part of VLIB.

    Jesse