I recently tried to setup the Eclipse TPTP Profiler on my two Linux boxes (Ubuntu 7.04 "Feisty Fawn" and 8.10 "Intrepid Ibex"). I thought this would only require installing some plugins from the Ganymede update site. I learned that the installation can be more complex on Linux systems.
The most problematic part of the TPTP Profiler installation was setting up the Agent Controller. The Agent Controller is a native binary and as we all know native code does not follow the philosophy "compile once, run everywhere"! :-)
After installing the the features "TPTP Tracing and Profiling Tools Project" and "TPTP Profiling for Web applications" from the Ganymede update site I restarted Eclipse and tried to profile a simple web application via "Profile as -> Profile on Server". Unfortunately this failed with:
[Error: FATAL ERROR: JPIAgent can't load ACCollector]
Basic troubleshooting procedure
To debug such problems I recommend to try starting the Agent Controller directly from the command line. This way you can easily find problems related to the agent controller. I decided to start the Agent Controller binary ACServer instead of the startup shell script ACStart.sh, because I didn't figure out which way Eclipse uses to execute the Agent Controller.
To start the Agent Controller from the command line you must find the directory of the Agent Controller bundle. For my Ganymede installation the process looks like this:
$ cd plugins/org.eclipse.tptp.platform.ac.linux_*/agent_controller/bin $ ./ACServer ./ACServer: error while loading shared libraries: libtptpUtils.so.4: cannot open shared object file: No such file or directory
Your first try will probably fail like in this example because of a missing shared library. The library libtptpUtils residents in the library directory of the agent controller. Eclipse will take care of setting the corresponding paths but as we are trying to start the Agent Controller from the command line, we have to perform this step to temporarily fix this problem for our test:
$ export LD_LIBRARY_PATH=../lib
If you are lucky, the Agent Controller now starts without any problems. But on my systems the execution failed for different reasons described in the following sections.
There seems to be a problem with symlink creation during the installation of the Agent Controller bundle. This bug showed up with Ubuntu 7.04 but not with Ubuntu 8.10.
$ ./ACServer ./ACServer: error while loading shared libraries: libtptpUtils.so.4: cannot open shared object file: File too short
On my system there was a regular file named libtptpUtils.so.4 which contained only the string libtptpUtils.so.4.5.0. Instead of creating symlinks the installation process seemed to create regular files which contain the name of the referenced file.
I fixed the problem by manually removing the broken files and creating the symlinks:
$ rm libtptpUtils.so libtptpUtils.so.4 $ ln -s libtptpUtils.so.4.5.0 libtptpUtils.so.4 $ ln -s libtptpUtils.so.4 libtptpUtils.so $ rm libxerces-c.so libxerces-c.so.26 $ ln -s libxerces-c.so.26.0 libxerces-c.so.26 $ ln -s libxerces-c.so.26 libxerces-c.so $ rm libxerces-depdom.so libxerces-depdom.so.26 $ ln -s libxerces-depdom.so.26.0 libxerces-depdom.so.26 $ ln -s libxerces-depdom.so.26 libxerces-depdom.so $ rm libtransportSupport.so libtransportSupport.so.4 $ ln -s libtransportSupport.so.4.5.0 libtransportSupport.so.4 $ ln -s libtransportSupport.so.4 libtransportSupport.so
Surprisingly this problem only showed up on my first try getting Eclipse and the TPTP Profiler to work. I tried to reproduce the problem with a clean Eclipse installation while working on this blog post. But the second time all symlinks were created successfully. This makes me suspect that the bug is fixed in the current TPTP releases.
Missing shared libraries
The Ubuntu 8.10 box showed another problem, that didn't occur on my old Ubuntu 7.04 installation:
$./ACServer ./ACServer: error while loading shared libraries: libstdc++-libc6.2-2.so.3: cannot open shared object file: No such file or directory
The Agent Controller requires an old libstdc++ library that wasn't installed on Ubuntu 8.10. Fixing this problem depends on the Linux distribution and its version. For Ubuntu 7.10 the library is contained in the "libstdc++2.10-glibc2.2" package, which was already installed. Ubuntu 8.10 is lacking a package containing this file. I fixed the problem by manually downloading a package from an older Ubuntu release:
$ cd /tmp $ wget "http://de.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-2.95/libstdc++2.10-glibc2.2_2.95.4-24_i386.deb" $ sudo dpkg -i libstdc++2.10-glibc2.2_2.95.4-24_i386.deb
Depending on your system there might by other libraries missing. The following list contains all shared library dependenies of the Agent Controller binary:
$ ldd ACServer linux-gate.so.1 => (0xffffe000) libtptpUtils.so.4 => ../lib/libtptpUtils.so.4 (0xb7f72000) libtptpLogUtils.so.4 => ../lib/libtptpLogUtils.so.4 (0xb7f65000) libtptpConfig.so.4 => ../lib/libtptpConfig.so.4 (0xb7f4b000) libprocessControlUtil.so.4 => ../lib/libprocessControlUtil.so.4 (0xb7f46000) libxerces-c.so.26 => ../lib/libxerces-c.so.26 (0xb7b3f000) libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7b12000) libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb79d1000) libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb79cd000) libuuid.so.1 => /lib/libuuid.so.1 (0xb79ca000) libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0xb7982000) libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb795a000) /lib/ld-linux.so.2 (0xb7f95000)
If some of these libraries are missing on your system you will have to find and install the corresponding packages. A Good place to start searching for packages is the Ubuntu Packages Search, the Debian Package Search, the Fedora Package Database or other distribution's package directories.
Missing TEMP environment variable
This problem was the easiest to solve. The Agent Controller complains about the missing environment variable TEMP.
$ ./ACServer The TEMP environment variable does not point to a valid directory. Agent Controller will not start.
As already hinted this problem can be solved easily. Just put this line in your .bashrc file:
It should be mentioned that I did not test whether Eclipse takes care of setting this variable for the Agent Controller process. But it does certainly no harm to set it manually.
If you don't stumble across other problems the Agent Controller should now start normally. In this case you won't see any output on the console.
$ ./ACServer <no console output>
Now you can stop the Agent Controller by hitting CTRL+C and retry profiling an application in Eclipse. On my system profiling in Eclipse now worked as expected.
The installation of the TPTP Profiler can be very problematic on a Linux box. I have presented solutions for the different problems I was confronted with. By reading this short blog post everyone should get an idea of the most common problems regarding the Agent Controller and which way to go to solve them.