Problem starting VM from a thread
gback at cs.utah.edu
Fri Oct 30 23:08:47 PST 1998
What thread package are you using? Kaffe implements its own threads;
very likely that those won't be compatible with what you're using.
You should use gdb and see what's causing the segfault and look at the
You should consider using Kaffe's threading system for your threading,
and have Kaffe use the threading system you're using. Both might not
These comments mainly apply if what you're using is a user-level
If you're using Linux kernel threads (I'll admit I only know them from
hearsay), then we have a bug or at least something we should look at
fixing somewhere: I'd say Kaffe's internal threading should work with
> Hi all, I wonder if anyone can shed some light on this. I'm doing it on
> Linux x86 (both 2.0.36 and 2.1.126).
> I'm trying to start the VM from a thread (C code). What I did was taking
> the main.c of the kick off program, changing main() into some other function,
> e.g., KaffeMain(), and I added another function called StartEngine() which
> creates a thread and passes KaffeMain as the function argument. I made
> necessary changes to simulate the arguments being passed to KaffeMain().
> The main.c is compiled into a .so with (among others) the switches,
> -fPIC -shared -lkaffevm -lpthread
> StartEngine() itself is dlopen-ed and invoked by another main program. The
> process dies with a segmentation fault on the attempt to load the first
> class library; and here is the message I got by using the "-v" argument,
> Loading java/lang/Object.class(/usr/share/kaffe/Klasses.jar)
> [compressed]Segmentation fault (core dumped)
> The interesting thing is, if I call KaffeMain directly from StartEngine
> without creating a thread, the process still dies with the same message
> as long as both "-lkaffevm" and "-lpthread" (in either order) are used
> for compiling main.c; however if I only use "-lkaffevm", the process works
> fine. Does anyone have any idea what might have gone wrong? Is this the
> right way to dynamically start a VM from C and feed it some Java code?
> Is there any sample code (besides the main.c) that shows how to do this?
> Thanks in advance for any help.
More information about the kaffe