pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/41603: Making ECL work with threads

The following reply was made to PR pkg/41603; it has been noted by GNATS.

From: Matthew Mondor <>
Subject: Re: pkg/41603: Making ECL work with threads
Date: Sat, 15 Aug 2009 16:16:20 -0400

 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 So a few revisions were out since and I couldn't really start to look
 at the code until now.  I could resume debugging this problem a bit
 So with ECL CVS HEAD, all is fine when built without threads support
 again.  With threads support and CFLAGS='-O0 -g' and LDFLAGS='-g',
 ecl_min still gets stuck in an endless RUN state loop after the
 reception if a signal (SIGSEGV):
 behemoth$ gdb ~/work/ecl-cvs/build/ecl_min 13414
 GNU gdb 6.5
 Copyright (C) 2006 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 "i386--netbsdelf"...
 Attaching to program: /home/mmondor/work/ecl-cvs/build/ecl_min, process
 13414 Reading symbols from /usr/lib/
 Loaded symbols for /usr/lib/
 Reading symbols from /usr/lib/
 Loaded symbols for /usr/lib/
 Reading symbols from /usr/lib/
 Loaded symbols for /usr/lib/
 Reading symbols from /usr/libexec/ld.elf_so...done.
 Loaded symbols for /usr/libexec/ld.elf_so
 sigsegv_handler (sig=11, info=0xbfbfe264, aux=0xbfbfe2e4)
 at /home/mmondor/work/ecl-cvs/src/c/unixint.d:357 357
 cl_env_ptr the_env = ecl_process_env(); (gdb) bt
 #0  sigsegv_handler (sig=11, info=0xbfbfe264, aux=0xbfbfe2e4)
 at /home/mmondor/work/ecl-cvs/src/c/unixint.d:357 #1  <signal handler
 called> #2  ecl_set_process_env (env=0xbbab4000) at 
 #3  0x080b2b05 in init_threads (env=0xbbab4000)
 at /home/mmondor/work/ecl-cvs/src/c/threads.d:677 #4  0x0804de50 in
 cl_boot (argc=2, argv=0xbfbfe714)
 at /home/mmondor/work/ecl-cvs/src/c/main.d:397 #5  0x0804ccc8 in main
 (argc=572653570, args=0x1)
 at /home/mmondor/work/ecl-cvs/src/c/cinit.d:127 (gdb) frame 2 #2
 ecl_set_process_env (env=0xbbab4000)
 at /home/mmondor/work/ecl-cvs/src/c/threads.d:85 85
 cl_env_p = env; (gdb) info locals No locals. (gdb) print *env
 $1 = {disable_interrupts = 1, nvalues = 0, values = {0x0 <repeats 64
 times>}, function = 0x0, stack_size = 0, stack = 0x0, stack_top = 0x0, 
stack_limit = 0x0, bds_size = 0, bds_org = 0x0, bds_top = 0x0, bds_limit = 0x0, 
bindings_hash = 0x0, ihs_top = 0x0, frs_size = 0, frs_org = 0x0, frs_top = 0x0, 
frs_limit = 0x0, 
   nlj_fr = 0x0, frame_id = 0, cs_org = 0x0, cs_limit = 0x0, cs_barrier
 = 0x0, cs_size = 0, string_pool = 0x0, c_env = 0x0, fmt_aux_stream =
 0x0, print_pretty = 0, queue = 0x0, indent_stack = 0x0, qh = 0, qt = 0,
 qc = 0, isp = 0, iisp = 0, big_register = {0x0, 0x0, 0x0},
 big_register_limbs = {{ 0 <repeats 16 times>}, {0 <repeats 16 times>},
 {0 <repeats 16 times>}}, own_process = 0x0, interrupt_pending = 0,
 interrupt_info = 0x0, method_hash_clear_list = 0x0, method_hash = 0x0,
 method_spec_vector = 0x0, method_generation = 0, fficall = 0x0,
 altstack = 0x0, altstack_size = 0, trap_fpe_bits = 0} (gdb) print
 *cl_env_p Cannot access memory at address 0x0
 There are various definitions used for conditions in the thread-related
 expected the pthread_key_t pthread_getspecific()/pthread_setspecific()
 related code in c/threads.d to be used with threads, although that
 actually compiles if not WITH___THREAD (and I verified that
 WITH___THREAD was defined).  In c/main.d, cl_env_p is declared with
 __thread prefix if WITH___THREAD, however.  But, 8.12.0, which used to
 work also used this, and the HEAD configure script reports that __thread
 tests are successful.
 There however were a number of changes since 8.12.0.  The win32 and
 POSIX threads code have been merged for instance and the #ifdef mess is
 worse.  However, an interesting difference relating to __thread is that
 8.12.0 configure script had the --with-__thread default to NO, while
 new ECL uses AUTO.  I built a recent ECL with --with-__thread=no and it
 worked (!).
 Now I'm not familiar enough with __thread on NetBSD to know if they're
 supposed to work or not.  The configure script runs a gcc command to
 test that it's available if --with-__thread is AUTO or YES, and since
 this test appears successful it attempts to use the feature.
 Asau updated ECL on pkgsrc-current, and I for now propose the attached
 changes to that new stub on -current pkgsrc (diffs and a new
 patch-aa).  This also adds libffi as an option which is disabled by
 However, for ECL threading to also work, the boehm-gc package also has
 to be compiled with threading support.  Interestingly, on even
 pkgsrc-2009Q2, there was an erroneous conditional in devel/boehm-gc
 stubs's Makefile disabling threading on != Darwin, which probably had
 to be reversed.  However, -current pkgsrc has the fixes.
 Content-Type: text/plain
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment; filename=Makefile-diff.txt
 --- ./Makefile.orig    2009-08-13 14:17:18.000000000 -0400
 +++ ./Makefile 2009-08-15 15:23:47.000000000 -0400
 @@ -16,9 +16,13 @@
  GNU_CONFIGURE=                yes
  USE_LIBTOOL=          yes
 -USE_TOOLS+=           gmake makeinfo
 +USE_TOOLS+=           gmake makeinfo autoconf
  INFO_FILES=           yes
 +# Make ffi patch take effect
 +      cd ${WRKSRC}/src && autoconf
  CONFIGURE_ARGS+=      --enable-boehm=system --with-system-gmp
  .include ""
 Content-Type: text/plain
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment; filename=distinfo-diff.txt
 --- ./distinfo.orig    2009-08-13 14:17:18.000000000 -0400
 +++ ./distinfo 2009-08-15 15:20:15.000000000 -0400
 @@ -3,3 +3,4 @@
  SHA1 (ecl-9.8.3.tgz) = 51928757ddf0a33ef24beac35971ce4a8df786d7
  RMD160 (ecl-9.8.3.tgz) = 94a746abc8bdb6881dfe361e0c7f074f17e3da04
  Size (ecl-9.8.3.tgz) = 5732346 bytes
 +SHA1 (patch-aa) = 2bdbae3ec960a993f38b005d4d4063c206120e10
 Content-Type: text/plain
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment; filename=options-mk-diff.txt
 --- ./  2009-08-13 14:17:18.000000000 -0400
 +++ ./       2009-08-15 15:17:51.000000000 -0400
 @@ -1,7 +1,7 @@
  # $NetBSD:,v 1.1 2009/08/13 18:17:18 asau Exp $
  PKG_OPTIONS_VAR=              PKG_OPTIONS.ecl
 -PKG_SUPPORTED_OPTIONS+=               threads unicode
 +PKG_SUPPORTED_OPTIONS+=               threads unicode libffi
  PKG_SUGGESTED_OPTIONS+=               # empty
  # Unicode support proved to break Axioms.
  # Threads are off, since threaded ECL build crashes on NetBSD and FreeBSD.
 @@ -15,6 +15,9 @@
 +.if ${OPSYS} == "NetBSD"
 +CONFIGURE_ARGS+=      --with-__thread=no
  .include "../../mk/"
 @@ -22,3 +25,7 @@
  CONFIGURE_ARGS+=      --enable-unicode
  PLIST_SRC+=           PLIST.unicode
 +.if !empty(PKG_OPTIONS:Mlibffi)
 +.include "../../devel/libffi/"
 Content-Type: text/plain
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment; filename=patch-aa
 --- ./src/    2009-08-07 16:21:24.000000000 -0400
 +++ ./src/ 2009-08-08 12:55:37.000000000 -0400
 @@ -320,7 +320,7 @@
  LIBS="${LIBS} -lm"
  AC_CHECK_LIB(sun, getpwnam)         # on IRIX adds -lsun
  AC_CHECK_LIB( ffi, ffi_call, [has_ffi_lib=yes], [has_ffi_lib=no] )
 -AC_CHECK_HEADER( [ffi/ffi.h], [has_ffi_h=$has_ffi_lib], [has_ffi_h=no] )
 +AC_CHECK_HEADER( [ffi.h], [has_ffi_h=$has_ffi_lib], [has_ffi_h=no] )
  if test $has_ffi_h = "yes"; then
 --- ./src/c/ffi.d.orig 2009-08-07 16:21:20.000000000 -0400
 +++ ./src/c/ffi.d      2009-08-08 13:02:17.000000000 -0400
 @@ -17,7 +17,7 @@
  #include <ecl/ecl.h>
  #include <ecl/internal.h>
  #ifdef HAVE_LIBFFI
 -# include <ffi/ffi.h>
 +# include <ffi.h>
  static const cl_object ecl_foreign_type_table[] = {

Home | Main Index | Thread Index | Old Index