Multiple method definition errors building GCJ 3.3

Ranjit Mathew rmathew@hotmail.com
Wed Dec 18 11:41:00 GMT 2002


Hi,

     While building a cross-compiler for MinGW from the latest GCC 3.3
snapshots, I'm running into a weird problem while building the final
library (libgcj.a) - some of the methods are being flagged as being
defined multiple times in different executables. I'm attaching the
error messages I get towards the end of this mail for your reference.

Trying to figure out the cause of this error, I noticed that they
were being thrown for methods that were defined inline in gcjh
generated headers like "java/lang/String.h", etc. I don't know
C++ properly, but it seems that these methods are not being
inlined for some reason even though almost all of them are
trivial "return foo;" type methods.

Should gcjh explicitly mark them "inline"? Why doesn't this
problem come up on other platforms? What can I do to overcome
these errors?

Thanks for your help in advance.

Sincerely Yours,
Ranjit.

------------------------------------ 8< -------------------------------------
./.libs/libgcj.a(String.o)(.text+0x66e):String.java: multiple definition of 
`java::lang::String::length()'
./.libs/libgcj.a(prims.o)(.text$_ZN4java4lang6String6lengthEv+0x0):prims.cc: first defined here
./.libs/libgcj.a(natThread.o)(.text$_ZN4java4lang11ThreadGroup7getNameEv+0x0):natThread.cc: multiple 
definition of `java::lang::ThreadGroup::getName()'
./.libs/libgcj.a(ThreadGroup.o)(.text+0x26a):ThreadGroup.java: first defined here
./.libs/libgcj.a(natThread.o)(.text$_ZN4java4lang11ThreadGroup14getMaxPriorityEv+0x0):natThread.cc: 
multiple definition of `java::lang::ThreadGroup::getMaxPriority()'
./.libs/libgcj.a(ThreadGroup.o)(.text+0x2b0):ThreadGroup.java: first defined here
./.libs/libgcj.a(Thread.o)(.text+0x170):Thread.java: multiple definition of 
`java::lang::Thread::getName()'
./.libs/libgcj.a(natThread.o)(.text$_ZN4java4lang6Thread7getNameEv+0x0):natThread.cc: first defined here
./.libs/libgcj.a(Thread.o)(.text+0x17c):Thread.java: multiple definition of 
`java::lang::Thread::getPriority()'
./.libs/libgcj.a(win32-threads.o)(.text$_ZN4java4lang6Thread11getPriorityEv+0x0):win32-threads.cc: 
first defined here
./.libs/libgcj.a(Thread.o)(.text+0x188):Thread.java: multiple definition of 
`java::lang::Thread::getThreadGroup()'
./.libs/libgcj.a(natThread.o)(.text$_ZN4java4lang6Thread14getThreadGroupEv+0x0):natThread.cc: first 
defined here
./.libs/libgcj.a(Thread.o)(.text+0x1e8):Thread.java: multiple definition of 
`java::lang::Thread::isAlive()'
./.libs/libgcj.a(natThread.o)(.text$_ZN4java4lang6Thread7isAliveEv+0x0):natThread.cc: first defined here
./.libs/libgcj.a(Thread.o)(.text+0x1f8):Thread.java: multiple definition of 
`java::lang::Thread::isDaemon()'
./.libs/libgcj.a(win32-threads.o)(.text$_ZN4java4lang6Thread8isDaemonEv+0x0):win32-threads.cc: first 
defined here
./.libs/libgcj.a(natMethod.o)(.text$_ZN4java4lang7Boolean12booleanValueEv+0x0):natMethod.cc: 
multiple definition of `java::lang::Boolean::booleanValue()'
./.libs/libgcj.a(Boolean.o)(.text+0x72):Boolean.java: first defined here
./.libs/libgcj.a(Character.o)(.text+0x20e6):Character.java: multiple definition of 
`java::lang::Character::charValue()'
./.libs/libgcj.a(natMethod.o)(.text$_ZN4java4lang9Character9charValueEv+0x0):natMethod.cc: first 
defined here
./.libs/libgcj.a(natVMSecurityManager.o)(.text$_ZN3gnu3gcj7runtime10StackTrace6lengthEv+0x0):natVMSecurityManager.cc: 
multiple definition of `gnu::gcj::runtime::StackTrace::length()'
./.libs/libgcj.a(StackTrace.o)(.text+0x74):StackTrace.java: first defined here
./.libs/libgcj.a(natField.o)(.text$_ZN4java4lang7reflect5Field17getDeclaringClassEv+0x0):natField.cc: 
multiple definition of `java::lang::reflect::Field::getDeclaringClass()'
./.libs/libgcj.a(Field.o)(.text+0xc4):Field.java: first defined here
./.libs/libgcj.a(Locale.o)(.text+0x1452):Locale.java: multiple definition of 
`java::util::Locale::getLanguage()'
./.libs/libgcj.a(natString.o)(.text$_ZN4java4util6Locale11getLanguageEv+0x0):natString.cc: first 
defined here
./.libs/libgcj.a(natPlainSocketImpl.o)(.text$_ZN4java3net17InetSocketAddress7getPortEv+0x0):natPlainSocketImpl.cc: 
multiple definition of `java::net::InetSocketAddress::getPort()'
./.libs/libgcj.a(InetSocketAddress.o)(.text+0x30a):InetSocketAddress.java: first defined here
./.libs/libgcj.a(natPlainSocketImpl.o)(.text$_ZN4java3net17InetSocketAddress10getAddressEv+0x0):natPlainSocketImpl.cc: 
multiple definition of `java::net::InetSocketAddress::getAddress()'
./.libs/libgcj.a(InetSocketAddress.o)(.text+0x2f2):InetSocketAddress.java: first defined here
make[2]: *** [jv-convert.exe] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-target-libjava] Error 2
------------------------------------ 8< -------------------------------------
-- 
Ranjit Mathew        Email: rmathew AT hotmail DOT com
Bangalore,
INDIA.               Web: http://ranjitmathew.tripod.com/





More information about the Java mailing list