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.

error: unresolved symbols remain - C6472 CCS v4 NDK

Other Parts Discussed in Thread: SYSBIOS

Hello,

I am trying to create a socket on the EVM C6472 which can listen and establish connection with the PC. When I try to use the functions present in NDK, I get “unresolved symbols remain” error.

As of now, main uses only "socket()" to create a new socket. I have linked a folder FDT to the project which contains the files: fdt.h, file.c, fileuser.c and socket.c (necessary functions).

When I try to build the project, I get the below “unresolved symbols remain” error:

undefined       first referenced 

  symbol             in file      

 ---------       ---------------- 

 _PBM_free       ./fdt/socket.obj 

 _PipeClose      ./fdt/fileuser.obj

 _PipeNew        ./fdt/socket.obj 

 _PipeRecv       ./fdt/socket.obj 

 _PipeSend       ./fdt/socket.obj 

 _SemDelete      ./fdt/file.obj   

 _SemPend        ./fdt/file.obj   

 _SemPost        ./fdt/file.obj   

 _SemReset       ./fdt/file.obj   

 _SockAccept     ./fdt/socket.obj 

 _SockBind       ./fdt/socket.obj 

 _SockClose      ./fdt/fileuser.obj

 _SockConnect    ./fdt/socket.obj 

 _SockDisconnect ./fdt/socket.obj 

 _SockGet        ./fdt/socket.obj 

 _SockGetName    ./fdt/socket.obj 

 _SockListen     ./fdt/socket.obj 

 _SockNew        ./fdt/socket.obj 

 _SockRecv       ./fdt/socket.obj 

 _SockRecvNC     ./fdt/socket.obj 

 _SockSend       ./fdt/socket.obj 

 _SockSet        ./fdt/socket.obj 

 _SockShutdown   ./fdt/socket.obj 

 _TaskGetEnv     ./fdt/fileuser.obj

 _TaskSelf       ./fdt/fileuser.obj

 _llEnter        ./fdt/socket.obj 

 _llExit         ./fdt/socket.obj 

 _mmFree         ./fdt/fileuser.obj

 

error: unresolved symbols remain

error: errors encountered during linking; "Socket_First.out" not built

I have added

“ndk_2_20_02_22\packages\ti\ndk\lib\C64plus"

"ndk_2_20_02_22\packages\ti\ndk\lib\C64plus\all_stk"

“ndk_2_20_02_22\packages\ti\ndk\lib\C64plus\hal"

To C6000 linker-> File Search Path  

Help in this regard is highly appreciated.

