Menu

#51 Linking error

v1.0_(example)
closed
nobody
None
1
2015-06-02
2015-05-24
No

Getting this error:

[....]
[ 99%] Built target roccatkoneconfig
[ 99%] Built target roccatkonecontrol
Linking C shared library libkoneeventhandler.so
../../libroccathelper/libroccathelper.a(g_udev_roccat_helper.c.o): In function g_udev_roccat_get_parent_hid_device': g_udev_roccat_helper.c:(.text.g_udev_roccat_get_parent_hid_device+0x8): undefined reference tog_udev_device_get_subsystem'
g_udev_roccat_helper.c:(.text.g_udev_roccat_get_parent_hid_device+0x13): undefined reference to g_udev_device_get_devtype' g_udev_roccat_helper.c:(.text.g_udev_roccat_get_parent_hid_device+0x4c): undefined reference tog_udev_device_get_parent_with_subsystem'
../../libroccathelper/libroccathelper.a(g_udev_roccat_helper.c.o): In function g_udev_roccat_get_parent_usbhid_device': g_udev_roccat_helper.c:(.text.g_udev_roccat_get_parent_usbhid_device+0x8): undefined reference tog_udev_device_get_subsystem'
g_udev_roccat_helper.c:(.text.g_udev_roccat_get_parent_usbhid_device+0x13): undefined reference to g_udev_device_get_devtype' g_udev_roccat_helper.c:(.text.g_udev_roccat_get_parent_usbhid_device+0x56): undefined reference tog_udev_device_get_parent_with_subsystem'
../../libroccathelper/libroccathelper.a(g_udev_roccat_helper.c.o): In function g_udev_roccat_get_parent_usb_device': g_udev_roccat_helper.c:(.text.g_udev_roccat_get_parent_usb_device+0x8): undefined reference tog_udev_device_get_subsystem'
g_udev_roccat_helper.c:(.text.g_udev_roccat_get_parent_usb_device+0x13): undefined reference to g_udev_device_get_devtype' g_udev_roccat_helper.c:(.text.g_udev_roccat_get_parent_usb_device+0x56): undefined reference tog_udev_device_get_parent_with_subsystem'
../../libroccathelper/libroccathelper.a(g_udev_roccat_helper.c.o): In function g_udev_roccat_usb_get_vendor_id': g_udev_roccat_helper.c:(.text.g_udev_roccat_usb_get_vendor_id+0xc): undefined reference tog_udev_device_get_sysfs_attr'
../../libroccathelper/libroccathelper.a(g_udev_roccat_helper.c.o): In function g_udev_roccat_usb_get_device_id': g_udev_roccat_helper.c:(.text.g_udev_roccat_usb_get_device_id+0xc): undefined reference tog_udev_device_get_sysfs_attr'
../../libroccathelper/libroccathelper.a(g_udev_roccat_helper.c.o): In function g_udev_roccat_usb_get_num_interfaces': g_udev_roccat_helper.c:(.text.g_udev_roccat_usb_get_num_interfaces+0xc): undefined reference tog_udev_device_get_sysfs_attr_as_uint64'
../../libroccathelper/libroccathelper.a(g_udev_roccat_helper.c.o): In function g_udev_roccat_usbhid_get_interfaceprotocol': g_udev_roccat_helper.c:(.text.g_udev_roccat_usbhid_get_interfaceprotocol+0xc): undefined reference tog_udev_device_get_sysfs_attr_as_uint64'
../../libroccathelper/libroccathelper.a(g_udev_roccat_helper.c.o): In function g_udev_roccat_usbhid_get_interfacenumber': g_udev_roccat_helper.c:(.text.g_udev_roccat_usbhid_get_interfacenumber+0xc): undefined reference tog_udev_device_get_sysfs_attr_as_uint64'
../../libroccathelper/libroccathelper.a(g_udev_roccat_helper.c.o): In function g_udev_roccat_device_is_sibling': g_udev_roccat_helper.c:(.text.g_udev_roccat_device_is_sibling+0xb): undefined reference tog_udev_device_get_devtype'
g_udev_roccat_helper.c:(.text.g_udev_roccat_device_is_sibling+0x16): undefined reference to g_udev_device_get_subsystem' g_udev_roccat_helper.c:(.text.g_udev_roccat_device_is_sibling+0x24): undefined reference tog_udev_device_get_parent_with_subsystem'
g_udev_roccat_helper.c:(.text.g_udev_roccat_device_is_sibling+0x3a): undefined reference to g_udev_device_get_name' g_udev_roccat_helper.c:(.text.g_udev_roccat_device_is_sibling+0x45): undefined reference tog_udev_device_get_name'
collect2: error: ld returned 1 exit status
kone/libkoneeventhandler/CMakeFiles/libkoneeventhandler.dir/build.make:142: recipe for target 'kone/libkoneeventhandler/libkoneeventhandler.so' failed
make[2]: *** [kone/libkoneeventhandler/libkoneeventhandler.so] Error 1
CMakeFiles/Makefile2:6222: recipe for target 'kone/libkoneeventhandler/CMakeFiles/libkoneeventhandler.dir/all' failed
make[1]: *** [kone/libkoneeventhandler/CMakeFiles/libkoneeventhandler.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
make: *** [all] Error 2
`````

Discussion

  • Stefan Achatz

    Stefan Achatz - 2015-05-24

    Couldn't reproduce, need more context. Please give at least the version of libgudev that you have installed. What does the output of

    grep GUDEV_LIBRARIES CMakeCache.txt
    

    issued in the build folder say?

     
  • Aaron Mueller

    Aaron Mueller - 2015-05-24

    Version of libgudev:
    49914:libsystemd /usr/lib/libgudev-1.0.so
    49915:libsystemd /usr/lib/libgudev-1.0.so.0
    49916:libsystemd /usr/lib/libgudev-1.0.so.0.2.0

    Output of grep GUDEV_LIBRARIES CMakeCache.txt in the sourcedir:
    237:GUDEV_LIBRARIES:FILEPATH=/usr/lib64/libgudev-1.0.so
    936:PKG_GUDEV_LIBRARIES:INTERNAL=gudev-1.0;gobject-2.0;glib-2.0

    /usr/lib64 is a symlink to /usr/lib on ArchLinux.

     
  • Stefan Achatz

    Stefan Achatz - 2015-05-24

    What's your cmake version?
    What does the following command give you (inside the build folder)?

    readelf -d kone/libroccatkone/libroccatkone.so.3.4.0 | grep \(NEEDED\)
    

    Another thing I would like to see (inside the build folder):
    Call

    ccmake .
    

    Press t to view all variables and change the variable CMAKE_VERBOSE_MAKEFILE to ON by pressing enter.
    Press c and g.
    Then issue make again and give me the commandline of the last command that is issued before the errors come up.

    After that, maybe the following patch helps as a quick'n'dirty fix before the real reason is found?

    diff --git a/kone/libkoneeventhandler/CMakeLists.txt b/kone/libkoneeventhandler/CMakeLists.txt
    index d460bba..f633e92 100644
    --- a/kone/libkoneeventhandler/CMakeLists.txt
    +++ b/kone/libkoneeventhandler/CMakeLists.txt
    @@ -21,6 +21,7 @@ TARGET_LINK_LIBRARIES(libkoneeventhandler
       libroccathelper
       ${GAMINGGEAR0_LIBRARY}
       ${DBUS-GLIB_LIBRARIES}
    
    +  ${GUDEV_LIBRARIES}
       ${GLIB2_LIBRARIES}
     )
    
     
  • Aaron Mueller

    Aaron Mueller - 2015-05-24

    $ readelf -d kone/libroccatkone/libroccatkone.so.3.4.0 | grep (NEEDED)
    4: 0x0000000000000001 (NEEDED) Shared library: [libroccat.so.3]
    5: 0x0000000000000001 (NEEDED) Shared library: [libdbus-glib-1.so.2]
    6: 0x0000000000000001 (NEEDED) Shared library: [libgaminggear.so.0]
    7: 0x0000000000000001 (NEEDED) Shared library: [libgudev-1.0.so.0]
    8: 0x0000000000000001 (NEEDED) Shared library: [libglib-2.0.so.0]
    9: 0x0000000000000001 (NEEDED) Shared library: [libgobject-2.0.so.0]
    10: 0x0000000000000001 (NEEDED) Shared library: [libc.so.6]

    After setting the verbosity level:
    [...]
    cd /home/aaron/workspace/aur-packages/roccat-tools/src/roccat-tools-3.4.0/kone/libkoneeventhandler && /usr/bin/cmake -E cmake_link_script CMakeFiles/libkoneeventhandler.dir/link.txt --verbose=1
    /usr/bin/cc -fPIC -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -fmessage-length=0 -Wall -D_GNU_SOURCE -O3 -DNDEBUG -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT -Wl,-O1,--sort-common,--as-needed,-z,relro -Wl,--no-undefined -Wl,--as-needed -shared -Wl,-soname,libkoneeventhandler.so -o libkoneeventhandler.so CMakeFiles/libkoneeventhandler.dir/kone_dbus_server.c.o CMakeFiles/libkoneeventhandler.dir/kone_eventhandler.c.o CMakeFiles/libkoneeventhandler.dir/kone_eventhandler_channel.c.o ../libroccatkone/libroccatkone.so.3.4.0 ../../libroccathelper/libroccathelper.a -lgaminggear -ldbus-glib-1 -lglib-2.0 -lgobject-2.0 ../../libroccat/libroccat.so.3.4.0 -Wl,-rpath,/home/aaron/workspace/aur-packages/roccat-tools/src/roccat-tools-3.4.0/kone/libroccatkone:/home/aaron/workspace/aur-packages/roccat-tools/src/roccat-tools-3.4.0/libroccat:
    [...error message...]

    The patch works, thanks!
    I've added it to the roccat-tools package (ArchLinux) until the issus is found.

     
  • Stefan Achatz

    Stefan Achatz - 2015-06-02
    • status: open --> closed
     
  • Stefan Achatz

    Stefan Achatz - 2015-06-02

    This was caused by cmake changing handling of link libraries in the linker command. The final patch:

    diff --git a/kone/libkoneeventhandler/CMakeLists.txt b/kone/libkoneeventhandler/CMakeLists.txt
    index d460bba..60c38a3 100644
    --- a/kone/libkoneeventhandler/CMakeLists.txt
    +++ b/kone/libkoneeventhandler/CMakeLists.txt
    @@ -17,8 +17,8 @@ SET_TARGET_PROPERTIES(libkoneeventhandler
    
     TARGET_LINK_LIBRARIES(libkoneeventhandler
       libroccat
    
    -  libroccatkone
       libroccathelper
    +  libroccatkone
       ${GAMINGGEAR0_LIBRARY}
       ${DBUS-GLIB_LIBRARIES}
       ${GLIB2_LIBRARIES}
    
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB