Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-10

OpenGL and glut bugs in Freepascal 2.1.1 running with Mac Os X Tiger ?

12 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Nexus

I have problems with Freepascal 2.1.1 using Mac OS X 10.4.2 Tiger when running Freepascal Applications which use OpenGL and glut. The sources are compiled without any warnings but when i run them on the shell they crash instantly with an unhandled exeception EInvalidOp: Invalid floating point operation and some memory adresses shown on the screen. The strange thing about this is when i start the programs after i ran an application using glut written in C or C++, i can start my freepascal programs and they run without any error. They then just crash, when they are running in window mode and i click on the services menuitem in the program menu (they crash with the same exception EInvalidOP: Invalid floating point operation, but some times even this works). After quitting the freepascal open gl program my terminal (shell) is not working correctly anymore (happens only when running OpenGL applications with glut), keystrokes are not seen anymore and CRLF doesn't work any longer. Intrestingly this also happens with Linux Version of the compiler (PPC). The same sources compiled with the windows version under Windows XP are working without any errors or problems. The sources where running on my ibook g4 with Mac OS X 10.3 Panther and Freepascal 1.9.9.5 without any problems, so i can't tell whether it is Tiger or the new beta version of the free pascal compiler or some faults on my system which cause the problems.

Reply by email

Sebastian Günther
to Nexus
I have problems with Freepascal 2.1.1 using Mac OS X 10.4.2 Tiger when running Freepascal Applications which use OpenGL and glut.

just a small remark from me as maintainer of the OpenGL package: Unfortunately I cannot help you in this matter, as I don't have a MacOS X system for testing.
But who enabled OpenGL for Mac anyway...?

- Sebastian

Reply by email

Florian Klaempfl
to Sebastian Günther
Show quoted text 9 lines
Nexus schrieb: > I have problems with Freepascal 2.1.1 using Mac OS X 10.4.2 Tiger > when running Freepascal Applications which use OpenGL and glut. just a small remark from me as maintainer of the OpenGL package: Unfortunately I cannot help you in this matter, as I don't have a MacOS X system for testing. But who enabled OpenGL for Mac anyway...?

Probably Jonas?

Reply by email

Nexus
to Florian Klaempfl

I don't know, but it already worked on the older versions of fpc (before 2.0.0) on Mac OS X 10.3 Panther quite nice and without any errors.

The error message i do now get on the console (after the program crashes) is the following:

An unhandled exception occurred at $903E68B8 :
EInvalidOp : Invalid floating point operation
$903E68B8
$945772A0
$94577184
$9029C2F4
$9029D43C
$9029BDA4
$9029BB6C
$945769B0
$94575444
$903E1B84
$903E103C
$903E028C
$945E2884
$903DECC8
$903DEC18
$903DEA30
$9024F74C

So it first seems to be some error in the fpu code generation of the compiler. But the strange things is, after running a C-Program which uses glut and open gl everything just works fine. So maybe there is something wrong in the open gl / glut initialization part or some incompatibilities with Mac OS X 10.4

Here's a very minimalistic fpc opengl glut program which produces the error from above:

Program Tutor01;
Uses GL, GLUT;
Procedure reshape(width, height : longint); CDecl;
Var aspect : glFloat;
Begin
  glViewport(0, 0, width, height); //change viewport to complete window
  if height <= 0 then height := 1; // just to be sure that there will be no
division by zero
  glMatrixMode(GL_PROJECTION);     //I want to change the projection matrix
  glLoadIdentity;                  //First load the identity matrix
  aspect := width / height;        //calculate the aspect ratio
  glFrustum(-1.0*aspect, 1.0*aspect, 1.0, -1.0, 1.0, 20.0); //and produce
our viewing space
  glMatrixMode(GL_MODELVIEW);      //someone might want to change the
viewing matrix, so switch back
  glLoadIdentity;                  //load the identity matrix
  glutPostRedisplay;               //tell GLUT we want to draw
End;
Procedure draw; CDecl;
Begin
  glClear(GL_COLOR_BUFFER_BIT);    //clear the screen or window
  glBegin(GL_QUADS);               //we want to draw a QUAD
    glVertex3f(-0.5, -0.5, -2.0);  //top-left corner
    glVertex3f(-0.5,  0.5, -2.0);  //bottom-left corner
    glVertex3f( 0.5,  0.5, -2.0);  //bottom-right corner
    glVertex3f( 0.5, -0.5, -2.0);  //top-right what, yes, corner
  glEnd;
  glFlush;                  //tell OpenGL is should empty its command buffer