-Varun

 

  • Varun,

    This error message is typical when you have called functions contained in a library, but have not specified that library to be linked into the project.   Merely specifying the appropriate directories is not  enough.  You need to tell the linker the name of the library that you want to use.  It will search the paths that you add, but you have to tell it what to search for.  

    The -l <libname> switch will specify the libraries to link.

    Regards,

    Dan 

  • Hello Dan,

    Thank you for your reply.

    I tried two ways of adding the libraries:

    1. Properties->c/c++ build -> C6000 Linker -> File Serach path -> Include Library File or command file as input (--library, -l) -> add specific .lib files (infact I added all the files under "\ndk_2_20_02_22\packages\ti\ndk\lib\C64plus" and "\ndk_2_20_02_22\packages\ti\ndk\lib\C64plus\all_stk")

    2. Right Click Project -> Link files to project -> added all the .lib files mentioned above.

    Both of these didn't help. On the contrary, got few more "unresolved symbols remain" error for the .lib files I added.

    Can you please let me know which .lib files in particular needs to be added and how to add them (if the above procedure I followed were incorrect).

    -Varun

  • Varun,

    Just to be clear, you can't just add _ALL_ of those libraries.  You'll see some with similar names....such as netctrl.lib and netctrle.lib.  The first denotes a little endian version.  The second denotes a big Endian version.  You can't have both of these together.  You need to only have the one that corresponds to your project.  So if it's a LE project, use netctrl.lib.  If it's a BE project, use netctrle.lib. Adding bothof these just confuses the linker even more, because it sees the same functions in both of them and doesn't know which one to choose.  This is probably why you got more errors when you did this. 

    Where are your C files expecting to call these function from?  Socket.c looks like it's calling all of these functions:

    •  PBMfree        
    •  PipeNew         
    •  PipeRecv        
    •  PipeSend         
    •  SockAccept      
    •  SockBind        
    •  SockConnect     
    •  SockDisconnect  
    •  SockGet         
    •  SockGetName     
    •  SockListen      
    •  SockNew         
    •  SockRecv        
    •  SockRecvNC      
    •  SockSend        
    •  SockSet         
    •  SockShutdown    
    •  llEnter         
    •  llExit 

    Where is it expecting to call these from? Are these functions from the NDK library?  What about PipeNew, etc?  Those seem more like functions to set up data pipes than functions that would be in the NDK.  Are there other libraries that contain these functions?  Have you included the proper header files to call each of these? 

    When you make a function call, the linker needs to be able to match up that call with the code for the function.  If the function is not in the C file that the call is in, the linker will look to other files in the project.  If the function is not there, it will look in any libraries that it knows about.  If it doesn't find it  in any of these, you'll get unresolved symbol errors. This means that the linker has a call to a function, but can't find the implementation of that function in any places that it knows about.  

    I can't tell you exactly what library all of these calls are in.  I suspect that the socket functions are in the netctrl library, but I can't comment on the rest.  

    I'd suggest not adding many libraries at a time.  Build your project.  See how many errors there are.  Add a library, and see if there are less errors.  If there are not, then that library isn't used, so remove it and add a different one.  If there are less errors then leave that library, and add another..  Continue on this process until you have eliminated the errors.

    Check the dependencies on any library that you are using (look in the documentation).  There may be one library that requires you to also use another.  Be sure that you satisfy these dependencies.

    Regards,
    Dan

     

     

     

     

     

  •  

    Hello Dan,

    Thank you for getting back.

    As I mentioned earlier, I am trying to create a client socket on the EVM that can connect to the PC to exchange image data which I plan to process on the EVM.

    With respect to function calls and include files, as of now I have very simple main () function which tries to call only socket () to create a socket. I do not use anyof the pipe functions.

    #include <stkmain.h>

    #include "fdt.h"

    #include <stdio.h>

    #include <string.h>

    #include "sockif.h"

     

     

     

    void main()

    {

         

          SOCKET s;

         

     

          s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

     

     

    }

    From the literature SPRU523G, I learnt that all NDK core libraries are prebuilt and provided in the release by default. Hence there is no need to add the source files into the project; just adding the appropriate .lib files would suffice (please correct me if I am wrong). Thus I removed the source files that I had added. (socket.c, file.c, etc.)

    SPRU523G also mentions that STACK.LIB, NETTOOL.LIB, OS.LIB and MiniPrintf.LIB, HAL.LIB, and NETCTRL.LIB are the five main libraries that make up the NDK.  Thus I added these library files and tried to build the project. But still I face the same problem. The error log is as mentioned below.

     

     undefined                                   first referenced                                                                                          

      symbol                                         in file                                                                                              

     ---------                                   ----------------                                                                                         

     _NC_NetStop                             /ndk/lib/C64plus/os.lib<ossys.o64P>         

     _NIMUDeviceTable                        /ndk/lib/C64plus/stack.lib<nimu.o64P>       

     _llTimerGetStartTime                   /ndk/lib/C64plus/os.lib<ossys.o64P>    

     _llTimerGetTime                        /ndk/lib/C64plus/os.lib<ossys.o64P>         

    _ti_sysbios_hal_Cache_wait__E            /ndk/lib/C64plus/os.lib<oem_bios6.o64P>     

     _ti_sysbios_hal_Cache_wbInv__E          /ndk/lib/C64plus/os.lib<oem_bios6.o64P>     

    _ti_sysbios_hal_Hwi_HwiProxy_disable__E /ndk/lib/C64plus/os.lib<oem_bios6.o64P>     

     _ti_sysbios_hal_Hwi_HwiProxy_restore__E     /ndk/lib/C64plus/os.lib<oem_bios6.o64P>     

     _ti_sysbios_knl_Semaphore_Object__create__S /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Semaphore_Object__delete__S /ndk/lib/C64plus/os.lib<semaphore_bios6.o64P>

     _ti_sysbios_knl_Semaphore_getCount__E       /ndk/lib/C64plus/os.lib<semaphore_bios6.o64P>

     _ti_sysbios_knl_Semaphore_pend__E           /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Semaphore_post__E           /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Semaphore_reset__E          /ndk/lib/C64plus/os.lib<semaphore_bios6.o64P>

     _ti_sysbios_knl_Task_Object__create__S      /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_Object__delete__S      /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_Params__init__S        /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_disable__E             /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_exit__E                /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_getHookContext__E      /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_getPri__E              /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_restore__E             /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_self__E                /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_setHookContext__E      /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_setPri__E              /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_sleep__E               /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _ti_sysbios_knl_Task_yield__E               /ndk/lib/C64plus/os.lib<task_bios6.o64P>    

     _xdc_runtime_Error_check__E                 /ndk/lib/C64plus/os.lib<semaphore_bios6.o64P>

     _xdc_runtime_Error_getMsg__E                /ndk/lib/C64plus/os.lib<mem_bios6.o64P>     

     _xdc_runtime_Error_init__E                  /ndk/lib/C64plus/os.lib<semaphore_bios6.o64P>

     _xdc_runtime_Memory_alloc__E                /ndk/lib/C64plus/os.lib<mem_bios6.o64P>     

     _xdc_runtime_Memory_free__E                 /ndk/lib/C64plus/os.lib<mem_bios6.o64P>     

     

    error: unresolved symbols remain

    error: errors encountered during linking; "socket_client.out" not built   

    Since these errors point towards the .lib files, I am not sure if adding individual lib files and building the project would solve the problem. (However I tried it without any luck).

    Since NDK operates on top of the DSP/BIOS RTOS, I added a target configuration file “ti.platforms.evm6472” corresponding to C6472 EVM. Do we need to make any changes in it to add the features of NDK?

    Chapter 2 of SPRU523G talks about the examples that use NDK. Surprisingly, there is no “examples” folder at all in my NDK install directory. I have reinstalled NDK couple of times. That didn’t work either. Is there any way that I could get an example project on which I can build an NDK client socket? That would really help as the example will have a default configuration setting specific to NDK.

    -Varun

     

  • Varun,

    Have you downloaded the entire MCSDK, or just the NDK?  The MCSDK has examples that are built on the NDK.  You can get it here:

    http://www.ti.com/tool/bioslinuxmcsdk

    The error messages that you are getting are telling you that there are symbols in the os.lib that aren't found.  Most of these are DSP/Bios symbols, so your project is not finding the Bios stuff properly.  Did you create this project form scratch?  Did you specify that it was going to be a DSP Bios project?

    Regards,

    Dan

     

  • Hello Dan,

    I had installed mcsdk_1_00_00_08 and also had a look at the the HPDSPUA demo. But was looking for simpler more specific examples.

    Yes I did create the project form scratch and used the DSP/BIOS v5.xx Examples -> Empty Example project template to make sure that the project would be a DSP/BIOS project. Then I went on adding the simple source file and tcf file mentioned above. 

    Please let me know if there are any simpler, specfic examples on which I can build my project.

    -Varun