GLfloat on a Mac

Hi folks I thought I'd try a bit of OpenGL. Perhaps I should send this to the more specific list, but perhaps other people are, like me, trying out a variety of UI technology. I thought I'd give OpenGL a go, because I saw the name whizz by when I upgraded to 6.8.3. I found the tutorial and got copy-paste cracking. It was all going swimmingly while I did almost nothing, but then ghc started dying on me. I chopped down my failing code to this joyous specimen: HelloWorld.lhs contains ----------------------------------
module Main where
import Graphics.Rendering.OpenGL import Graphics.UI.GLUT
myFloat :: GLfloat myFloat = 0.0
main = return ()
---------------------------------- $ ghc -package GLUT HelloWorld.lhs -o HelloWorld Illegal instruction I'm using ghc 6.8.3 on a Mac PowerBook G4. Googling "OpenGL illegal instruction" produced an unending choice of horror stories. What message am I not getting? Is there some crucial manual I'm not reading? Is there something which we should be being told on the relevant wiki page? Distressed Conor

On 2008 Aug 12, at 5:11, Conor McBride wrote:
$ ghc -package GLUT HelloWorld.lhs -o HelloWorld Illegal instruction
I'm using ghc 6.8.3 on a Mac PowerBook G4. Googling "OpenGL illegal instruction" produced an unending choice of horror stories.
What message am I not getting? Is there some crucial manual I'm not reading? Is there something which we should be being told on the relevant wiki page?
You need to find (or build) a G4-compatible ghc; the 6.8.3 build for Leopard (and Tiger?) was built for a G5, and the above is the result. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

Hi Thanks for the quick response. On 12 Aug 2008, at 10:18, Brandon S. Allbery KF8NH wrote:
On 2008 Aug 12, at 5:11, Conor McBride wrote:
$ ghc -package GLUT HelloWorld.lhs -o HelloWorld Illegal instruction
I'm using ghc 6.8.3 on a Mac PowerBook G4. Googling "OpenGL illegal instruction" produced an unending choice of horror stories.
What message am I not getting? Is there some crucial manual I'm not reading? Is there something which we should be being told on the relevant wiki page?
You need to find (or build) a G4-compatible ghc; the 6.8.3 build for Leopard (and Tiger?) was built for a G5, and the above is the result.
This sounds like bad news to me. I wonder how broken this G5 ghc is for a G4. Perhaps it should be labelled G5 rather than PowerPC in the large print. I'm quite scared about trying to build ghc: I worry that it may involve confronting large areas of my ignorance. I'm running Mac OS X 10.4.11 on a 1.5GHz PowerPC G4 PowerBook with 768MB of memory. I've got gcc 4.0.0. I'm using the 6.8.3 build whose entry on this page http://www.haskell.org/ghc/download_ghc_683.html reads ----- MacOS X (PowerPC) * ghc-6.8.3-powerpc-apple-darwin.tar.bz2 This is a binary distribution for Mac OS X 10.4 (Tiger) on PowerPC G5 machines, prepared by Christian Maeder. It needs libreadline. 5.2.dylib and libncurses.5.dylib under /opt/local/lib/. libgmp.a is statically linked in. ----- Now I'm wondering how badly I've shot myself in the foot. Alarmed Conor

Conor McBride wrote:
This sounds like bad news to me. I wonder how broken this G5 ghc is for a G4. Perhaps it should be labelled G5 rather than PowerPC in the large print. I'm quite scared about trying to build ghc: I worry that it may involve confronting large areas of my ignorance.
I'm running Mac OS X 10.4.11 on a 1.5GHz PowerPC G4 PowerBook with 768MB of memory. I've got gcc 4.0.0. I'm using the 6.8.3 build whose entry on this page
FWIW, I use ghc on my G4 and I got it by compiling from MacPorts. It took the best part of day, but the resulting binary works. Jules

On 12 Aug 2008, at 11:19, Jules Bean wrote:
Conor McBride wrote:
This sounds like bad news to me. I wonder how broken this G5 ghc is for a G4. Perhaps it should be labelled G5 rather than PowerPC in the large print. I'm quite scared about trying to build ghc: I worry that it may involve confronting large areas of my ignorance. I'm running Mac OS X 10.4.11 on a 1.5GHz PowerPC G4 PowerBook with 768MB of memory. I've got gcc 4.0.0. I'm using the 6.8.3 build whose entry on this page
FWIW, I use ghc on my G4 and I got it by compiling from MacPorts.
It took the best part of day, but the resulting binary works.
I'm not sure whirl is the right word, but I'll give it one anyway. Cheers Conor