(execute all commands)
  glutSwapBuffers;          //tell GLUT to actually show the nice white
square
End;
Begin
  glutInit(@argc, argv);           //let GLUT do some initialization
  glutInitDisplayMode(GLUT_RGB or GLUT_DOUBLE); //make the window highcolor,
double buffered
  glutCreateWindow('Tutorial 01'); //now create the first window
  glutDisplayFunc(@draw);          //register callback functions
  glutReshapeFunc(@reshape);
  glutMainLoop;                    //and now actually run
End.

After running the program i get the following error report from Mac OS:

Date/Time: 2005-11-01 21:48:36.593 +0100
OS Version: 10.4.2 (Build 8C46)
Report Version: 3

Command: Tutorial1
Path: ./Tutorial1
Parent: bash [139]

Version: ??? (???)

PID: 224
Thread: 0

Exception: EXC_ARITHMETIC (0x0003)
Code[0]: 0x00000003
Code[1]: 0xe2002193

Thread 0 Crashed:
0 com.apple.CoreGraphics 0x903e68b8 mergeQuadratic + 1176 1 com.apple.CoreGraphics 0x903e5be4 CGSScanconverterRenderMask + 212 2 libCGATS.A.dylib 0x945772a0 glyph_path_end + 212 3 libCGATS.A.dylib 0x94577184 EndPath + 92 4 ATS 0x9029c2f4 ProcessQuadraticOutlinePath(unsigned long, unsigned short const*, unsigned long, unsigned char* const*, void const*) + 1000
5 ATS 0x9029d43c OldGlyphsCacheRun(TStrike*, int, unsigned long, unsigned short const*, void (*)(unsigned long, unsigned short const*, unsigned long, unsigned char* const*, void const*), void*) + 536 6 ATS 0x9029bda4 _eGCGetGlyphNativeOutlinePath + 532 7 ATS 0x9029bb6c GCGetGlyphNativeOutlinePath + 112 8 libCGATS.A.dylib 0x945769b0 ats_path_builder_get_paths + 344 9 libCGATS.A.dylib 0x94575444 ats_32bit_create_glyph_bitmaps + 612 10 com.apple.CoreGraphics 0x903e1b84 build_missing_bitmaps + 484 11 com.apple.CoreGraphics 0x903e103c lock_bitmaps + 432 12 com.apple.CoreGraphics 0x903e028c CGFontLockBitmaps + 368 13 libRIP.A.dylib 0x945e2884 ripc_DrawGlyphs + 1204 14 com.apple.CoreGraphics 0x903decc8 CGContextDelegateDrawGlyphs + 108 15 com.apple.CoreGraphics 0x903dec18 drawGlyphs + 284 16 com.apple.CoreGraphics 0x903dea30 CGContextShowGlyphsWithAdvances + 208 17 com.apple.CoreText 0x9024f74c TLine::DrawGlyphs(CGContext*) const + 116
18 com.apple.CoreText 0x90210c34 CTLineDraw + 88 19 com.apple.HIToolbox 0x9315a674
TCoreTextEngine::DrawThemeTextBox(_HIThemeTextInfo*, CGRect const&, unsigned long, CGContext*) + 1128
20 com.apple.HIToolbox 0x93159f3c DataEngine::DrawTextBox(__CFString const*, CGRect const*, _HIThemeTextInfo*, CGContext*) + 168 21 com.apple.HIToolbox 0x93159d9c HIThemeDrawTextBox + 304 22 com.apple.HIToolbox 0x9315988c
HIMenuBarView::DrawTextTitle(MenuData*, CGRect const*, __CFString const*, unsigned short, CGContext*) + 244
23 com.apple.HIToolbox 0x93153d44 HIMenuBarView::DrawSelf(short, __HIShape const*, CGContext*) + 744
24 com.apple.HIToolbox 0x93153808 HIView::DrawCacheOrSelf(short, __HIShape const*, CGContext*) + 328
25 com.apple.HIToolbox 0x93153564 HIView::SendDraw(short, OpaqueGrafPtr*, __HIShape const*, CGContext*) + 100 26 com.apple.HIToolbox 0x932b38c0
HIView::RecursiveDrawComposited(__HIShape const*, unsigned long, HIView*, CGContext*, unsigned char) + 548
27 com.apple.HIToolbox 0x932b39e0
HIView::RecursiveDrawComposited(__HIShape const*, unsigned long, HIView*, CGContext*, unsigned char) + 836
28 com.apple.HIToolbox 0x932b3640 HIView::DrawComposited(short, OpaqueGrafPtr*, __HIShape const*, unsigned long, HIView*, CGContext*) + 580 29 com.apple.HIToolbox 0x93143178
UpdateWindowVisibility(VisChangeState*) + 340
30 com.apple.HIToolbox 0x93142f8c _ShowHideWindows + 160 31 com.apple.HIToolbox 0x93142edc ShowHide + 36 32 com.apple.HIToolbox 0x931528c8 MBarDraw() + 76 33 com.apple.HIToolbox 0x9314a884 DrawMenuBar + 172 34 com.apple.HIToolbox 0x9314ac68 ShowBar(unsigned char, unsigned char)
+ 312
35 com.apple.HIToolbox 0x931f7254 SetSystemUIMode + 240 36 com.apple.AppKit 0x936203fc -[NSApplication finishLaunching] + 476
37 com.apple.glut 0x97ac92fc -[GLUTApplication run] + 112 38 com.apple.glut 0x97ad9a78 glutMainLoop + 164 39 Tutorial1 0x00002d58 main + 168
40 Tutorial1 0x000025cc start + 412 41 Tutorial1 0x0000246c start + 60

