06 April 2015

Compiling Ericsson CXP_MBM_Tools_Development_Kit


We use a modem chipset from Ericsson. Ericsson has left this business so their engineering support is somewhat less than totally awesome. Perhaps you have the CXP_MBM_Tools_Development_Kit in your hot little hands and would like to make it compile under recent versions of gcc. (Note that if you do not have this kit, I cannot help you.) If you try to build under Ubuntu 14.04 it will fail with an error like:

Linking C executable out/mtool
/yocto/sources/CXP_MBM_Tools_Development_Kit/build/ecp/out/libecp.so: undefined reference to `dlopen'
/yocto/sources/CXP_MBM_Tools_Development_Kit/build/ecp/out/libecp.so: undefined reference to `dlclose'
/yocto/sources/CXP_MBM_Tools_Development_Kit/build/ecp/out/libecp.so: undefined reference to `dlerror'
/yocto/sources/CXP_MBM_Tools_Development_Kit/build/ecp/out/libecp.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status

Per this post, changes to the "strictness" of shared libraries requires that you call -ldl after the desired shared libraries rather than before. #THANKS OBAMA.

There's probably a better way to do it than this, but this will suffice:

IN CXC_Manufacturing_Tool/src/CMakeLists.txt:


-  set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} " -ldl -Wl,-rpath=./")
+  set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} " -Wl,-rpath=./")

-  target_link_libraries(${TARGET_NAME} ${LIBRARY_LIST} ${CMAKE_THREAD_LIBS_INIT})
+  target_link_libraries(${TARGET_NAME} ${LIBRARY_LIST} ${CMAKE_THREAD_LIBS_INIT} -ldl)