Let me correct myself, I don't think that's good advice. Tempting as this
is:

$ env CSC_OPTIONS='-feature windows' ./
i686-w64-mingw32-chicken-opengl-1.22.sh

It will probably make everything think it's on windows, including macro
expansion and the first host-side build of the cross compilation. That is
not what we want.

Is PLATFORM=cross-linux-mingw set correctly in your make invokation when
building Chicken? If I'm not mistaken, that should first build on the host
(PLATFORM=linux) and then build things for the target (PLATFORM=windows).

Hope this gives you some pointers. cross-compilation is hard, and even
harder with macros/syntax!

K.

On Fri, Sep 25, 2026, 16:54 Kristian Lein-Mathisen <[email protected]>
wrote:

>
> Hi,
>
> I don't know if it's of much help, but it seems your cond-expand is using
> the fallbavk (-LX11 -L -lGLU), not the windows-specific. Probably because
> you're not _actually_ on windows.
>
> Perhaps try to edit your opengl.ogg file directly and see if that work.
> Otherwise, see if you can inject a register-feature! call [1]   before
> the build. I
>
>
> K.
> 1 https://api.call-cc.org/5/doc/chicken/platform#sec:register-feature.21
>
> On Wed, Sep 23, 2026, 15:01 YuGiOhJCJ via Chicken-users <
> [email protected]> wrote:
>
>> Hello,
>>
>> I am on Linux (64-bit).
>> I try to cross compile the opengl egg from Linux (64-bit) to Windows
>> (32-bit).
>> https://code.call-cc.org/egg-tarballs/5/opengl/opengl-1.22.tar.gz
>>
>> My first attempt was with this script:
>> $ cat i686-w64-mingw32-chicken-opengl-1.22.sh
>> set -e
>> NAME="i686-w64-mingw32-chicken-opengl"
>> VERSION="1.22"
>> DIR="opengl-${VERSION}"
>> DESTDIR="/tmp/${NAME}-${VERSION}"
>> tar xvf ${DIR}.tar.gz
>> cd ${DIR}
>> DESTDIR=${DESTDIR} CHICKEN_EGG_CACHE=/tmp/chicken-cache
>> i686-w64-mingw32-chicken-install
>>
>> Result:
>> $ ./i686-w64-mingw32-chicken-opengl-1.22.sh
>> opengl-1.22/
>> opengl-1.22/gl.scm
>> tar: opengl-1.22/gl.scm: implausibly old time stamp 1970-01-01 00:00:00
>> opengl-1.22/glu.scm
>> tar: opengl-1.22/glu.scm: implausibly old time stamp 1970-01-01 00:00:00
>> opengl-1.22/opengl.egg
>> tar: opengl-1.22/opengl.egg: implausibly old time stamp 1970-01-01
>> 00:00:00
>> tar: opengl-1.22: implausibly old time stamp 1970-01-01 00:00:00
>> building opengl
>>     /usr/bin/i686-w64-mingw32-csc -host -D compiling-extension -J -s
>> -regenerate-import-libraries -setup-mode -I
>> /tmp/build/i686-w64-mingw32/opengl-1.22 -C
>> -I/tmp/build/i686-w64-mingw32/opengl-1.22 -O2 -d1 -LX11 -L -lGLU glu.scm -o
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so
>>     /usr/bin/i686-w64-mingw32-csc -regenerate-import-libraries -M
>> -setup-mode -static -I /tmp/build/i686-w64-mingw32/opengl-1.22
>> -emit-link-file /tmp/build/i686-w64-mingw32/opengl-1.22/glu.link -host -D
>> compiling-extension -c -unit glu -D compiling-static-extension -C
>> -I/tmp/build/i686-w64-mingw32/opengl-1.22 -O2 -d1 glu.scm -o
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.static.o
>>     /usr/bin/i686-w64-mingw32-csc -setup-mode -s -host -I
>> /tmp/build/i686-w64-mingw32/opengl-1.22 -C
>> -I/tmp/build/i686-w64-mingw32/opengl-1.22 -O2 -d0 -LX11 -L -lGLU
>> glu.import.scm -o /tmp/build/i686-w64-mingw32/opengl-1.22/glu.import.so
>>     /usr/bin/i686-w64-mingw32-csc -host -D compiling-extension -J -s
>> -regenerate-import-libraries -setup-mode -I
>> /tmp/build/i686-w64-mingw32/opengl-1.22 -C
>> -I/tmp/build/i686-w64-mingw32/opengl-1.22 -O2 -d1 -LX11 -L -lGL gl.scm -o
>> /tmp/build/i686-w64-mingw32/opengl-1.22/gl.so
>>     /usr/bin/i686-w64-mingw32-csc -regenerate-import-libraries -M
>> -setup-mode -static -I /tmp/build/i686-w64-mingw32/opengl-1.22
>> -emit-link-file /tmp/build/i686-w64-mingw32/opengl-1.22/gl.link -host -D
>> compiling-extension -c -unit gl -D compiling-static-extension -C
>> -I/tmp/build/i686-w64-mingw32/opengl-1.22 -O2 -d1 gl.scm -o
>> /tmp/build/i686-w64-mingw32/opengl-1.22/gl.static.o
>>     /usr/bin/i686-w64-mingw32-csc -setup-mode -s -host -I
>> /tmp/build/i686-w64-mingw32/opengl-1.22 -C
>> -I/tmp/build/i686-w64-mingw32/opengl-1.22 -O2 -d0 -LX11 -L -lGL
>> gl.import.scm -o /tmp/build/i686-w64-mingw32/opengl-1.22/gl.import.so
>> installing opengl
>> building opengl (target)
>>     /usr/bin/i686-w64-mingw32-csc -D compiling-extension -J -s
>> -regenerate-import-libraries -setup-mode -I
>> /tmp/build/i686-w64-mingw32/opengl-1.22 -C
>> -I/tmp/build/i686-w64-mingw32/opengl-1.22 -O2 -d1 -LX11 -L -lGLU glu.scm -o
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.target
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c: In function 'stub1517':
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:107:28: warning: passing
>> argument 3 of 'gluNurbsCallback' from incompatible pointer type
>> [-Wincompatible-pointer-types]
>>    107 | gluNurbsCallback(a0 , a1 , a2);
>>        |                            ^~
>>        |                            |
>>        |                            void (*)()
>> In file included from /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:14:
>> /usr/i686-w64-mingw32/include/GL/glu.h:94:76: note: expected 'void
>> (__attribute__((stdcall)) *)()' but argument is of type 'void (*)()'
>>     94 | void APIENTRY gluNurbsCallback(GLUnurbs *nobj,GLenum which,void
>> (CALLBACK *fn)());
>>        |
>> ~~~~~~~~~~~~~~~~^~~~~
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c: In function 'stub1503':
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:119:30: warning: passing
>> argument 3 of 'gluQuadricCallback' from incompatible pointer type
>> [-Wincompatible-pointer-types]
>>    119 | gluQuadricCallback(a0 , a1 , a2);
>>        |                              ^~
>>        |                              |
>>        |                              void (*)()
>> In file included from /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:14:
>> /usr/i686-w64-mingw32/include/GL/glu.h:68:80: note: expected 'void
>> (__attribute__((stdcall)) *)()' but argument is of type 'void (*)()'
>>     68 | void APIENTRY gluQuadricCallback(GLUquadric *qobj,GLenum
>> which,void (CALLBACK *fn)());
>>        |
>> ~~~~~~~~~~~~~~~~^~~~~
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c: In function 'stub1489':
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:131:27: warning: passing
>> argument 3 of 'gluTessCallback' from incompatible pointer type
>> [-Wincompatible-pointer-types]
>>    131 | gluTessCallback(a0 , a1 , a2);
>>        |                           ^~
>>        |                           |
>>        |                           void (*)()
>> In file included from /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:14:
>> /usr/i686-w64-mingw32/include/GL/glu.h:78:80: note: expected 'void
>> (__attribute__((stdcall)) *)()' but argument is of type 'void (*)()'
>>     78 | void APIENTRY gluTessCallback(GLUtesselator *tess,GLenum
>> which,void (CALLBACK *fn)());
>>        |
>> ~~~~~~~~~~~~~~~~^~~~~
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c: In function 'stub1433':
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:153:8: warning: implicit
>> declaration of function 'gluUnProject4'; did you mean 'gluUnProject'?
>> [-Wimplicit-function-declaration]
>>    153 | return(gluUnProject4(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8
>> , a9 , a10 , a11 , a12));
>>        |        ^~~~~~~~~~~~~
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:137:54: note: in
>> definition of macro 'return'
>>    137 | #define return(x) C_cblock C_r = (C_int_to_num(&C_a,(x))); goto
>> C_ret; C_cblockend
>>        |                                                      ^
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c: In function 'stub1411':
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:164:1: warning: implicit
>> declaration of function 'gluNurbsCallbackDataEXT'; did you mean
>> 'gluNurbsCallback'? [-Wimplicit-function-declaratio ]
>>    164 | gluNurbsCallbackDataEXT(a0 , a1);
>>        | ^~~~~~~~~~~~~~~~~~~~~~~
>>        | gluNurbsCallback
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c: In function 'stub1400':
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:175:1: warning: implicit
>> declaration of function 'gluNurbsCallbackData'; did you mean
>> 'gluNurbsCallback'? [-Wimplicit-function-declaration]
>>    175 | gluNurbsCallbackData(a0 , a1);
>>        | ^~~~~~~~~~~~~~~~~~~~
>>        | gluNurbsCallback
>> In file included from /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:8:
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c: In function 'stub1389':
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:186:8: warning: implicit
>> declaration of function 'gluCheckExtension'
>> [-Wimplicit-function-declaration]
>>    186 | return(gluCheckExtension(a0 , a1));
>>        |        ^~~~~~~~~~~~~~~~~
>> /usr/i686-w64-mingw32/include/chicken/chicken.h:1048:50: note: in
>> definition of macro 'C_make_character'
>>   1048 | #define C_make_character(c)        (((((C_uword)(c)) &
>> C_CHAR_BIT_MASK) << C_CHAR_SHIFT) | C_CHARACTER_BITS)
>>        |                                                  ^
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:186:1: note: in
>> expansion of macro 'return'
>>    186 | return(gluCheckExtension(a0 , a1));
>>        | ^~~~~~
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c: In function 'stub1366':
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:203:8: warning: implicit
>> declaration of function 'gluBuild3DMipmaps'; did you mean
>> 'gluBuild2DMipmaps'? [-Wimplicit-function-declaration]
>>    203 | return(gluBuild3DMipmaps(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7));
>>        |        ^~~~~~~~~~~~~~~~~
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:192:54: note: in
>> definition of macro 'return'
>>    192 | #define return(x) C_cblock C_r = (C_int_to_num(&C_a,(x))); goto
>> C_ret; C_cblockend
>>        |                                                      ^
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c: In function 'stub1331':
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:223:8: warning: implicit
>> declaration of function 'gluBuild3DMipmapLevels'; did you mean
>> 'gluBuild2DMipmaps'? [-Wimplicit-function-declaratio ]
>>    223 | return(gluBuild3DMipmapLevels(a0 , a1 , a2 , a3 , a4 , a5 , a6 ,
>> a7 , a8 , a9 , a10));
>>        |        ^~~~~~~~~~~~~~~~~~~~~~
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:209:54: note: in
>> definition of macro 'return'
>>    209 | #define return(x) C_cblock C_r = (C_int_to_num(&C_a,(x))); goto
>> C_ret; C_cblockend
>>        |                                                      ^
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c: In function 'stub1295':
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:242:8: warning: implicit
>> declaration of function 'gluBuild2DMipmapLevels'; did you mean
>> 'gluBuild2DMipmaps'? [-Wimplicit-function-declaratio ]
>>    242 | return(gluBuild2DMipmapLevels(a0 , a1 , a2 , a3 , a4 , a5 , a6 ,
>> a7 , a8 , a9));
>>        |        ^~~~~~~~~~~~~~~~~~~~~~
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:229:54: note: in
>> definition of macro 'return'
>>    229 | #define return(x) C_cblock C_r = (C_int_to_num(&C_a,(x))); goto
>> C_ret; C_cblockend
>>        |                                                      ^
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c: In function 'stub1262':
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:260:8: warning: implicit
>> declaration of function 'gluBuild1DMipmapLevels'; did you mean
>> 'gluBuild1DMipmaps'? [-Wimplicit-function-declaratio ]
>>    260 | return(gluBuild1DMipmapLevels(a0 , a1 , a2 , a3 , a4 , a5 , a6 ,
>> a7 , a8));
>>        |        ^~~~~~~~~~~~~~~~~~~~~~
>> /tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.c:248:54: note: in
>> definition of macro 'return'
>>    248 | #define return(x) C_cblock C_r = (C_int_to_num(&C_a,(x))); goto
>> C_ret; C_cblockend
>>        |                                                      ^
>> /usr/lib/gcc/i686-w64-mingw32/11.4.0/../../../../i686-w64-mingw32/bin/ld:
>> cannot find -lGLU
>> collect2: error: ld returned 1 exit status
>>
>> Error: shell command terminated with non-zero exit status 256:
>> 'i686-w64-mingw32-gcc' '/tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.o'
>> -o '/tmp/build/i686-w64-mingw32/opengl-1.22/glu.so.target' '-shared'
>> '-LX11' '-lGLU' '-L/usr/i686-w64-mingw32/lib'
>> '-Wl,-rpath=/usr/i686-w64-mingw32/lib' -lchicken -lm -lws2_32
>>
>> Error: shell command terminated with nonzero exit code
>> 256
>> "sh /tmp/build/i686-w64-mingw32/opengl-1.22/opengl.build.target.sh"
>>
>> As we can see, the problem here is that GLU is not found.
>> I think this is normal for a Windows (32-bit) target because Windows
>> should use "-lopengl32" and "-lglu32" instead of "-lGL" and "-lGLU".
>> This is what we can see in opengl-1.22/opengl.egg:
>> $ cat opengl-1.22/opengl.egg
>> ;;; opengl.egg
>>
>> ((synopsis "OpenGL bindings")
>>   (category graphics)
>>   (license "BSD")
>>   (dependencies bind silex)
>>   (author "felix winkelmann")
>>   (components
>>     (extension glu
>>                 (cond-expand
>>                   (windows
>>                     (link-options "-lopengl32" "-lglu32"))
>>                   (macosx
>>                     (csc-options "-FOpenGL")
>>                     (link-options "-L" "-framework OpenGL"
>>                                   "-L" "-framework Foundation"))
>>                   (openbsd
>>                     (csc-options "-I/usr/X11R6/include"
>> "-I/usr/local/include")
>>                     (link-options "-L/usr/X11R6/lib" "-L/usr/X11R6/lib"
>>                                   "-LX11" "-L/usr/local/lib" "-L"
>> "-lGLU"))
>>                   (else
>>                     (link-options "-LX11" "-L" "-lGLU"))))
>>     (extension gl
>>                (cond-expand
>>                  (windows
>>                    (link-options "-lopengl32"))
>>                  (macosx
>>                    (csc-options "-FOpenGL")
>>                    (link-options "-L" "-framework OpenGL"
>>                                  "-L" "-framework Foundation"))
>>                  (openbsd
>>                    (csc-options "-I/usr/X11R6/include"
>> "-I/usr/local/include")
>>                    (link-options "-L/usr/X11R6/lib" "-L/usr/X11R6/lib"
>>                                  "-LX11" "-L/usr/local/lib" "-L" "-lGL"))
>>                  (else
>>                    (link-options "-LX11" "-L" "-lGL"))))))
>>
>> So, I am stuck here.
>>
>> Can you help me please?
>>
>> Thank you.
>> Best regards.
>>
>>

Reply via email to