Re: Guile Strings

2011-12-31 Thread Geert Janssens
Op vrijdag 30 december 2011 15:18:30 schreef John Ralls: 
 As you can see, it's allocating a string on the heap and returning it, so
 either the strings are already getting freed or we're already leaking them.
 
 So I went ahead and built swig with the patch from the bug and gave it a
 spin. It did indeed silence the deprecation warnings in guile-1.8.8.
 
That's already good.

 Unfortunately guile-2.0 appears to have changed the way that extensions are
 loaded, because with guile-2.0 installed make check fails with
 
 ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
 ;;;   or pass the --no-auto-compile argument to disable.
 ;;; compiling
 /Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/engine/test/./
 test-create-account.scm ;;; note: source file
 /Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/gnc-module/gnc
 -module.scm ;;;   newer than compiled
 /Users/john/.cache/guile/ccache/2.0-LE-4-2.0/Volumes/RAID1/Gnucash-Build/Gn
 ucash-svn/src/gnucash-git/src/gnc-module/gnc-module.scm.go ;;; compiling
 /Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/gnc-module/gnc
 -module.scm ;;; WARNING: compilation of
 /Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/gnc-module/gnc
 -module.scm failed: ;;; ERROR: no code for module (sw_gnc_module)
 ./test-create-account: line 2: 80147 Bus error   guile -l
 $SRCDIR/test-create-account.scm -c (exit (run-test))
 
 I poked at it briefly, but it couldn't get it to work.

Have you tried with environment variable GUILE_AUTO_COMPILE=0 set ? You may 
need to remove the already autocompiled modules from /Users/john/.cache/guile 
also.

I read somewhere [1] that guile 2 can either precompile modules for 
performance or use the old interpreted mechanism. I never found explicit 
documentation on how to select one or the other, but as I understand it you 
have to disable auto compilation to get the interpreter.

Geert

[1] http://sites.google.com/site/robertharamoto/Home/programming/moving-to-
guile-2
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Guile Strings

2011-12-31 Thread John Ralls

On Dec 31, 2011, at 1:59 AM, Geert Janssens wrote:

 Op vrijdag 30 december 2011 15:18:30 schreef John Ralls: 
 As you can see, it's allocating a string on the heap and returning it, so
 either the strings are already getting freed or we're already leaking them.
 
 So I went ahead and built swig with the patch from the bug and gave it a
 spin. It did indeed silence the deprecation warnings in guile-1.8.8.
 
 That's already good.
 
 Unfortunately guile-2.0 appears to have changed the way that extensions are
 loaded, because with guile-2.0 installed make check fails with
 
 ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
 ;;;   or pass the --no-auto-compile argument to disable.
 ;;; compiling
 /Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/engine/test/./
 test-create-account.scm ;;; note: source file
 /Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/gnc-module/gnc
 -module.scm ;;;   newer than compiled
 /Users/john/.cache/guile/ccache/2.0-LE-4-2.0/Volumes/RAID1/Gnucash-Build/Gn
 ucash-svn/src/gnucash-git/src/gnc-module/gnc-module.scm.go ;;; compiling
 /Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/gnc-module/gnc
 -module.scm ;;; WARNING: compilation of
 /Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/gnc-module/gnc
 -module.scm failed: ;;; ERROR: no code for module (sw_gnc_module)
 ./test-create-account: line 2: 80147 Bus error   guile -l
 $SRCDIR/test-create-account.scm -c (exit (run-test))
 
 I poked at it briefly, but it couldn't get it to work.
 
 Have you tried with environment variable GUILE_AUTO_COMPILE=0 set ? You may 
 need to remove the already autocompiled modules from /Users/john/.cache/guile 
 also.
 
 I read somewhere [1] that guile 2 can either precompile modules for 
 performance or use the old interpreted mechanism. I never found explicit 
 documentation on how to select one or the other, but as I understand it you 
 have to disable auto compilation to get the interpreter.

Yes. It only reduces the spew, it doesn't fix the segfault at the end.

The key is in ERROR: no code for module (sw_gnc_module), and after debugging 
into it with the Guile interpreter I've established that Guile 2.0 changes the 
way that it loads C libraries. I could only get (dynamic-link) to find a 
library in /usr/lib. It ignores LD_LIBRARY_PATH and DYLD_LIBRARY_PATH and won't 
load even with an absolute path (though the documentation implies that it 
should).

I'm going to have to go code-diving in the Guile-2 sources to figure this out, 
but not right now.

Regards,
John Ralls



___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Guile Strings

