[OpenSCAD] Openscad crash on Intersection()

Brad Pitcher bradpitcher at gmail.com
Sun Jan 29 06:55:00 CET 2012


I thought it might be something about CALLBACK, I just couldn't see where
it was coming from. That sounds like the right assessment and the right
fix. I plugged it in and it does compile.
 On Sat, Jan 28, 2012 at 8:17 PM, Don Bright <hugh.m.bright at gmail.com>wrote:

> imho the problem is that OGL_helper is using gluTessellator, which
> needs CALLBACK defined.
>
> under MINGW, windows.h and various other associated include files wind
> up defining CALLBACK to be __attribute__((__stdcall__)).
>
> qgl.h includes QtCore/qt_windows.h, which includes windows.h
>
> when you take out qgl.h, but only include glew.h, and gl.h, then
> windows.h never gets #included.
>
> glew.h "fakes" windows.h, defines CALLBACK, then undefines it. it
> never includes windows.h or windef.h or the rest, and it leaves
> CALLBACK undefined, so when you compile OGL_helper.h, the string
> "CALLBACK" is just sitting there in your code, "inline void CALLBACK
> beginCallback(...", causing the build error you are seeing.
>
> including 'glut.h' will work because under mingw32, glut.h #includes
> windows.h
>
> imho adding something like this to system-gl.h might work pretty well,
> and it will fix problems if someone uses glu callbacks from outside of
> OGL_helper.h
>
> #ifdef _WIN32
> #include windows.h" // CALLBACK
> #endif
>
> -DB
>
> On Sat, Jan 28, 2012 at 9:42 PM, Brad Pitcher <bradpitcher at gmail.com>
> wrote:
> > OK, so I managed to get it to compile by including GL/glut.h as well for
> > Windows. I have no idea why that works though, since the compile error
> isn't
> > one of those helpful messages.
> >
> > diff --git a/src/OGL_helper.h b/src/OGL_helper.h
> > index 74f92bf..0a0b606 100644
> > --- a/src/OGL_helper.h
> > +++ b/src/OGL_helper.h
> > @@ -36,6 +36,7 @@
> >
> >  #ifdef _WIN32
> >  #define CGAL_GLU_TESS_CALLBACK CALLBACK
> > +#include <GL/glut.h>
> >  #else
> >  #define CGAL_GLU_TESS_CALLBACK
> >  #endif
> >
> >
> > On Sat, Jan 28, 2012 at 4:53 PM, Brad Pitcher <bradpitcher at gmail.com>
> wrote:
> >>
> >> It likes like a recent commit
> >> (
> https://github.com/openscad/openscad/commit/1ffcaae04d577619c1956e96bec47008098a2ed7
> )
> >> broke the windows build:
> >>
> >> i686-pc-mingw32-g++ -c -pipe -fno-keep-inline-dllexport
> >> -fno-strict-aliasing -fpermissive -frounding-math -DEIGEN_DONT_ALIGN -O2
> >> -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
> >> -DOPENSCAD_VERSION=2012.01.28 -DOPENSCAD_YEAR=2012.0
> -DOPENSCAD_MONTH=01.0
> >> -DOPENSCAD_DAY=28.0 -DOPENSCAD_COMMIT=1202107 -DUSE_PROGRESSWIDGET
> >> -DENABLE_CGAL -DENABLE_OPENCSG -DGLEW_STATIC -DBOOST_STATIC
> >> -DBOOST_THREAD_USE_LIB -DBoost_USE_STATIC_LIBS -DQT_NO_DEBUG
> -DQT_OPENGL_LIB
> >> -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT
> >> -I'mingw-cross-env/include/eigen2'
> >> -I'../mingw-cross-env/usr/i686-pc-mingw32/include/QtCore'
> >> -I'../mingw-cross-env/usr/i686-pc-mingw32/include/QtGui'
> >> -I'../mingw-cross-env/usr/i686-pc-mingw32/include/QtOpenGL'
> >> -I'../mingw-cross-env/usr/i686-pc-mingw32/include' -I'src'
> >> -I'/home/brad/code/mingw-cross-env/usr/i686-pc-mingw32/include/ActiveQt'
> >> -I'objects' -I'objects'
> >>
> -I'../mingw-cross-env/usr/i686-pc-mingw32/mkspecs/unsupported/win32-g++-4.6-cross'
> >> -o objects/CGALRenderer.o src/CGALRenderer.cc
> >>
> >> In file included from src/CGAL_renderer.h:30:0,
> >>
> >>                  from src/CGALRenderer.cc:37:
> >>
> >> src/OGL_helper.h:223:38: error: expected initializer before
> >> 'beginCallback'
> >>
> >> src/OGL_helper.h:226:38: error: expected initializer before
> 'endCallback'
> >>
> >> src/OGL_helper.h:229:38: error: expected initializer before
> >> 'errorCallback'
> >>
> >> src/OGL_helper.h:236:38: error: expected initializer before
> >> 'vertexCallback'
> >>
> >> src/OGL_helper.h:246:38: error: expected initializer before
> >> 'combineCallback'
> >>
> >> src/CGALRenderer.cc:143:1: error: expected '}' at end of input
> >>
> >> src/CGALRenderer.cc:143:1: error: expected '}' at end of input
> >>
> >> make[1]: *** [objects/CGALRenderer.o] Error 1
> >>
> >> If I switch back to qgl.h, the build succeeds. Apparently there's
> >> something needed from qgl.h that's not in GL/gl.h or glew.h?
> >> The Linux build still seems to be working. Any idea how to fix this?
> >>
> >> On Sat, Jan 28, 2012 at 10:16 AM, Marius Kintel <marius at kintel.net>
> wrote:
> >>>
> >>>
> >>> On Jan 28, 2012, at 18:13 PM, Pasca Andrei wrote:
> >>>
> >>> > I checked both the binary and the installer and both fail again with
> >>> > the same error. However, both files report the same date and git
> version as
> >>> > in the previous build - 2012.01.25 git d8ee4bd.
> >>>
> >>> Looks like the wrong version.
> >>>
> >>> > And while we're here - I wonder if the bug and the bug fix affects
> not
> >>> > only the intersection but also the difference, since also this one
> can
> >>> > result in empty trees after normalization?
> >>>
> >>> Both should be fixed.
> >>>
> >>>  -Marius
> >>>
> >>
> >
> >
> > _______________________________________________
> > OpenSCAD mailing list
> > OpenSCAD at rocklinux.org
> > http://rocklinux.net/mailman/listinfo/openscad
> >
> _______________________________________________
> OpenSCAD mailing list
> OpenSCAD at rocklinux.org
> http://rocklinux.net/mailman/listinfo/openscad
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rocklinux.net/pipermail/openscad/attachments/20120129/ec42b78f/attachment.html


More information about the OpenSCAD mailing list