On Thu, 10 Jun 1999, Marcel Ruff wrote:

> Hi,
> 
> i have reduced the problem to the C++  versus  C executable of tclsh.
> 
> Its some very nasty linking/demangling or whatever problem!
> 
> But:    If  i switch off the sunwjit it runs fine for C++ as well (see
> test.tcl)!
> 
> I use the main source from the tclsh application to demonstrate it.


I think you should submit this as a Bug in Tcl 8.0.5 to the
www.scriptics.com "support" form. You should also click on the
option of the bug form so that it posts a copy of the bug report
to comp.lang.tcl. If you do this it might get fixed in the next
release of the Tcl core.

later
mo
 
> Attached is tclAppInit.c from the tcl8.0.5/unix directory, with slightly
> modified main syntax, so that it is both C and C++ compilable.
> 
> Ive attached as well a tiny test.tcl and a HelloWorldAwt.java to reproduce
> the crash.
> 
> 1) Compile the java file:
>    jikes  HelloWorldAwt.java
> 
> 
> 
> 2) compile as C - works fine!
> -------------------
> cc -c -g  -fPIC -I./../generic -I. -DHAVE_GETCWD=1 -DHAVE_UNISTD_H=1
> -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1
> -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1
> -DNEED_MATHERR=1 -DRETSIGTYPE=void -DHAVE_SIGNED_CHAR=1
> -DHAVE_SYS_IOCTL_H=1        -DTCL_SHLIB_EXT=\".so\" ./tclAppInit.c
> cc -rdynamic tclAppInit.o -L/u/tcl/unix -ltcl8.0 -ldl  -lm -lc          -o
> tclsh_c
> 
> tclsh_c test.tcl
> 
> -> a button pops up, click on it
> 
> 
> 
> 3) compile as C++  - you get the crash i described in my last mail (see
> below)
> --------------------------------------------------
> g++ -c -g  -fPIC -I./../generic -I. -DHAVE_GETCWD=1 -DHAVE_UNISTD_H=1
> -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1
> -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1
> -DNEED_MATHERR=1 -DRETSIGTYPE=void -DHAVE_SIGNED_CHAR=1
> -DHAVE_SYS_IOCTL_H=1        -DTCL_SHLIB_EXT=\".so\" ./tclAppInit.c
> g++ -rdynamic tclAppInit.o -L/u/tcl/unix -ltcl8.0 -ldl  -lm -lc          -o
> tclsh_cpp
> 
> 
> tclsh_cpp test.tcl
> 
> -> the crash occurs
> 
> 
> 4) Switch off the JIT in test.tcl, and everything is fine again.
> 
> 
> On Win32 there is no problem with JIT and C++ and TclBlend 1.2.3
> 
> one hour later :-):
> ------------
> This behaviour i reproducable with my pure JNI C++ HelloWorldAwt.C,
> where no TclBlend is involved.
> Without JIT it works, with JIT it crashes.
> 
> I will post a mail to the blackown people as well.
> 
> 
> thanks for your help,
> 
> Marcel
> 
> Moses DeJong wrote:
> 
> > On Thu, 10 Jun 1999, Marcel Ruff wrote:
> >
> > > Hi,
> > >
> > > Im using the Tcl interpreter in a C++ main modul.
> > >
> > > When i  start the application and invoke the tcl interpreter with
> > > the package java and try to open a Java GUI i get a crash (output see
> > > below)
> > >
> > > My environment:
> > > -----------
> >
> > What linux dist are you using? I have had some problems getting Tcl Blend
> > working under Debian 2.1 but it seems to work just fine under RedHat 5.1.
> > I do not think this is related to the problem you are having (the crash
> > I was seeing was X related) but it might help. Also, I have tested Tcl
> > Blend with  JDK 1.2 pre1 but I have not tried it with pre2 so you are
> > breaking new ground here.
> >
> > > Linux 2.2.5 with glibc 2.0.x
> > > JDK 1.2pre2 (blackdown)
> > > Tcl 8.0.5
> > > TclBlend 1.2.3
> > > egcs gcc-2.95 19990602 (prerelease)
> > >
> >
> > Humm, I have never tried to compile my own executable that will load
> > Tcl and Tk. You might want to try making your executable into a shared
> > lib that Tcl can load. That way you can use the jtclsh wrapper script
> > that comes with 1.2.3. There are some really nasty shared lib issues
> > with the JDK under Linux that the wrapper does for you. If you do not
> > use the wrapper for tclsh you will need to do these same things in your
> > executable.
> >
> > > the libraries in my executable:
> > > -------------------
> > >  ldd pled.exe
> > >         libpthread.so => /usr/lib/libpthread.so (0x40008000)
> > >         libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40016000)
> > >         libpng.so.2 => /usr/X11R6/lib/libpng.so.2 (0x400bb000)
> > >         libz.so.1 => /usr/lib/libz.so.1 (0x400d8000)
> > >         libtiff.so.3 => /usr/lib/libtiff.so.3 (0x400e8000)
> > >         /u/pia/lib/libtcl8.0.so => /u/pia/lib/libtcl8.0.so (0x4011b000)
> > >         libdl.so.2 => /lib/libdl.so.2 (0x40187000)
> > >         /u/pia/lib/libtk8.0.so => /u/pia/lib/libtk8.0.so (0x4018b000)
> > >         libstdc++-libc6.0-1.so.2 =>
> > > /usr/local/lib/libstdc++-libc6.0-1.so.2 (0x40231000)
> > >         libm.so.6 => /lib/libm.so.6 (0x40273000)
> > >         libc.so.6 => /lib/libc.so.6 (0x4028d000)
> > >         libjpeg.so.6 => /usr/lib/libjpeg.so.6 (0x4033a000)
> > >         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)
> > >
> > >
> > >
> > > ------- output when invoking java from C++ using TclBlend 1.2.3 -------
> > > SIGSEGV   11*  segmentation violation
> > >         stackpointer=0xbfffbfa8
> > >
> > > Full thread dump Classic VM (Linux_JDK_1.2_pre-release-v2, native
> > > threads):
> > >     "Finalizer" (TID:0x40760320, sys_thread_t:0x82ac368, state:CW,
> > > native ID:0xc03) prio=8
> > >         at java.lang.Object.wait(Native Method)
> > >         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:112)
> > >         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
> > >         at
> > > java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:174)
> > >     "Reference Handler" (TID:0x407603b0, sys_thread_t:0x82a7a80,
> > > state:CW, native ID:0x802) prio=10
> > >         at java.lang.Object.wait(Native Method)
> > >         at java.lang.Object.wait(Object.java:424)
> > >         at
> > > java.lang.ref.Reference$ReferenceHandler.run(Reference.java:114)
> > >     "SIGQUIT handler" (TID:0x407603e0, sys_thread_t:0x82a0508, state:R,
> > > native ID:0x401) prio=5
> > >     "main" (TID:0x407601e0, sys_thread_t:0x821a898, state:R, native
> > > ID:0x400) prio=5
> >
> > Did you try turning the JIT compiler off? Try that and see if it helps.
> > I think you need to pass -Djava.compiler= to the java command line
> > (which is the tclblend_init var in tcl blend).
> >
> > >         at java.lang.String.valueOf(Compiled Code)
> > >         at java.lang.Compiler.<clinit>(Compiler.java:68)
> > > Monitor Cache Dump:
> > >     java.lang.ref.Reference$Lock@407603C0/40795B20: <unowned>
> > >         Waiting to be notified:
> > >             "Reference Handler" (0x82a7a80)
> > >     java.lang.ref.ReferenceQueue$Lock@40760338/40796028: <unowned>
> > >         Waiting to be notified:
> > >             "Finalizer" (0x82ac368)
> > >     <unknown key> (0x40760131): owner "main" (0x821a898) 1 entry
> > > Registered Monitor Dump:
> > >     PCMap lock: <unowned>
> > >     utf8 hash table: <unowned>
> > >     JNI pinning lock: <unowned>
> > >     JNI global reference lock: <unowned>
> > >     BinClass lock: <unowned>
> > >     Class linking lock: <unowned>
> > >     System class loader lock: <unowned>
> > >     Code rewrite lock: <unowned>
> > >     Heap lock: <unowned>
> > >     Monitor cache lock: owner "main" (0x821a898) 1 entry
> > >     Thread queue lock: owner "main" (0x821a898) 1 entry
> > >     Dynamic loading lock: <unowned>
> > >     Monitor registry: owner "main" (0x821a898) 1 entry
> > > -----------------------------------------
> > >
> > >
> > > -------------------- the gdb output:
> > > (gdb) run
> > > Starting program: /u/pia/bin/pled.exe
> > > [New Thread 23933]
> > > [New Thread 23932]
> > > [New Thread 23934]
> > >
> > > Program received signal ?, Unknown signal.
> > > [Switching to Thread 23934]
> > >
> > > Program received signal ?, Unknown signal.
> > > 0x403140e4 in __syscall_sigsuspend () at soinit.c:27
> > > soinit.c:27: No such file or directory.
> > > (gdb) where
> > > #0  0x403140e4 in __syscall_sigsuspend () at soinit.c:27
> > > #1  0x40339320 in __DTOR_END__ ()
> > > #2  0x4001bb69 in sem_wait (sem=0x82a04b4) at restart.h:49
> > > #3  0x403e881d in _start (tid_=0x82a0438) at
> > > ../../../../../src/linux/hpi/native_threads/src/threads_md.c:319
> > > #4  0x40019587 in pthread_start_thread (arg=0xbf9ffea4) at manager.c:192
> > >
> > >
> > >
> > >
> > > -----------------
> >
> > Do you mean that you can use swing components inside Tcl Blend
> > loaded into tclsh with the jtclsh wrapper?
> >
> > > My environment seems to be ok, because i can start the Swing GUI
> > > manually with tclsh8.0.
> >
> > First off, compile Tcl with --enable-symbols so that debug symbols
> > are placed into the tcl and tcl blend shared libs.
> >
> > Rebuild Tcl and reconfigure Tcl Blend. Then open up the Makefile
> > and add -DTCLBLEND_DEBUG to the CFLAGS. That will print some extra
> > output to stderr when creating the JVM inside Tcl Blend. Then you
> > can set the tclblend_init global var in the tcl shell before
> > loading tclblend. There is more info about how to do this
> > on the "whats new" page at www.scriptics.com/java.
> >
> > > Has anybody an idea what to try, or where to debug?
> > >
> > > Where can i set the debuglevel of the JVM throu TclBlend?
> > >
> > > Has anybody running  similar configuration where works fine??
> > >
> > >
> > > Thanks for a hint,
> > >
> > > Marcel
> > >
> > >
> > > ----------------------------------------------------------------
> > > The TclJava mailing list is sponsored by WebNet Technologies.
> > > To subscribe:    send mail to [EMAIL PROTECTED]
> > >                  with the word SUBSCRIBE as the subject.
> > > To unsubscribe:  send mail to [EMAIL PROTECTED]
> > >                  with the word UNSUBSCRIBE as the subject.
> > > To send to the list, send email to '[EMAIL PROTECTED]'.
> > > A list archive is at: http://www.findmail.com/listsaver/tcldallas/
> > >
> >
> > 
> 

Mo DeJong
[EMAIL PROTECTED]
gimme multimedia group

----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
A list archive is at: http://www.findmail.com/listsaver/tcldallas/

Reply via email to