undefined symbol

  • Chris

    Chris - 2013-02-03

    OK, now I could build the library, but when I try to use it I get:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/username/workspace/libUsbJava/libusbjava/trunk/LibusbJava/out/libusbJava-1.0.so.0.0.0: /home/username/workspace/libUsbJava/libusbjava/trunk/LibusbJava/out/libusbJava-1.0.so.0.0.0: undefined symbol: _Z18Usb_Device_connectP7JNIEnv_
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1750)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1675)
        at java.lang.Runtime.loadLibrary0(Runtime.java:840)
        at java.lang.System.loadLibrary(System.java:1047)
        at ch.ntb.usb.LibusbJava.<clinit>(LibusbJava.java:366)
        at libusbjava_examples.BusInfo.main(BusInfo.java:31)

    This appears when calling:

    Usb_Bus busses = LibusbJava.usb_get_busses();

    I'm on Ubuntu 12.04 (x64) and have installed the following packages:

  • uniederer

    uniederer - 2013-02-03


    Sorry, after your posting I realized that I messed up with the repo I am comitting to. It seems as if the upgrade of the project on sf created a new SVN repository copying the contents of the old one but did not remove the old repository.

    I now merged the commits from the old repo to the new one. Please checkout again, rebuild the library and retry.

    Thanks for your patience.

    • Chris

      Chris - 2013-02-09

      sorry for my late reply...
      Meanwhile I realized that there are two different svn repositories. One which is mentioned on the website:


      and the one in sourceforge:


      That's why I wasnt able to get the latest verison of build.xml the last time... :-)

      Now I used the sourceforge repo and after checking out I get the following message when I try to build:

      username@pc:~/workspace/libUsbJava2/trunk/LibusbJava$ ant linux
      Buildfile: /home/username/workspace/libUsbJava2/trunk/LibusbJava/build.xml
           [echo] Building Library
           [exec] /home/username/workspace/libUsbJava2/trunk/LibusbJava/objects/Usb_Device.cpp: In function »void Usb_Device_disconnect(JNIEnv*)«:
           [exec] /home/username/workspace/libUsbJava2/trunk/LibusbJava/objects/Usb_Device.cpp:88:35: Error: »memset« is not defined in this scope.
      /home/username/workspace/libUsbJava2/trunk/LibusbJava/build.xml:110: exec returned: 1
      Total time: 1 second

      (I translated the messages into English. So they might be slightly different)

      I also removed the dependency for "LibusbJava Test Linux" in the linux target of build.xml as we said the last time.

      Any ideas?

  • uniederer

    uniederer - 2013-02-10

    Yes. Had an idea: The function mentioned ("memset") is not declared to the compiler as #include <string.h> was missing. Don't know why the compile run worked for me. I expected that the compiler at most issues a warning.

    But anyway. Placed the include directive in the Usb_Device.cpp file. Please retry to build

    • Chris

      Chris - 2013-02-17

      Thanks uniederer! The build works now also on my machine. I have another problem, for which I will open a separate topic.


Log in to post a comment.