Summary

g2: if gd is not available, gd-png and gd-jpeg will not be defined

Metadata

Description

This will result in an unresolved module and compilation will fail.

Changes and comments

[2012-01-28 00:55:35 UTC] mario changed status from new to accepted

[2012-01-28 00:55:35 UTC] mario wrote:

I've added a cond-expand clause for when gd is not available. It generate stub procedures for g2:gd-png, g2:gd-jpeg and g2:open-gd. Those procedures just throw an error when called.

Does this look like a good approach? I've commited the changes to g2 trunk (rev 25836).

As a side note, it seems that Debian's and Ubuntu's packages for libg2 are broken: http://lists.debian.org/debian-qa-packages/2011/02/msg00420.html

Here's what I get when using the package provided by Debian and Ubuntu:

 $ csi
 
 CHICKEN
 (c)2008-2011 The Chicken Team
 (c)2000-2007 Felix L. Winkelmann
 Version 4.7.0 
 linux-unix-gnu-x86 [ manyargs dload ptables ]
 compiled 2011-05-27 on dellito (Linux)
 
 ; loading /home/mario/.csirc ...
 csi> (use g2)
 ; loading /usr/local/chicken-4.7.0/lib/chicken/6/g2.import.so ...
 
 Error: (load) during expansion of (import ...) - unable to load compiled module - /usr/lib/libg2.so.0.72: undefined symbol: gdFontTiny: "/usr/local/chicken-4.7.0/lib/ch
 icken/6/g2.import.so"
 
         Call history:
 
         <syntax>          (use g2)
         <syntax>          (##core#require-extension (g2) #t)
         <syntax>          (##core#begin (##core#begin (##core#begin (##sys#require (quote g2))) (import g2)) (##core#undefined......
         <syntax>          (##core#begin (##core#begin (##sys#require (quote g2))) (import g2))
         <syntax>          (##core#begin (##sys#require (quote g2)))
         <syntax>          (##sys#require (quote g2))
         <syntax>          (quote g2)
         <syntax>          (##core#quote g2)
         <syntax>          (import g2)   <--

I've compiled g2 from sources without GD support and the egg seems to work fine with it:

 $ csi
 
 CHICKEN
 (c)2008-2011 The Chicken Team
 (c)2000-2007 Felix L. Winkelmann
 Version 4.7.0 
 linux-unix-gnu-x86 [ manyargs dload ptables ]
 compiled 2011-05-27 on dellito (Linux)
 
 ; loading /home/mario/.csirc ...
 csi> (use g2)
 ; loading /usr/local/chicken-4.7.0/lib/chicken/6/g2.import.so ...
 ; loading /usr/local/chicken-4.7.0/lib/chicken/6/easyffi.import.so ...
 ; loading /usr/local/chicken-4.7.0/lib/chicken/6/g2.so ...
 csi> (g2:open-gd)
 
 Error: (g2:open-gd) This procedure requires libgd to be installed
 
         Call history:
 
         <syntax>          (g2:open-gd)
         <eval>    (g2:open-gd)  <--

[2012-01-30 08:43:18 UTC] felix wrote:

Your change looks good! I'm not sure what to do about the library problem. Is it possible to check for this, possibly by linking a test-program?

[2014-03-04 22:59:00 UTC] felix wrote:

Can you try g2 1.3? I have used the same approach for libX11 support that you used for gd.

[2014-06-20 19:53:45 UTC] mario changed status from accepted to closed

[2014-06-20 19:53:45 UTC] mario set resolution to fixed

[2014-06-20 19:53:45 UTC] mario wrote:

Thanks a lot. Seems to work for me (g2 1.4):

 #;1> (use g2)
 #;2> (g2:open-x11 50 50)
 
 Error: (g2:open-x11) This procedure requires libX11 to be installed
 
         Call history:
 
         <syntax>          (g2:open-x11 50 50)
         <eval>    (g2:open-x11 50 50)   <--