2011-12-31 Thread Derek Atkins

On Sat, December 31, 2011 2:01 pm, John Ralls wrote:

 On Dec 31, 2011, at 1:59 AM, Geert Janssens wrote:

 The key is in ERROR: no code for module (sw_gnc_module), and after
 debugging into it with the Guile interpreter I've established that Guile
 2.0 changes the way that it loads C libraries. I could only get
 (dynamic-link) to find a library in /usr/lib. It ignores LD_LIBRARY_PATH
 and DYLD_LIBRARY_PATH and won't load even with an absolute path (though
 the documentation implies that it should).

 I'm going to have to go code-diving in the Guile-2 sources to figure this
 out, but not right now.


IMHO this is not high priority for 2.4.x, but we should get guile-2
working for 2.6.  So, this should not hold up the 2.4.9 release.

 Regards,
 John Ralls

-derek

-- 
   Derek Atkins 617-623-3745
   de...@ihtfp.com www.ihtfp.com
   Computer and Internet Security Consultant

___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Guile Strings

2011-12-31 Thread John Ralls

On Dec 31, 2011, at 11:11 AM, Derek Atkins wrote:

 
 On Sat, December 31, 2011 2:01 pm, John Ralls wrote:
 
 On Dec 31, 2011, at 1:59 AM, Geert Janssens wrote:
 
 The key is in ERROR: no code for module (sw_gnc_module), and after
 debugging into it with the Guile interpreter I've established that Guile
 2.0 changes the way that it loads C libraries. I could only get
 (dynamic-link) to find a library in /usr/lib. It ignores LD_LIBRARY_PATH
 and DYLD_LIBRARY_PATH and won't load even with an absolute path (though
 the documentation implies that it should).
 
 I'm going to have to go code-diving in the Guile-2 sources to figure this
 out, but not right now.
 
 
 IMHO this is not high priority for 2.4.x, but we should get guile-2
 working for 2.6.  So, this should not hold up the 2.4.9 release.

Absolutely. I need to get guile-1.8 working correctly in M$Win for the 2.4.9 
release.

Regards,
John Ralls


___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Guile Strings

2011-12-30 Thread John Ralls

On Dec 30, 2011, at 9:19 AM, Geert Janssens wrote:

 Op vrijdag 30 december 2011 09:06:58 schreef u:
 On Dec 30, 2011, at 2:57 AM, Geert Janssens wrote:
 As for the string problem, we may have to modify the C-side functions to
 require gstrdup'd strings that the consumer function frees. I'll have to
 have a look at how those strings are being used to suggest something more
 concrete.
 

The actual code that SWIG injects is
SWIGINTERN char *
SWIG_Guile_scm2newstr(SCM str, size_t *len) {
#define FUNC_NAME SWIG_Guile_scm2newstr
  char *ret;
  size_t l;

  SCM_ASSERT (SCM_STRINGP(str), str, 1, FUNC_NAME);
  
  l = SCM_STRING_LENGTH(str);
  ret = (char *) SWIG_malloc( (l + 1) * sizeof(char));
  if (!ret) return NULL;

  memcpy(ret, SCM_STRING_CHARS(str), l);
  ret[l] = '\0';
  if (len) *len = l;
  return ret;
#undef FUNC_NAME
}

As you can see, it's allocating a string on the heap and returning it, so 
either the strings are already getting freed or we're already leaking them.

So I went ahead and built swig with the patch from the bug and gave it a spin. 
It did indeed silence the deprecation warnings in guile-1.8.8.

Unfortunately guile-2.0 appears to have changed the way that extensions are 
loaded, because with guile-2.0 installed make check fails with 

;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;   or pass the --no-auto-compile argument to disable.
;;; compiling 
/Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/engine/test/./test-create-account.scm
;;; note: source file 
/Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/gnc-module/gnc-module.scm
;;;   newer than compiled 
/Users/john/.cache/guile/ccache/2.0-LE-4-2.0/Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/gnc-module/gnc-module.scm.go
;;; compiling 
/Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/gnc-module/gnc-module.scm
;;; WARNING: compilation of 
/Volumes/RAID1/Gnucash-Build/Gnucash-svn/src/gnucash-git/src/gnc-module/gnc-module.scm
 failed:
;;; ERROR: no code for module (sw_gnc_module)
./test-create-account: line 2: 80147 Bus error   guile -l 
$SRCDIR/test-create-account.scm -c (exit (run-test))

I poked at it briefly, but it couldn't get it to work.

Regards,
John Ralls


___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel