Re: TestTimerAAAAA ... Uncaught exception

Phil Freed <url-dotgnu-o/[email protected]>
Newsgroups gmane.comp.gnu.dotgnu.developer
Message-ID <[email protected]>
For some reason, this bounced back to me after a few days -- so here it is 
again:
===

I wrote about problems compiling the pnet package on Solaris 2.8.

At 11:41 PM 8/14/2004, Rhys Weatherley wrote:
>You will probably need to turn threading on explicitly.  Rebuild pnet after
>reconfiguring as follows:
>
>     ./configure --enable-threads=posix
>
>If you manage to get threading working on Solaris, then we can turn it on
>permanently in CVS.

I didn't have much luck with just disabling the threading tests (see 
below), so I decided to delve in and do some actual work for a change.  I 
haven't actually gotten anything working -- but I've learned a few things 
that I thought I'd pass on.

Here's what I've learned so far.  I've included all my notes, in the hope 
that someone will find it helpful.

1)  Configuring with -enable-threads=posix on a Solaris box doesn't 
actually do everything it needs to.  The problem is in 
support/thr_choose.h, which defines IL_USE_PTHREADS for linux and Win32 
systems -- but not Solaris.

2)  Defining IL_USE_PTHREADS lets us continue.  next, the make fails at
   ../include/il_values.h:36:24: il_profile.h: No such file or directory

It appears that this is a side-effect of using the "-j5" option on make, 
though I didn't research it too closely.  Doing a make without the "-j" 
option allows that include file to be created before it is needed.  I 
suppose that there must be a dependency missing in the makefile.

3)  OK -- so I've done that.  Next problem:

gcc [...]  -c allocate.c

In file included from thr_defs.h:38,
                  from allocate.c:21:
pt_defs.h:50:30: missing binary operator before token "_sysconf"
pt_defs.h:64:30: missing binary operator before token "_sysconf"
allocate.c: In function `ILPageAlloc':
allocate.c:309: warning: missing braces around initializer
allocate.c:309: warning: (near initialization for `__once.__pthread_once_pad')
make[1]: *** [allocate.o] Error 1
make[1]: Leaving directory `/var/tmp/t/pnet-0.6.8/support'
make: *** [all-recursive] Error 1


The first pair of errors above (_sysconf) come from this section of 
support/pt_defs.h:

>#if !defined(__SIGRTMIN) && defined(SIGRTMIN)
>#define __SIGRTMIN                      SIGRTMIN
>#endif
>#if !defined(__SIGRTMAX) && defined(SIGRTMAX)
>#define __SIGRTMAX                      SIGRTMAX
>#endif
>[...]
>#if !defined(__SIGRTMIN) || (__SIGRTMAX - __SIGRTMIN < 14)
>[...]
>#if !defined(__SIGRTMIN) || (__SIGRTMAX - __SIGRTMIN < 3)

and from this section of the system include file sys/iso/signal_iso.h:

>/* insert new signals here, and move _SIGRTM* appropriately */
>#define _SIGRTMIN 38    /* first (highest-priority) realtime signal */
>#define _SIGRTMAX 45    /* last (lowest-priority) realtime signal */
>extern long _sysconf(int);      /* System Private interface to sysconf() */
>#define SIGRTMIN ((int)_sysconf(_SC_SIGRT_MIN)) /* first realtime signal */
>#define SIGRTMAX ((int)_sysconf(_SC_SIGRT_MAX)) /* last realtime signal */


You'll notice that SIGRTMIN is defined as the result of a function instead 
of the constant that you would expect.  I confess that I don't understand 
why this was done -- unless these values are someday expected to change 
dynamically.  In any case, having the call to _sysconf makes the 
preprocessor hack fail in support/pt_defs.h.


I checked empirically, SIGRTMIN / MAX return 38 and 45 respectively.  Maybe 
the correct thing to do here on Solaris is
   #define __SIGRTMIN                      _SIGRTMIN
   #define __SIGRTMAX                      _SIGRTMAX
but I'm not really sure.  In any case, that's what I did in order to proceed.

The second error above  (allocate.c:309: warning: missing braces around 
initializer) is easily fixed by changing line 225 of support/pt_defs.h from
    static pthread_once_t __once = PTHREAD_ONCE_INIT; \
to
    static pthread_once_t __once = { PTHREAD_ONCE_INIT }; \

==========

Recompiling, we get:

gcc -I../libffi/include -fno-gcse 
-fno-inline-functions                          -I../support 
   -I../libgc/include 
-I../include                         -I../libffi/include -I. 
-DBUILD_PROFILE_NAME="\"full\"" -O3 -Wall  -o ilverify  ilverify.o 
libILEngine.a 
../dumpasm/libILDumpAsm.a                           ../image/libILImage.a 
../support/libILSupport.a 
../libffi/.libs/libffi.a ../libgc/.libs/libgc.a    -lz -lnsl -lsocket -ldl 
-lm  -lpthread
Undefined                       first referenced
  symbol                             in file
sched_yield                         ../support/libILSupport.a(thread.o)
sem_destroy                         ../support/libILSupport.a(thread.o)
sem_post                            ../support/libILSupport.a(pt_defs.o)
sem_init                            ../support/libILSupport.a(thread.o)
sem_wait                            ../support/libILSupport.a(thread.o)
[...]


It seems that Solaris wants   "-lposix4" on the link line.  OK...  Lets try 
again.

This time, there are some odd warnings -- though nothing I can't cross my 
fingers and ignore ...:

cs_grammar.y:2393.49-59: warning: rule never reduced because of conflicts: 
OptSpecificCatchClauses: /* empty */
cs_grammar.y:2394.11-52: warning: rule never reduced because of conflicts: 
OptSpecificCatchClauses: SpecificCatchClauses

hmm....

./mkcvmdoc.sh: python: not found

Oh well -- I guess if I want all the documentation, I'm gonna need python 
on this box.  Time for a "make check":

[...]
make[2]: Entering directory `/var/tmp/t/pnet-0.6.8/tests'
Suite: Main Thread Properties
-----------------------------