Thread 0 crashed with PPC Thread State 64:
srr0: 0x00000000903e68b8 srr1: 0x000000000210f930
vrsave: 0x0000000000000000
cr: 0x44422428 xer: 0x0000000000000004 lr: 0x00000000903e5be4 ctr: 0x0000000000000000
r0: 0x0000000043300000 r1: 0x00000000bfffa410 r2: 0x00000000ffffffff r3: 0x000000000285d508
r4: 0x0000000002867490 r5: 0x0000000000000038 r6: 0x00000000ffffffff r7: 0x0000000000000004
r8: 0x000000000000000b r9: 0x0000000090686428 r10: 0x0000000000000004 r11: 0x0000000000000005
r12: 0x0000000000000005 r13: 0x0000000000000000 r14: 0x0000000000000001 r15: 0x0000000000000000
r16: 0x0000000000000002 r17: 0x0000000000000002 r18: 0x0000000000000001 r19: 0x00000000bfffb954
r20: 0x00000000bfffc1dc r21: 0x0000000000000007 r22: 0x0000000000000000 r23: 0x00000000022f4330
r24: 0x0000000000000018 r25: 0x00000000bfffa4e0 r26: 0x000000000285dc00 r27: 0x00000000fffffffd
r28: 0x0000000000000070 r29: 0x0000000000000000 r30: 0x0000000000000038 r31: 0x00000000903e6428

