[CMake] Cmake : undefined reference to `udev_device_get_devnode'

Nikita Barawade nikita.barawade at einfochips.com
Fri Nov 20 07:39:23 EST 2015



Dear All,



I am building an application using cmake with external shared library libLLAPI.so on Ububtu .


I am getting following error:


make -f Source/CMakeFiles/app.dir/build.make Source/CMakeFiles/app.dir/build
make[2]: Entering directory `/home/nikita/intel/CMake_intel/API/Build/Cmake/LLAPI_TestApp/Build'
Linking CXX executable app
cd /home/nikita/intel/CMake_intel/API/Build/Cmake/LLAPI_TestApp/Build/Source && /usr/bin/cmake -E cmake_link_script CMakeFiles/app.dir/link.txt --verbose=1
/usr/bin/c++       CMakeFiles/app.dir/__/Include/moc_cansettings.cxx.o CMakeFiles/app.dir/__/Include/moc_Logfile.cxx.o CMakeFiles/app.dir/__/Include/moc_SpmGui.cxx.o CMakeFiles/app.dir/main.cpp.o CMakeFiles/app.dir/AllModule.cpp.o CMakeFiles/app.dir/analogmeasure.cpp.o CMakeFiles/app.dir/Can.cpp.o CMakeFiles/app.dir/cansettings.cpp.o CMakeFiles/app.dir/ccTalk.cpp.o CMakeFiles/app.dir/Channel.cpp.o CMakeFiles/app.dir/Common.cpp.o CMakeFiles/app.dir/Dex.cpp.o CMakeFiles/app.dir/Fan.cpp.o CMakeFiles/app.dir/Firmware.cpp.o CMakeFiles/app.dir/Gpio.cpp.o CMakeFiles/app.dir/I2c.cpp.o CMakeFiles/app.dir/LocalPortI2C.cpp.o CMakeFiles/app.dir/LocalPortSerial.cpp.o CMakeFiles/app.dir/Logfile.cpp.o CMakeFiles/app.dir/Mdb.cpp.o CMakeFiles/app.dir/Motor.cpp.o CMakeFiles/app.dir/Onewire.cpp.o CMakeFiles/app.dir/PowerModule.cpp.o CMakeFiles/app.dir/protocolA.cpp.o CMakeFiles/app.dir/rtc.cpp.o CMakeFiles/app.dir/SafeMem.cpp.o CMakeFiles/app.dir/Serial.cpp.o CMakeFiles/app.dir/SevenSegment.cpp.o CMakeFiles/app.dir/Spi.cpp.o CMakeFiles/app.dir/SpmGui.cpp.o CMakeFiles/app.dir/ThreadProcess.cpp.o CMakeFiles/app.dir/USBRelayModule.cpp.o CMakeFiles/app.dir/WriteFile.cpp.o CMakeFiles/app.dir/app_automoc.cpp.o  -o app -rdynamic -lQtGui -lQtCore ../../../LLAPI/build/Source/libLLAPI.so -Wl,-rpath,/home/nikita/intel/CMake_intel/API/Build/Cmake/LLAPI_TestApp/Build/../../LLAPI/build/Source
CMakeFiles/app.dir/SpmGui.cpp.o: In function `SpmGui::pbPushSelectClicked()':
SpmGui.cpp:(.text+0x3904): undefined reference to `llapiVersionRead'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_device_get_devnode'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_device_new_from_syspath'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_device_unref'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_enumerate_get_list_entry'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_enumerate_add_match_subsystem'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_enumerate_scan_devices'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_device_get_sysattr_value'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_device_new_from_devnum'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_device_get_parent_with_subsystem_devtype'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_unref'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_list_entry_get_name'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_enumerate_new'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_list_entry_get_next'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_new'
../../../LLAPI/build/Source/libLLAPI.so: undefined reference to `udev_enumerate_unref'
collect2: error: ld returned 1 exit status
make[2]: *** [Source/app] Error 1
make[2]: Leaving directory `/home/nikita/intel/CMake_intel/API/Build/Cmake/LLAPI_TestApp/Build'
make[1]: *** [Source/CMakeFiles/app.dir/all] Error 2
make[1]: Leaving directory `/home/nikita/intel/CMake_intel/API/Build/Cmake/LLAPI_TestApp/Build'
make: *** [all] Error 2


Before this, while building a library libLLAPI.so I got error " fatal error: libudev.h: No such file or directory" .

It worked fine after installing libudev-dev .


CmakeList.txt  for app:

include_directories (../../../Lib/LLAPI/Include)
include_directories (../Include)
include_directories (../../LLAPI/Include)
include_directories (../../../Build/Cmake/LLAPI_TestApp/Build/Source)

QT4_WRAP_UI(UISrcs ../Form/cansettings.ui ../Form/Logfile.ui ../Form/ssbGui.ui)
QT4_WRAP_CPP(MOCSrcs ../Include/cansettings.h ../Include/Logfile.h ../Include/ssbGui.h)

add_library(LLAPI SHARED IMPORTED)
set_property(TARGET LLAPI PROPERTY IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/../../LLAPI/build/Source/libLLAPI.so)

add_executable (app ${UISrcs} ${MOCSrcs} main.cpp cansettings.cpp Logfile.cpp ssbGui.cpp)

target_link_libraries (app ${QT_LIBRARIES} LLAPI)
#target_link_libraries (app ${QT_LIBRARIES} Qt4::QtGui Qt4::QtXml LLAPI)

install (TARGETS app RUNTIME DESTINATION ${PROJECT_BINARY_DIR}/lib)


Searched on Internet for solution but could not fix it.

Please guide .



Regards,
Nikita
************************************************************************************************************************************************************* eInfochips Business Disclaimer: This e-mail message and all attachments transmitted with it are intended solely for the use of the addressee and may contain legally privileged and confidential information. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by replying to this message and please delete it from your computer. Any views expressed in this message are those of the individual sender unless otherwise stated. Company has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email. *************************************************************************************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151120/8fd4fbc2/attachment.html>


More information about the CMake mailing list