This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

g++ compiled programs that link with Java Hotspot core dump


GCC guys,

I'm having a problem linking the Java HotSpot VM in with a g++ compiled
program.  Basically, any program (however simple) that gets linked with
the Java HotSpot VM (-ljvm) core dumps at initialization.  I've included
a quick example of the problem below:

warplan (47) % java -version
java version "1.3beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O)
Java(TM) HotSpot Client VM (build 1.3beta-O-release, 1.3beta-O-release,
interpreted mode)

warplan (48) % gcc -v
Reading specs from
/wsproj/users/lnmc/externals/GNU/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs

gcc version 2.95.2 19991024 (release)

warplan (49) % cat hello_world.cpp
#include <iostream>

main()
{
        std::cout << "hello world!" << std::endl;
}

warplan (50) % g++ hello_world.cpp

warplan (51) % a.out
hello world!

warplan (52) % g++ hello_world.cpp -ljvm

warplan (53) % a.out
Bus error (core dumped)

warplan (54) % gdb a.out
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "sparc-sun-solaris2.6"...
(gdb) run
Starting program: /a/warsun/nis1/home/mnewcomb/src/c++/hello_world/a.out

warning: Lowest section in /usr/lib/libw.so.1 is .dynamic at 0x74
[New LWP    2        ]
[New LWP    3        ]
[New LWP    4        ]

Program received signal SIGBUS, Bus error.
0xeef4521c in __0fKunsafe_iosEinitP6Jstreambuf ()
(gdb) where
#0  0xeef4521c in __0fKunsafe_iosEinitP6Jstreambuf ()
#1  0xeef4c9b4 in __0oSistream_withassignasP6Jstreambuf ()
#2  0xeef469a0 in __0oNIostream_initctv ()
#3  0xeef63174 in _init ()
#4  0xeefc9f58 in ?? ()
#5  0xeefc9e10 in ?? ()
#6  0xeefd15dc in ?? ()
#7  0xeefc2d44 in ?? ()
(gdb)

Any ideas?  I'm not a debugging guru, but it seems that the this is
occurring within the static initializer of the jvm library.  If that is
true, I'm not sure what you guys can do about it, but just thought I
would run it by you guys as well.  I'm also sending this to Sun.

Thanks,
Michael


BTW, why does iso646.h have "#ifndef __cplusplus"?  You want those
defines when you are compiling c++....???



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]