Binary Images Description:
0x1000 - 0x45fff Tutorial1
/Users/nexus/Programming/Pascal/GDV/mini/Tutorial1 0x415000 - 0x42efff GLDriver
/System/Library/Frameworks/OpenGL.framework/Versions/A/Resources/GLDriver.bundle/GLDriver 0x434000 - 0x454fff GLRendererFloat
/System/Library/Frameworks/OpenGL.framework/Versions/A/Resources/GLRendererFloat.bundle/GLRendererFloat 0x605000 - 0x703fff GLEngine
/System/Library/Frameworks/OpenGL.framework/Resources/GLEngine.bundle/GLEngine 0x731000 - 0x7c0fff GLRasterARGB8888D32
/System/Library/Frameworks/OpenGL.framework/Resources/GLRasterARGB8888D32.bundle/GLRasterARGB8888D32 0x1008000 - 0x12a8fff com.apple.ATIRadeon8500GLDriver 1.4.6 (4.0.6) /System/Library/Extensions/ATIRadeon8500GLDriver.bundle/Contents/MacOS/ATIRadeon8500GLDriver 0x8fe00000 - 0x8fe51fff dyld 43.1 /usr/lib/dyld
0x90000000 - 0x901a6fff libSystem.B.dylib /usr/lib/libSystem.B.dylib 0x901fe000 - 0x90202fff libmathCommon.A.dylib
/usr/lib/system/libmathCommon.A.dylib
0x90204000 - 0x90257fff com.apple.CoreText 1.0.0 (???) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/CoreText 0x90284000 - 0x90335fff ATS
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS 0x90364000 - 0x9069dfff com.apple.CoreGraphics 1.256.14 (???) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics 0x90728000 - 0x90801fff com.apple.CoreFoundation 6.4.3 (368.12) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x9084a000 - 0x9084afff com.apple.CoreServices 10.4 (???) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices 0x9084c000 - 0x9094efff libicucore.A.dylib /usr/lib/libicucore.A.dylib 0x909a8000 - 0x90a2cfff libobjc.A.dylib /usr/lib/libobjc.A.dylib 0x90a56000 - 0x90acafff com.apple.framework.IOKit 1.4 (???) /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit 0x90ae4000 - 0x90af6fff libauto.dylib /usr/lib/libauto.dylib 0x90afd000 - 0x90dc2fff com.apple.CoreServices.CarbonCore 10.4.1 (611.1) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore 0x90e25000 - 0x90ea5fff com.apple.CoreServices.OSServices 4.0 (4.0.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices 0x90eef000 - 0x90f2ffff com.apple.CFNetwork 10.4.2 (80) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/A/CFNetwork 0x90f44000 - 0x90f5cfff com.apple.WebServices 1.1.2 (1.1.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/WebServicesCore.framework/Versions/A/WebServicesCore 0x90f6c000 - 0x90feafff com.apple.SearchKit 1.0.3
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit 0x9102f000 - 0x91056fff com.apple.Metadata 1.1 (121.6) /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata 0x91066000 - 0x91074fff libz.1.dylib /usr/lib/libz.1.dylib 0x91077000 - 0x91239fff com.apple.security 4.0.1 (223) /System/Library/Frameworks/Security.framework/Versions/A/Security 0x9133b000 - 0x91344fff com.apple.DiskArbitration 2.1 /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration 0x9134b000 - 0x91372fff com.apple.SystemConfiguration 1.8.0 /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration 0x91385000 - 0x9138dfff libbsm.dylib /usr/lib/libbsm.dylib 0x91391000 - 0x9140ffff com.apple.audio.CoreAudio 3.0.1 /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio 0x9144d000 - 0x9144dfff com.apple.ApplicationServices 10.4 (???) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices 0x9144f000 - 0x91487fff com.apple.AE 1.5 (297)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE 0x914a2000 - 0x9156dfff com.apple.ColorSync 4.4
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSync.framework/Versions/A/ColorSync 0x915c2000 - 0x91655fff com.apple.print.framework.PrintCore 4.0 (172.1) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore 0x9169b000 - 0x91758fff com.apple.QD 3.8.16 (???)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD 0x91796000 - 0x917f4fff com.apple.HIServices 1.5.0 (???) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices 0x91822000 - 0x91845fff com.apple.LangAnalysis 1.6 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis 0x91859000 - 0x9187efff com.apple.FindByContent 1.5 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/FindByContent.framework/Versions/A/FindByContent 0x91891000 - 0x918d2fff com.apple.LaunchServices 10.4.3 (157) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices 0x918ed000 - 0x91901fff com.apple.speech.synthesis.framework 3.3 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis 0x9190f000 - 0x91945fff com.apple.ImageIO.framework 1.0.2 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO 0x91959000 - 0x91a1ffff libcrypto.0.9.7.dylib
/usr/lib/libcrypto.0.9.7.dylib
0x91a6c000 - 0x91a81fff libcups.2.dylib /usr/lib/libcups.2.dylib 0x91a86000 - 0x91aa2fff libJPEG.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib 0x91aa7000 - 0x91b16fff libJP2.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJP2.dylib 0x91b2d000 - 0x91b31fff libGIF.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libGIF.dylib 0x91b33000 - 0x91b4bfff libRaw.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libRaw.dylib 0x91b4e000 - 0x91b91fff libTIFF.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib 0x91b98000 - 0x91bb1fff libPng.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib 0x91bb6000 - 0x91bb9fff libRadiance.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libRadiance.dylib 0x91bbb000 - 0x91bbbfff com.apple.Accelerate 1.1.1 (Accelerate 1.1.1) /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate 0x91bbd000 - 0x91ca7fff com.apple.vImage 2.0
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage 0x91caf000 - 0x91ccefff com.apple.Accelerate.vecLib 3.1.1 (vecLib 3.1.1) /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib 0x91d3a000 - 0x91d5afff libmx.A.dylib /usr/lib/libmx.A.dylib 0x91d60000 - 0x91dc5fff libvMisc.dylib
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib 0x91dcf000 - 0x91e61fff libvDSP.dylib
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib 0x91e7b000 - 0x9240bfff libBLAS.dylib
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 0x92453000 - 0x92763fff libLAPACK.dylib
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib 0x92790000 - 0x9281bfff com.apple.DesktopServices 1.3 /System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv 0x9285d000 - 0x92a86fff com.apple.Foundation 6.4.1 (567.12) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation 0x92ba4000 - 0x92c82fff libxml2.2.dylib /usr/lib/libxml2.2.dylib 0x92ca2000 - 0x92d90fff libiconv.2.dylib /usr/lib/libiconv.2.dylib 0x92da2000 - 0x92dc0fff libGL.dylib
/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib 0x92dcb000 - 0x92e25fff libGLU.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib 0x92e71000 - 0x92e81fff com.apple.speech.recognition.framework 3.4 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SpeechRecognition.framework/Versions/A/SpeechRecognition 0x930dc000 - 0x930f9fff com.apple.audio.SoundManager 3.9 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CarbonSound.framework/Versions/A/CarbonSound 0x93121000 - 0x93431fff com.apple.HIToolbox 1.4.3 (???) /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox 0x9357c000 - 0x93588fff com.apple.opengl 1.4.0
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL 0x9361c000 - 0x93c4dfff com.apple.AppKit 6.4.2 (824.11) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x93fd9000 - 0x94043fff com.apple.CoreData 1.0 (46) /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData 0x9407b000 - 0x94145fff com.apple.audio.toolbox.AudioToolbox 1.4.1 /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox 0x94199000 - 0x94199fff com.apple.audio.units.AudioUnit 1.4 /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit 0x9419b000 - 0x942fafff com.apple.QuartzCore 1.4.1 /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore 0x94342000 - 0x9437ffff libsqlite3.0.dylib /usr/lib/libsqlite3.0.dylib 0x94387000 - 0x943d2fff libGLImage.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLImage.dylib 0x94573000 - 0x94582fff libCGATS.A.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libCGATS.A.dylib 0x9458a000 - 0x94596fff libCSync.A.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libCSync.A.dylib 0x945db000 - 0x945effff libRIP.A.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libRIP.A.dylib 0x979df000 - 0x97a6bfff libGLProgrammability.dylib /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLProgrammability.dylib 0x97a91000 - 0x97a92fff libGLSystem.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLSystem.dylib 0x97abb000 - 0x97afbfff com.apple.glut 3.3.6 (GLUT-3.3.6) /System/Library/Frameworks/GLUT.framework/GLUT

Model: PowerBook6,5, BootROM 4.8.5f0, 1 processors, PowerPC G4 (1.1), 1.07 GHz, 512 MB
Graphics: ATI Mobility Radeon 9200, ATY,RV280M9+, AGP, 32 MB Memory Module: DIMM0/BUILT-IN, 256 MB, built-in, built-in Memory Module: DIMM1/J31, 256 MB, DDR SDRAM, PC2700U-25330 AirPort: AirPort Extreme, 400.17 (3.90.34.0.p11)
Modem: Jump, , V.92, Version 1.0,
Network Service: Ethernet (integriert), Ethernet, en0 Parallel ATA Device: MATSHITACD-RW CW-8123,
Parallel ATA Device: FUJITSU MHT2030AT, 27.94 GB

I will try to run this on Mac OS X 10.3 to see what happens there, will try to build a snapshot version of the fpc compiler (with olle's help) but if anybody has some idea why this does not work, i would be happy to hear about it.

Thanks for your help.

Earlier message 23 lines
----- Original Message ----- From: "Florian Klaempfl" To: "FPC developers' list" Sent: Monday, October 31, 2005 9:22 PM Subject: Re: [fpc-devel] OpenGL and glut bugs in Freepascal 2.1.1 runningwith Mac Os X Tiger ? >> Nexus schrieb: >>> I have problems with Freepascal 2.1.1 using Mac OS X 10.4.2 Tiger >>> when running Freepascal Applications which use OpenGL and glut. >> >> just a small remark from me as maintainer of the OpenGL package: >> Unfortunately I cannot help you in this matter, as I don't have a MacOS >> X system for testing. >> But who enabled OpenGL for Mac anyway...? >> > > Probably Jonas? > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-devel >

Reply by email

Adriaan van Os
to Nexus
Nexus wrote 10 lines
<snip> An unhandled exception occurred at $903E68B8 : EInvalidOp : Invalid floating point operation <snip> So it first seems to be some error in the fpu code generation of the compiler. But the strange things is, after running a C-Program which uses glut and open gl everything just works fine. So maybe there is something wrong in the open gl / glut initialization part or some incompatibilities with Mac OS X 10.4 <snip>

Just a guess - could this be the same problem as discussed in the

where Jonas Maebe wrote 14 lines
>>> Are these exceptions by default disabled by gcc ? >> >> The FPC runtime explicitly turns them on by default (since they are >> required for detecting errors), while libc doesn't. It is >> independent of the compiler used. >> > > So, if I understand it correct, you wont get a aritmic exeption in > FPC anymore when this is turned on ? The "invalid fpu operation" exceptions are turned on in the FPC system unit initialisation code. If you add the code I posted, they are turned off again and so you won't get them (not due to buggy code in the Carbon framework and not anywhere else either).

Regards,

Adriaan van Os

Reply by email

Jonas Maebe
to Adriaan van Os
Adriaan van Os wrote 14 lines
> <snip> > An unhandled exception occurred at $903E68B8 : > EInvalidOp : Invalid floating point operation > <snip> > So it first seems to be some error in the fpu code generation of > the compiler. But the strange things is, after running a C-Program > which uses glut and open gl everything just works fine. So maybe > there is something wrong in the open gl / glut initialization part > or some incompatibilities with Mac OS X 10.4 > <snip> Just a guess - could this be the same problem as discussed in the "[fpc-devel] MacOSX: EXC_ARITHMETIC in PerformHIConversion" thread, where Jonas Maebe wrote:

Yes, probably, and that also explains why I can't reproduce this problem (the other problem didn't occur on my system either). You an try whether it's this by adding "uses macpas" to the start of your program, that one turns off the overflow/underflow exceptions.

Jonas

Reply by email

Matthias Krenzer
to Adriaan van Os: Just a guess - could this be the same problem as discussed in the "[fpc-devel] MacOSX:…

----- Original Message -----

Earlier message 75 lines
From: "Adriaan van Os" To: "FPC developers' list" Sent: Thursday, November 03, 2005 10:48 AM Subject: Re: [fpc-devel] OpenGL and glut bugs in Freepascal 2.1.1runningwith Mac Os X Tiger ? > Nexus wrote: > >> <snip> >> An unhandled exception occurred at $903E68B8 : >> EInvalidOp : Invalid floating point operation >> <snip> >> So it first seems to be some error in the fpu code generation of the >> compiler. But the strange things is, after running a C-Program which uses >> glut and open gl everything just works fine. So maybe there is something >> wrong in the open gl / glut initialization part or some incompatibilities >> with Mac OS X 10.4 >> <snip> > > Just a guess - could this be the same problem as discussed in the > "[fpc-devel] MacOSX: EXC_ARITHMETIC in PerformHIConversion" thread, where > Jonas Maebe wrote: > >>>>> Are these exceptions by default disabled by gcc ? >>>> >>>> The FPC runtime explicitly turns them on by default (since they are >>>> required for detecting errors), while libc doesn't. It is independent >>>> of the compiler used. >>>> >>> >>> So, if I understand it correct, you wont get a aritmic exeption in FPC >>> anymore when this is turned on ? >> >> The "invalid fpu operation" exceptions are turned on in the FPC system >> unit initialisation code. If you add the code I posted, they are turned >> off again and so you won't get them (not due to buggy code in the Carbon >> framework and not anywhere else either). > > Regards, > > Adriaan van Os > > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-devel > Thank you very much for your help (all of you). You were absolutely right. It seems to be the same problem as discussed in the "[fpc-devel] MacOSX: EXC_ARITHMETIC in PerformHIConversion" thread. I ran the programs with Mac OS X 10.3 and they were running just fine. They just crash with Mac OS X 10.4.x. It seems to be the same bug in the Carbon framework under Mac OS X 10.4.x mentioned in this thread, which causes to generate invalid floating point operation exceptions in some cases. By disabling these exceptions as mentioned in the EXEC_ARITHMETIC thread with asm mtfsfi 6,1 end; everything works now with Mac OS X 10.4 as it should. But two questions remain: 1.) Why are the fpc applications running fine after running some open gl applications written in c ? (maybe i didn't get it yet, sorry) 2.) It does not sound very safe to turn of the floating point exceptions forever (or at least until Mac OS X 10.5). Is there any possibility to create some clean workaround without needing the divine intervention of the apple fixing the carbon libs in 10.4 ? Thanks again

Reply by email

Jonas Maebe
to Matthias Krenzer
Matthias Krenzer wrote
1.) Why are the fpc applications running fine after running some open gl applications written in c ? (maybe i didn't get it yet, sorry)

Since we don't know what the bug in the Carbon framework is, that's hard to guess. And for some people, C programs in which the fpu overflow exceptions are enabled crash as well.

2.) It does not sound very safe to turn of the floating point exceptions forever (or at least until Mac OS X 10.5).

There's nothing unsafe about it (except if you want your program to crash if it produces an fpu overflow).

Is there any possibility to create some clean workaround without needing the divine intervention of the apple fixing the carbon libs in 10.4 ?

Since no one has a clue what causes the problem (except that it seems to have something to do with fonts and possibly language settings), I'm not sure how we could make another workaround than disabling the exceptions.

Jonas

Reply by email

peter green
to Jonas Maebe

would it be feasible to turn them off just for calls into the carbon framework and have them on the rest of the time?

Show quoted text 37 lines
-----Original Message----- From: Behalf Of Jonas Maebe Sent: 04 November 2005 21:32 To: FPC developers' list Subject: Re: [fpc-devel] OpenGL and glut bugs in Freepascal2.1.1runningwith Mac Os X Tiger ? On 04 Nov 2005, at 22:23, Matthias Krenzer wrote: > 1.) Why are the fpc applications running fine after running some > open gl applications written in c ? (maybe i didn't get it yet, sorry) Since we don't know what the bug in the Carbon framework is, that's hard to guess. And for some people, C programs in which the fpu overflow exceptions are enabled crash as well. > 2.) It does not sound very safe to turn of the floating point > exceptions forever (or at least until Mac OS X 10.5). There's nothing unsafe about it (except if you want your program to crash if it produces an fpu overflow). > Is there any possibility to create some clean workaround without > needing the divine intervention of the apple fixing the carbon libs > in 10.4 ? Since no one has a clue what causes the problem (except that it seems to have something to do with fonts and possibly language settings), I'm not sure how we could make another workaround than disabling the exceptions. Jonas _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Adriaan van Os
to Jonas Maebe: Since we don't know what the bug in the Carbon framework is, that's hard to guess. And…
Jonas Maebe wrote 8 lines
> Is there any possibility to create some clean workaround without > needing the divine intervention of the apple fixing the carbon libs > in 10.4 ? Since no one has a clue what causes the problem (except that it seems to have something to do with fonts and possibly language settings), I'm not sure how we could make another workaround than disabling the exceptions.

