This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-static causes errors


I'm running into the same problem as the post below.  When I try to compile 
a simple Java program, it works fine.  But, if I try to make a static
executable, I get many errors just as described below.  Is -static broken
under gcc version 3.2?  If so, what steps do I need to take to ship my 
executable to another Linux box with an older version of gcc (it has 2.95)?  I 
tried copying over the libgcj.so file, setting my LD_LIBRARY_PATH to point to it,
but, I still received error.  I can give my specifics errors if necessary,
but I'm not entirely sure what I'm doing is correct.

Thanks,
Chris

---------------

Hello:

I am a newbie to gcj, so please forgive any obvious questions.
I searched the mailing list archives to no avail.

I am using the gcj that was installed when I installed RedHat 8.0
on an new machine.

gcj -v give me this:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.spec
rename spec lib to liborig
Configured with:
../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
 --enable-shared --enable-threads=posix --disable-checking --host=i386-redha
t-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)

When I try to compile a simple Java app using this command line, everything
works fine:
gcj -O3 --no-bounds-check --no-store-check --main=VPAnalyzer
VPAnalyzer.java -oVPAnalyzer

But, if I try to make a static executable using this command line:
gcj -O3 -static --no-bounds-check --no-store-check --main=VPAnalyzer
VPAnalyzer.java -oVPAnalyzer


I get these errors:
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(jni.o): In function
`_Jv_JNI_AttachCurrentThread(_Jv_JavaVM*, java::lang::String*, void**,
void*)':
jni.o(.text+0x2353): undefined reference to `pthread_getspecific'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(jni.o): In function
`_Jv_JNI_DestroyJavaVM(_Jv_JavaVM*)':
jni.o(.text+0x23df): undefined reference to `pthread_getspecific'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(jni.o): In function
`_Jv_JNI_GetEnv(_Jv_JavaVM*, void**, int)':
jni.o(.text+0x248b): undefined reference to `pthread_getspecific'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(jni.o): In function
`_Jv_GetJavaVM()':
jni.o(.text+0x26e8): undefined reference to `pthread_getspecific'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(natThread.o): In function
`java::lang::Thread::currentThread()':
natThread.o(.text+0xff): undefined reference to `pthread_getspecific'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(natThread.o)(.text+0x9df):
more undefined references to `pthread_getspecific' follow
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(posix-threads.o): In
function `_Jv_ThreadInterrupt(_Jv_Thread_t*)':
posix-threads.o(.text+0x393): undefined reference to `pthread_kill'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(posix-threads.o): In
function `_Jv_InitThreads()':
posix-threads.o(.text+0x3e2): undefined reference to `pthread_key_create'
posix-threads.o(.text+0x3f6): undefined reference to `pthread_key_create'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(posix-threads.o): In
function `_Jv_ThreadRegister(_Jv_Thread_t*)':
posix-threads.o(.text+0x55a): undefined reference to `pthread_setspecific'
posix-threads.o(.text+0x56b): undefined reference to `pthread_setspecific'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(posix-threads.o): In
function `_Jv_ThreadUnRegister()':
posix-threads.o(.text+0x5d7): undefined reference to `pthread_setspecific'
posix-threads.o(.text+0x5ec): undefined reference to `pthread_setspecific'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(linux_threads.o): In
function `GC_suspend_handler':
linux_threads.o(.text+0x55): undefined reference to `sem_post'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(linux_threads.o): In
function `GC_stop_world':
linux_threads.o(.text+0x456): undefined reference to `sem_wait'
linux_threads.o(.text+0x490): undefined reference to `pthread_kill'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(linux_threads.o): In
function `GC_start_world':
linux_threads.o(.text+0x54c): undefined reference to `pthread_kill'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(linux_threads.o): In
function `GC_thr_init':
linux_threads.o(.text+0x7d0): undefined reference to `sem_init'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(linux_threads.o): In
function `GC_pthread_sigmask':
linux_threads.o(.text+0xa43): undefined reference to `pthread_sigmask'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(linux_threads.o): In
function `GC_pthread_join':
linux_threads.o(.text+0xcef): undefined reference to `pthread_join'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(linux_threads.o): In
function `GC_pthread_detach':
linux_threads.o(.text+0xd88): undefined reference to `pthread_detach'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(linux_threads.o): In
function `GC_start_routine':
linux_threads.o(.text+0xe6b): undefined reference to `sem_post'
linux_threads.o(.text+0xe8b): undefined reference to `_pthread_cleanup_push'
linux_threads.o(.text+0xeb4): undefined reference to `_pthread_cleanup_pop'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcj.a(linux_threads.o): In
function `GC_pthread_create':
linux_threads.o(.text+0xf55): undefined reference to `sem_init'
linux_threads.o(.text+0xfe7): undefined reference to `pthread_create'
linux_threads.o(.text+0xff4): undefined reference to `sem_wait'
linux_threads.o(.text+0x1014): undefined reference to `sem_destroy'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcc_eh.a(unwind-dw2.o): In
function `uw_install_context_1':
/usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/gcc/
../../gcc/gthr-posix.h:82: undefined reference to `pthread_create'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcc_eh.a(unwind-dw2.o): In
function `size_of_encoded_value':
/usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/gcc/
../../gcc/unwind-pe.h:61: undefined reference to `pthread_create'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcc_eh.a(unwind-dw2-fde-glibc.o):
In function `__register_frame_info_bases':
/usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/gcc/
../../gcc/gthr-posix.h:83: undefined reference to `pthread_create'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcc_eh.a(unwind-dw2-fde-glibc.o):
In function `__register_frame_info_table_bases':
/usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/gcc/
../../gcc/gthr-posix.h:83: undefined reference to `pthread_create'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcc_eh.a(unwind-dw2-fde-glibc.o):
In function `__deregister_frame_info_bases':
/usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/gcc/
../../gcc/gthr-posix.h:82: undefined reference to `pthread_create'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcc_eh.a(unwind-dw2-fde-glibc.o):/
usr/src/build/146482-i386/BUILD/gcc-3.2-20020903/obj-i386-redhat-linux/gcc/.
./../gcc/gthr-posix.h:82: more undefined references to `pthread_create'
follow
collect2: ld returned 1 exit status

Any ideas?

Thanks,
	Neil.


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