#81 Cannot compile freeglut source under MingW or Cygwin

open
nobody
nuisance (37)
5
2005-08-05
2005-08-05
Carson Ball
No

When trying to compile the source under both MingW and
Cygwin, I receive errors from Make. I have posted the
tail end of the output below.

make[2]: Entering directory `/tmp/freeglut-2.4.0/src'
if /bin/sh ../libtool --mode=compile gcc
-DHAVE_CONFIG_H -I. -I. -I.. -I../include -g -O2
-Wall -pedantic -Werror -MT
libglut_la-freeglut_callbacks.lo -MD -MP -MF
".deps/libglut_la-freeglut_callbacks.Tpo" -c -o
libglut_la-freeglut_callbacks.lo `test -f
'freeglut_callbacks.c' || echo './'`freeglut_callbacks.c; \ then mv -f ".deps/libglut_la-freeglut_callbacks.Tpo"
".deps/libglut_la-freeglut_callbacks.Plo"; else rm -f
".deps/libglut_la-freeglut_callbacks.Tpo"; exit 1; fi
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -g -O2
-Wall -pedantic -Werror -MT
libglut_la-freeglut_callbacks.lo -MD -MP -MF
.deps/libglut_la-freeglut_callbacks.Tpo -c
freeglut_callbacks.c -DDLL_EXPORT -DPIC -o
.libs/libglut_la-freeglut_callbacks.o
freeglut_callbacks.c:293: warning:
'glutWindowStatusFunc' defined locally after being
referenced with dllimport linkage
make[2]: *** [libglut_la-freeglut_callbacks.lo] Error 1
make[2]: Leaving directory `/tmp/freeglut-2.4.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/freeglut-2.4.0'
make: *** [all] Error 2

Discussion

  • Carson Ball
    Carson Ball
    2005-08-06

    Logged In: YES
    user_id=1324769

    I found a fix for this issue.

    Edit the Makefile in the src directory and remove -Wall and
    -Werror

     
  • Richard Rauch
    Richard Rauch
    2005-08-09

    Logged In: YES
    user_id=854844

    I thought that the freeglut developers said that they had
    fixed these problems.

    Editing the Makefile is not really a fix, since the Makefile
    is generated output. That's like fixing a program by
    patching executable binary file. (^& However,
    --disable-warnings passed into ./configure will (if I
    remember freeglut correctly) give that effect from the source
    level.

    Even that isn't really a fix. The C source code should be
    fixed so that it doesn't have warnings/errors. Telling the
    compiler to ignore them may be necessary, but it's just a
    band-aid solution or workaround.

     
  • John Martin
    John Martin
    2005-11-30

    Logged In: YES
    user_id=1140700

    I found a fix for this error too. Linux compilers (like
    MinGW and Cygwin) don't use __declspec(dllexport) and
    __declspec(dllimport). Inside the freeglut_std.h file, I
    enclosed those in a #if defined(_MSC_VER) and put a #define
    FGAPI in a #else. After that, MinGW compiled fine.

     
  • Chris Marshall
    Chris Marshall
    2008-06-18

    Logged In: YES
    user_id=44920
    Originator: NO

    I just tried building freeglut-2.4.0 on cygwin 1.5.24(0.156/4/2) 2007-01-31
    with the following output from the make attempt:

    make all-recursive
    make[1]: Entering directory `/e/chm/opengl/POGL/freeglut-2.4.0'
    Making all in src
    make[2]: Entering directory `/e/chm/opengl/POGL/freeglut-2.4.0/src'
    source='freeglut_callbacks.c' object='libglut_la-freeglut_callbacks.lo' libtool=yes \ depfile='.deps/libglut_la-freeglut_callbacks.Plo' tmpdepfile='.deps/libglut_la-freeglut_callbacks.TPlo' \ depmode=gcc3 /bin/sh ../depcomp \ /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I/usr/X11R6/include -g -O2 -Wall -pedantic -Werror -c -o libglut_la-freeglut_callbacks.lo `test -f freeglut_callbacks.c || echo './'`freeglut_callbacks.c
    mkdir .libs
    gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I/usr/X11R6/include -g -O2 -Wall -pedantic -Werror -c freeglut_callbacks.c -MT libglut_la-freeglut_callbacks.lo -MD -MP -MF .deps/libglut_la-freeglut_callbacks.TPlo -DDLL_EXPORT -DPIC -o .libs/libglut_la-freeglut_callbacks.lo
    In file included from freeglut_callbacks.c:29:
    freeglut_internal.h:62:19: TCHAR.H: No such file or directory
    freeglut_callbacks.c:293: warning: 'glutWindowStatusFunc' defined locally after being referenced with dllimport linkage
    make[2]: *** [libglut_la-freeglut_callbacks.lo] Error 1
    make[2]: Leaving directory `/e/chm/opengl/POGL/freeglut-2.4.0/src'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/e/chm/opengl/POGL/freeglut-2.4.0'
    make: *** [all] Error 2

    This contrasts with freeglut-2.2.0 which builds out of the box on
    the same cygwin system. There is no TCHAR.H include file with
    cygwin so I commented the include line out...still an error.

    Then I removed __CYGWIN__ in the two spots in freeglut_std.h as
    well. At this point the make process proceeded smoothly until
    it hit freeglut_init.c where there was a warning about a function
    _T being implicitly defined. Looking at the MINGW include file
    I see that the _T() macro is defined there.

    Has anyone already gotten a build for freeglut-2.4.0 on a recent
    cygwin system. If so, is there a patch available?

    My long term goal is to get 2.4.0 working with cygwin
    for both the Mesa/GLX binding *and* for the win32/WGL
    binding.

     
  • Chris Marshall
    Chris Marshall
    2008-06-18

    Logged In: YES
    user_id=44920
    Originator: NO

    This cygwin build attempt was using gcc version 3.4.4.