thread_main_nonnull ... ok
thread_main_object ... ok
thread_main_running ... ok
thread_main_foreground ... ok

Suite: Thread Creation
----------------------

thread_create_arg ... ok
thread_create_suspended ... ok
thread_create_state ...
      [much time passes... ... .... .....]
      ^C^C^C^C^C^C
      ^C^C^C^C^C^C
      ^C^C^C^C^C^C

Uhoh.  The test hangs.  This is a far as I've gotten with threads enabled.

==================================

If, on the other hand, I compile pnet without threads and just disable the 
thread test in pnetlib, I get this:


TestXmlConvertToInt32 ... failed: CSUnit.TestAssertFailed: Test failed: 
ToInt32 (5)
         at CSUnit.TestCase.Fail(String) in ./TestCase.cs:148
         at TestXmlConvert.TestXmlConvertToInt32() in ./TestXmlConvert.cs:498
         at System.Reflection.ClrMethod.Invoke(Object, BindingFlags, 
Binder, Object[], CultureInfo)
         at System.Reflection.MethodBase.Invoke(Object, Object[]) in 
./System/Reflection/MethodBase.cs:64
         at CSUnit.TestCase.RunTest() in ./TestCase.cs:104
         at CSUnit.TestCase.Run(TestResult) in ./TestCase.cs:47
         at CSUnit.TestSuite.Run(TestResult) in ./TestSuite.cs:103
         at CSUnit.TestSuite.Run(TestResult) in ./TestSuite.cs:103
         at CSUnit.TestMain.Main(String[]) in ./TestMain.cs:247

TestXmlConvertToInt64 ... failed: CSUnit.TestAssertFailed: Test failed: 
ToInt64 (5)
         at CSUnit.TestCase.Fail(String) in ./TestCase.cs:148
         at TestXmlConvert.TestXmlConvertToInt64() in ./TestXmlConvert.cs:597
         at System.Reflection.ClrMethod.Invoke(Object, BindingFlags, 
Binder, Object[], CultureInfo)
         at System.Reflection.MethodBase.Invoke(Object, Object[]) in 
./System/Reflection/MethodBase.cs:64
         at CSUnit.TestCase.RunTest() in ./TestCase.cs:104
         at CSUnit.TestCase.Run(TestResult) in ./TestCase.cs:47
         at CSUnit.TestSuite.Run(TestResult) in ./TestSuite.cs:103
         at CSUnit.TestSuite.Run(TestResult) in ./TestSuite.cs:103
         at CSUnit.TestMain.Main(String[]) in ./TestMain.cs:247

Sigh.  I'll come back to this -- but it may be a few days before I can.  In 
the meantime, I'd be grateful for any tips you may have.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.