undefined reference to function nanomsg

310 views Asked by At

Treating as Server code:

  1. I have created an shared library,which contains nanomsg package functionality.
  2. Adding DEPENDS += "nanomsg" in bb file. (Without this <nanomsg/*.h> gives "no such file are directory" errors).
  3. Server will send some data to client via shared library(using nanomsg IPC).

Treating as Stand alone application code:

  1. Application code calls the shared lib functionality, such that recieves data from server.

  2. Uses target_link_libraries for the shared library and include directories.

  3. while using bitbake

    .. undefined reference 'nn_send' ... nn_socket  ld: exit 1 status issues are
    

    seen.

Please help me on this.

CMakeList.txt:

  1. nanomsg code path in project dir:

    include_directories(${XXXXX_SRC}thirdparty/nanomsg/src)
    
  2. shared lib created in other project dir:

    include_directories(${CMAKE_SOURCE_DIR}/xxxxx)
    

Test app name - nn_client:

3.

set(
   COMPONENT_EXECUTABLE_NN_CLI
   "nn_client"
)

Linking the shared lib with my source file

4.

target_link_libraries(${COMPONENT_EXECUTABLE_NN_CLI}
                 ptpnnmsg
                ${EXTRA_LIBS}

)

  1. Since above one is not working added below one as an addon - where sharednnmsg located.

    target_link_libraries(${COMPONENT_EXECUTABLE_NN_CLI} -L/../../../xxx/)
    
  2.  install(TARGETS ${COMPONENT_EXECUTABLE_NN_CLI}
         DESTINATION ${CMAKE_INSTALL_BINDIR})
    

Instead of point-6 as above tried as

install(TARGETS nn_client
       RUNTIME DESTINATION bin
)

errors while doing bitbake:

../../../../xxxx/libptpnnmsg.so: undefined reference to `nn_recv'
../../../../xxxx/libptpnnmsg.so: undefined reference to `nn_freemsg'
../../../../xxxx/libptpnnmsg.so: undefined reference to `nn_bind'
../../../../xxxx/libptpnnmsg.so: undefined reference to `nn_shutdown'
../../../../xxxx/libptpnnmsg.so: undefined reference to `nn_send'
../../../../xxxx/libptpnnmsg.so: undefined reference to `nn_connect'
../../../../xxxx/libptpnnmsg.so: undefined reference to `nn_socket'
../../../../xxxx/libptpnnmsg.so: undefined reference to `nn_strerror'
../../../../xxxx/libptpnnmsg.so: undefined reference to `nn_errno'
0

There are 0 answers