Friday, June 25, 2010

Diver in linux

Some people may be having difficulty with Diver in various distributions of linux. You may be getting the following message when trying to launch a trace.


And you may see this in the console:


Error occurred during initialization of VM
Could not find agent library in absolute path: /[path-to-plugin]/libsketch_linux32.so


Now, you may be surprised to find out that these errors may have nothing to do with open ports or whether or not the file listed exists. This is not Diver's fault. The client can't find an open port because the Java virtual machine couldn't start and open one. The Virtual machine couldn't start not because the listed library is missing but because you might not have some of the dependencies installed on your system. Unfortunately, the Java VM sometimes gives some pretty uninformative error messages.

Diver depends on the C++ boost libraries to do socket communication and multi-threading. It also uses boost to do multi-platform file system manipulation. Many distributions of linux come with boost installed. Some do not. If you have a debian-based version of linux, installing the required boost libraries is easy:

$ sudo apt-get install libboost-iostreams1.40.0 libboost-date-time1.40.0 libboost-filesystem1.40.0 libboost-system1.40.0 libboost-thread1.40.0

If you are running a redhat distro, you should be able to use a similar yum command. I hope that this all works for everyone.

8 comments:

  1. Some background information would be useful.

    What is Diver?
    What is boost?
    What is libsketch?

    ReplyDelete
  2. Hi joakime,

    This blog has a number of references to Diver, and a couple to boost. Diver is a suite of tools for reverse engineering Java in Eclipse. Boost is a set of standard C++ libraries for things like threading, i/o, and collections. Diver uses it for threading and socket communication. Check out these links:

    http://delaltctrl.blogspot.com/2009/11/use-case-for-reverse-engineering.html
    http://delaltctrl.blogspot.com/2009/11/use-case-for-reverse-engineering.html
    http://delaltctrl.blogspot.com/2010/01/diver-tutorial-videos-available.html
    http://delaltctrl.blogspot.com/2010/01/diver-010-released.html
    http://delaltctrl.blogspot.com/2010/05/new-version-of-diver-available-today.html

    ReplyDelete
  3. Hi. Thank you for this post, I'm enjoying this very same issue in my Eclipse Helios, running in a redhat 3.2 (very old) distro.

    I tried to download and compile the Boost++, but with no success, the error persists. I have a bunch of issues, and I do know where to start: The JVM is correctly pointed to the Boosted libs? The native libs was successfully generated?

    Do you know a command line Diver OR a command line that I can assure that the Booster is correctly installed? And do you know if those guys are planning to pack a solution for this, in future releases? =)

    Thank you and sorry for the poor English.

    ReplyDelete
  4. Hi Glaucio, There may also be a problem with linking to libgcc. I hope to have another minor release out by the end of the week that will fix the problem.

    ReplyDelete
  5. Hi Del, thank you for the reply. I will wait for the next Diver release. I am curious about, why we can't get the reverse engineer using the same native unix libs. I thought it uses the pure JVM (as a regular profiler do).

    ReplyDelete
  6. Hello,
    I installed Diver from Eclipse Marketplace and
    % ldd ca.uvic.chisel.tracing.jvmti.linux_0.2.0.201005181350/libsketch_linux32.so
    linux-gate.so.1 => (0xf777f000)
    libboost_system-mt.so.1.38.0 => not found
    libboost_date_time-mt.so.1.38.0 => not found
    libboost_filesystem-mt.so.1.38.0 => not found
    libboost_iostreams-mt.so.1.38.0 => not found
    libboost_thread-mt.so.1.38.0 => not found
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xf7616000)
    libm.so.6 => /lib/i686/cmov/libm.so.6 (0xf75f0000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf75d3000)
    libc.so.6 => /lib/i686/cmov/libc.so.6 (0xf748d000)
    /lib/ld-linux.so.2 (0xf7780000)

    boost 1.38.0 seems not to be available in any Debian repository, even stable has 1.42 (oldstable has 1.35).
    1.38 can be retrieved from snapshot.debian.org but it is not very convenient.
    I suppose eg. Fedora users may also have moved forward. Would it be possible to rerelease Diver linked to a newer boost?

    ReplyDelete
  7. I currently run fedora 14 on a 64 bit machine. I failed to launch an application trace and according to the error message and the files I was looking up Diver currently only works with 32 bit linux distros. right? Do I miss something?

    ReplyDelete
  8. same problem in windows 7 64 bits :

    Error occurred during initialization of VM
    Could not find agent library in absolute path: D:\Work\sts\plugins\ca.uvic.chisel.tracing.jvmti.win32_0.5.0.201209242308\sketch_win64.dll

    ReplyDelete