Opened 8 years ago

Closed 5 years ago

#769 closed defect (fixed)

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

Reported by: felix winkelmann Owned by: Mario Domenech Goulart
Priority: major Milestone:
Component: extensions Version: 4.7.x
Keywords: g2 Cc:
Estimated difficulty:

Description

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

Change History (4)

comment:1 Changed 8 years ago by Mario Domenech Goulart

Status: newaccepted

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)  <--

comment:2 Changed 8 years ago by felix winkelmann

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?

comment:3 Changed 6 years ago by felix winkelmann

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

comment:4 Changed 5 years ago by Mario Domenech Goulart

Resolution: fixed
Status: acceptedclosed

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)   <--

Note: See TracTickets for help on using tickets.