What does the CrashReporter log look like ? For what system calls does it crash in your code ? Try to wrap those calls with fpu exception disablers/enablers.

Regards,

Adriaan van Os

Reply by email

Jonas Maebe
to peter green: would it be feasible to turn them off just for calls into the carbon framework and have…
peter green wrote
would it be feasible to turn them off just for calls into the carbon framework and have them on the rest of the time?

How do you propose that the compiler could find out whether or not a procedure resides in the Carbon framework, or possibly eventually calls through to the Carbon framework? Not to mention callbacks for carbon timers etc...

Jonas

Reply by email

Jonas Maebe
to Adriaan van Os: What does the CrashReporter log look like ? For what system calls does it crash in your…
Adriaan van Os wrote 10 lines
>> Is there any possibility to create some clean workaround without >> needing the divine intervention of the apple fixing the carbon >> libs in 10.4 ? > > Since no one has a clue what causes the problem (except that it > seems to have something to do with fonts and possibly language > settings), I'm not sure how we could make another workaround than > disabling the exceptions. What does the CrashReporter log look like ?

http://lists.freepascal.org/lists/fpc-devel/2005-November/006353.html

For what system calls does it crash in your code ?

The problem is that it doesn't crash on my G5 nor on my iBook G4. It only crashes on some people's systems. And it crashes very deep inside calls below carbon actually, in CoreGraphics, while constructing some font path (the above crashlog doesn't even mention Carbon, but the previous GUI hello-world crash logs did, which is why I was talking about Carbon all the time).

Try to wrap those calls with fpu exception disablers/enablers.

You'd have to wrap anything which will potentially draw a glyph on screen. That's not feasible, I think.

Jonas

Reply by email