On 12 Aug 2008, at 11:27, Conor McBride wrote:
On 12 Aug 2008, at 11:19, Jules Bean wrote:
FWIW, I use ghc on my G4 and I got it by compiling from MacPorts.
It took the best part of day, but the resulting binary works.
I'm not sure whirl is the right word, but I'll give it one anyway.
After a very long time, it fell over with a large error message that I don't understand. Somehow, I'll get over it. I can't help thinking that this stuff shouldn't be hard. And yet it is. Sorry to anyone for whom this is just spam, and much gratitude to clued in people who can tell me in which particular way I'm being an idiot at the moment. All the best Conor

Conor McBride wrote:
After a very long time, it fell over with a large error message that I don't understand.
Somehow, I'll get over it.
I can't help thinking that this stuff shouldn't be hard. And yet it is. Sorry to anyone for whom this is just spam, and much gratitude to clued in people who can tell me in which particular way I'm being an idiot at the moment.
It used to be easier. I don't know why it isn't any more. This trac bug seems relevant http://hackage.haskell.org/trac/ghc/ticket/2262 There is a workaround suggested there. I don't know why this happens for you and not for the port uploader. There are many things I fail to understand about building on OSX :( Jules

On 12 Aug 2008, at 16:55, Conor McBride wrote:
On 12 Aug 2008, at 11:27, Conor McBride wrote:
On 12 Aug 2008, at 11:19, Jules Bean wrote:
FWIW, I use ghc on my G4 and I got it by compiling from MacPorts.
It took the best part of day, but the resulting binary works.
I'm not sure whirl is the right word, but I'll give it one anyway.
After a very long time, it fell over with a large error message that I don't understand.
Somehow, I'll get over it.
I can't help thinking that this stuff shouldn't be hard. And yet it is. Sorry to anyone for whom this is just spam, and much gratitude to clued in people who can tell me in which particular way I'm being an idiot at the moment.
All the best
Conor
FWIW my experience is that my experience of getting GHC running on a Mac got dramatically better as soon as I bought an Intel based mac. Firstly the compile times are *vastly* reduced (we're talking from 24 hours to 1 hour, or even 20 minutes on a Mac Pro). Secondly, and more importantly, more people seem to have intel macs, and are willing to devote their time to getting it working nicely on them, so in general, you tell it to build once, and it works. Bob

$ ghc -package GLUT HelloWorld.lhs -o HelloWorld Illegal instruction
I'm using ghc 6.8.3 on a Mac PowerBook G4. Googling "OpenGL illegal instruction" produced an unending choice of horror stories.
Not much help, but it compiles fine for me using ghc-6.8.3 on an iBook G4. I'm running MacOS 10.5.4, with gcc-4.0.1. Is it possible you have an older version of XCode (Apple's developer tools including gcc)? Regards, Malcolm

On 12 Aug 2008, at 11:11, Conor McBride wrote:
Hi folks
I thought I'd try a bit of OpenGL. Perhaps I should send this to the more specific list, but perhaps other people are, like me, trying out a variety of UI technology. I thought I'd give OpenGL a go, because I saw the name whizz by when I upgraded to 6.8.3. I found the tutorial and got copy-paste cracking.
It was all going swimmingly while I did almost nothing, but then ghc started dying on me. I chopped down my failing code to this joyous specimen:
HelloWorld.lhs contains
----------------------------------
module Main where
import Graphics.Rendering.OpenGL import Graphics.UI.GLUT
myFloat :: GLfloat myFloat = 0.0
main = return ()
----------------------------------
$ ghc -package GLUT HelloWorld.lhs -o HelloWorld Illegal instruction
I'm using ghc 6.8.3 on a Mac PowerBook G4. Googling "OpenGL illegal instruction" produced an unending choice of horror stories.
What message am I not getting? Is there some crucial manual I'm not reading? Is there something which we should be being told on the relevant wiki page?
Distressed
Conor
I was going to say that this builds and runs fine on my MacPro so it could be an endianness issue, but Malcolm's experience seems to contradict that. Bob
participants (5)
-
Brandon S. Allbery KF8NH
-
Conor McBride
-
Jules Bean
-
Malcolm Wallace
-
Thomas Davie