D.gnu - OS X, gdc and opengl
- Brad Beveridge (28/28) Mar 20 2005 Hi all, I'm wanting to play with D and openGL on a Mac. I've managed to...
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (12/22) Mar 20 2005 The linker *does* recognize it, so you can use -Wl,-framework,-OpenGL
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (4/5) Mar 20 2005 Make that -Wl,-framework,OpenGL ... (silly typo snuck in)
- Brad Beveridge (11/22) Mar 20 2005 Thanks for that Anders. I am recompiling gdc now - why did I delete it!...
- Brad Beveridge (3/3) Mar 20 2005 I'll reply to my own message - Thanks for the typo correction, I think I...
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (15/21) Mar 20 2005 "-framework" goes to the compiler, which will choke on the unrecognized
- Brad Beveridge (20/51) Mar 20 2005 Sorry for being so dense - I seem to be close, but not quite there yet
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (5/13) Mar 21 2005 You need a special version of the SDLmain, that initializes the D
- Brad Beveridge (8/11) Mar 21 2005 boohoo, sob! :)
- Brad Beveridge (4/9) Mar 22 2005 Hi again Anders - these examples that you mention, can you please tell
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (4/6) Mar 22 2005 They're not updated and online just yet...
- Brad Beveridge (2/13) Mar 22 2005 Fantastic, thanks!
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (6/9) Mar 25 2005 Seems like the next GDC version will be a while,
- Brad Beveridge (4/19) Mar 25 2005 Thanks Anders. I don't mind waiting :) I've got plenty to do to figure...
- brad domain.invalid (9/24) Mar 28 2005 I played with your CVS tree last night, and managed to get the testgl
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (4/8) Mar 28 2005 Should be, just that the D name mangling is a little "strange"...
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (9/11) Mar 20 2005 "/sw/lib":
- Brad Beveridge (5/23) Mar 20 2005 Thanks for all the great tips and help Anders. As you might have
- Brad Beveridge (4/22) Mar 20 2005 What is the default version for GDC on OS X (ie, linux, Win32, etc) -
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (10/12) Mar 20 2005 While the polished version has not been released, the raw patches have:
Hi all, I'm wanting to play with D and openGL on a Mac. I've managed to compile vanilla GCC sources with the GDC patch, and can happily compile the example app. However, I can't figure out how to link against opengl libraries. Apple's version of GCC has a -framework option, which GDC and vanilla GCC don't recognise. My next step was to try to compile Apple's GCC tree with the D patches, and have run into the following error ../../gcc3/gcc/d/d-lang.cc: In function `bool d_mark_addressable(tree_node*)': ../../gcc3/gcc/tree.h:2944: error: too few arguments to function `void put_var_into_stack(tree_node*, int)' ../../gcc3/gcc/d/d-lang.cc:898: error: at this point in file ../../gcc3/gcc/d/d-lang.cc: At global scope: ../../gcc3/gcc/d/d-lang.cc:1358: error: invalid conversion from `rtx_def*(*)(tree_node*, rtx_def*, machine_mode, int, rtx_def**)' to `rtx_def*(*)(tree_node*, rtx_def*, machine_mode, int)' I don't mind banging my head against the wall to try and fix either of these problems, but if someone has already figured it out, well that would be nice :) So, 1) Is there a way to link vanilla gcc+gdc with opengl on Mac OSX? 2) Is there a way around the error I get when compiling Apple's GCC? Also, I tried to enable --altivec on the vanilla GCC build and the build failed due to some "forcecpusubtype_ALL" option missing - am I missing something here? Thanks much Brad
Mar 20 2005
Brad Beveridge wrote:Hi all, I'm wanting to play with D and openGL on a Mac. I've managed to compile vanilla GCC sources with the GDC patch, and can happily compile the example app. However, I can't figure out how to link against opengl libraries. Apple's version of GCC has a -framework option, which GDC and vanilla GCC don't recognise.The linker *does* recognize it, so you can use -Wl,-framework,-OpenGL I have done a patch to add -framework support and some other Mac stuff to the GDC build, but it has not been released yet... (and it probably won't be for another weeks/months, either)My next step was to try to compile Apple's GCC tree with the D patches,As you found out, this does not work... Apple's GCC tree has *tons* of patches.Also, I tried to enable --altivec on the vanilla GCC build and the build failed due to some "forcecpusubtype_ALL" option missing - am I missing something here?Yeah, that AltiVec doesn't work either? :-P You can write a function in C (*not* using Altivec registers outwards), compile it with Apple's compiler and then link it with the D programs. The same song-and-dance routine is required for using PPC assembler... --anders
Mar 20 2005
The linker *does* recognize it, so you can use -Wl,-framework,-OpenGLMake that -Wl,-framework,OpenGL ... (silly typo snuck in) As in: LDFLAGS=-Wl,-framework,OpenGL -Wl,-framework,GLUT -lobjc --anders
Mar 20 2005
Anders F Björklund wrote:Brad Beveridge wrote:Thanks for that Anders. I am recompiling gdc now - why did I delete it! :) I don't quite understand what you are saying with the linker recognising -framework, could you please post a trivial example of how to compile & link a D file that needs OpenGL? I tried opengltestd: opengltest.d gdc $< -I../SDL -L/sw/lib -lSDLmain -lSDL -framework OpenGL -lpthread -lGL -lglut -lGLU -o $ And had no luck - google also didn't turn up any hints for me. Thanks BradHi all, I'm wanting to play with D and openGL on a Mac. I've managed to compile vanilla GCC sources with the GDC patch, and can happily compile the example app. However, I can't figure out how to link against opengl libraries. Apple's version of GCC has a -framework option, which GDC and vanilla GCC don't recognise.The linker *does* recognize it, so you can use -Wl,-framework,-OpenGL
Mar 20 2005
I'll reply to my own message - Thanks for the typo correction, I think I get it now :) Just looked very odd with -Wl,-framework,-OpenGL Brad
Mar 20 2005
Brad Beveridge wrote:I don't quite understand what you are saying with the linker recognising -framework, could you please post a trivial example of how to compile & link a D file that needs OpenGL? I tried"-framework" goes to the compiler, which will choke on the unrecognized option. By using "-Wl", you can pass whatever you want to the linker...opengltestd: opengltest.d gdc $< -I../SDL -L/sw/lib -lSDLmain -lSDL -framework OpenGL -lpthread -lGL -lglut -lGLU -o $You did not say that you wanted to use SDL, which is lots more fun since it is written in Objective-C and requires a patched SDLmain library... But anyway, the libraries are: LDFLAGS_GL=-Wl,-framework,OpenGL -Wl,-framework,GLUT -lobjc LDFLAGS_SDL=-Wl,-framework,SDL -Wl,-framework,Cocoa -Lsdl -lSDLmain_d On Linux, they would instead be: LDFLAGS_GL=-lGL -lGLUT LDFLAGS_SDL=-lSDL I should have an updated example up sometime next week. The old example does not compile at the moment, but when it did it was running both GL "gears" and SDL "testbitmap". --anders
Mar 20 2005
Anders F Björklund wrote:Brad Beveridge wrote:Sorry for being so dense - I seem to be close, but not quite there yet Here is my compile command gdc opengltest.d -o opengltestd -I../SDL -L/sw/lib -Wl,-framework,OpenGL -Wl,-framework,GLUT -lobjc -lSDL -Wl,-framework,Cocoa -lSDLmain /usr/bin/ld: Undefined symbols: _SDL_main collect2: ld returned 1 exit status I couldn't use your command as I got this error gdc opengltest.d -o opengltestd -I../SDL -L/sw/lib -Wl,-framework,OpenGL -Wl,-framework,GLUT -lobjc -Wl,-framework,SDL -Wl,-framework,Cocoa -lSDLmain_d /usr/bin/ld: can't locate framework for: -framework SDL I've tried to get the OSX SDL framework installed, but to no avail. The SDL source fails in the ./configure stage (threading unsupported!), and the SDL OSX devel libraries specifically say the framework is not installed & to get it from the sources. Any help is much appreciated. Cheers BradI don't quite understand what you are saying with the linker recognising -framework, could you please post a trivial example of how to compile & link a D file that needs OpenGL? I tried"-framework" goes to the compiler, which will choke on the unrecognized option. By using "-Wl", you can pass whatever you want to the linker...opengltestd: opengltest.d gdc $< -I../SDL -L/sw/lib -lSDLmain -lSDL -framework OpenGL -lpthread -lGL -lglut -lGLU -o $You did not say that you wanted to use SDL, which is lots more fun since it is written in Objective-C and requires a patched SDLmain library... But anyway, the libraries are: LDFLAGS_GL=-Wl,-framework,OpenGL -Wl,-framework,GLUT -lobjc LDFLAGS_SDL=-Wl,-framework,SDL -Wl,-framework,Cocoa -Lsdl -lSDLmain_d On Linux, they would instead be: LDFLAGS_GL=-lGL -lGLUT LDFLAGS_SDL=-lSDL I should have an updated example up sometime next week. The old example does not compile at the moment, but when it did it was running both GL "gears" and SDL "testbitmap". --anders
Mar 20 2005
Brad Beveridge wrote:You need a special version of the SDLmain, that initializes the D runtime. It also needs to be called from your "main(char[][] args)"You did not say that you wanted to use SDL, which is lots more fun since it is written in Objective-C and requires a patched SDLmain library...I've tried to get the OSX SDL framework installed, but to no avail. The SDL source fails in the ./configure stage (threading unsupported!), and the SDL OSX devel libraries specifically say the framework is not installed & to get it from the sources.Any help is much appreciated.SDL code will come later, just use plain GLUT in the meantime ? --anders
Mar 21 2005
<SNIP>SDL code will come later, just use plain GLUT in the meantime ? --andersboohoo, sob! :) Yeah, maybe I'm jumping in just a tad deep. I'll back off and play with GLUT. I probably ought to become familiar with the Apple way of doing development also. All of my linux play apps are SDL based, so hopefully when I get a little smarter they'll all "Just Work" on OSX. Thanks for the help Anders Brad
Mar 21 2005
I should have an updated example up sometime next week. The old example does not compile at the moment, but when it did it was running both GL "gears" and SDL "testbitmap". --andersHi again Anders - these examples that you mention, can you please tell me were to find them? Thanks Brad
Mar 22 2005
Brad Beveridge wrote:Hi again Anders - these examples that you mention, can you please tell me were to find them?They're not updated and online just yet... They'll be on http://www.algonet.se/~afb/d/ --anders
Mar 22 2005
Anders F Björklund wrote:Brad Beveridge wrote:Fantastic, thanks!Hi again Anders - these examples that you mention, can you please tell me were to find them?They're not updated and online just yet... They'll be on http://www.algonet.se/~afb/d/ --anders
Mar 22 2005
Brad Beveridge wrote:Seems like the next GDC version will be a while, and so will a coherent download of SDL/GL for Mac. If you're anxious to get started, see my CVS rep. (or email me privately, it shouldn't be that hard) --andersThey're not updated and online just yet...Fantastic, thanks!
Mar 25 2005
Anders F Björklund wrote:Brad Beveridge wrote:Thanks Anders. I don't mind waiting :) I've got plenty to do to figure out how best to use OSX as a development environment. BradSeems like the next GDC version will be a while, and so will a coherent download of SDL/GL for Mac. If you're anxious to get started, see my CVS rep. (or email me privately, it shouldn't be that hard) --andersThey're not updated and online just yet...Fantastic, thanks!
Mar 25 2005
Anders F Björklund wrote:Brad Beveridge wrote:I played with your CVS tree last night, and managed to get the testgl program working fine. So I can start playing with my own SDL/D/MacOS stuff now :) Thanks for the good work. I take it the SDL stuff you've done is open source, or somesuch? Also, do you know if it is possible to profile GDC apps with Shark? I've heard a lot about Shark & I think I may play with that next. BradSeems like the next GDC version will be a while, and so will a coherent download of SDL/GL for Mac. If you're anxious to get started, see my CVS rep. (or email me privately, it shouldn't be that hard) --andersThey're not updated and online just yet...Fantastic, thanks!
Mar 28 2005
brad domain.invalid wrote:Thanks for the good work. I take it the SDL stuff you've done is open source, or somesuch?It's under the same license as the C headers, i.e. LGPL for SDLAlso, do you know if it is possible to profile GDC apps with Shark? I've heard a lot about Shark & I think I may play with that next.Should be, just that the D name mangling is a little "strange"... --anders
Mar 28 2005
Brad Beveridge wrote:gdc $< -I../SDL -L/sw/lib -lSDLmain -lSDL -framework OpenGL -lpthread -lGL -lglut -lGLU -o $"/sw/lib": By the way, I wouldn't recommended mixing GDC and Fink at the moment! In my own setup, I have Apple's original stuff living under /usr, Fink under /sw, GDC under /opt/gdc and my own hacks in /usr/local... The current GDC does not really fit into the /usr or /sw hierarchies, since it might cause conflicts with the default GCC compilers used ? And it also makes it easier to uninstall, without a package manager. --anders
Mar 20 2005
Anders F Björklund wrote:Brad Beveridge wrote:Thanks for all the great tips and help Anders. As you might have guessed, I am new (about 5 days) to the OSX world. I'm expecting to make quite a few bloopers yet :) Bradgdc $< -I../SDL -L/sw/lib -lSDLmain -lSDL -framework OpenGL -lpthread -lGL -lglut -lGLU -o $"/sw/lib": By the way, I wouldn't recommended mixing GDC and Fink at the moment! In my own setup, I have Apple's original stuff living under /usr, Fink under /sw, GDC under /opt/gdc and my own hacks in /usr/local... The current GDC does not really fit into the /usr or /sw hierarchies, since it might cause conflicts with the default GCC compilers used ? And it also makes it easier to uninstall, without a package manager. --anders
Mar 20 2005
Anders F Björklund wrote:Brad Beveridge wrote:What is the default version for GDC on OS X (ie, linux, Win32, etc) - and how should I find out (apart from asking here :) Bradgdc $< -I../SDL -L/sw/lib -lSDLmain -lSDL -framework OpenGL -lpthread -lGL -lglut -lGLU -o $"/sw/lib": By the way, I wouldn't recommended mixing GDC and Fink at the moment! In my own setup, I have Apple's original stuff living under /usr, Fink under /sw, GDC under /opt/gdc and my own hacks in /usr/local... The current GDC does not really fit into the /usr or /sw hierarchies, since it might cause conflicts with the default GCC compilers used ? And it also makes it easier to uninstall, without a package manager. --anders
Mar 20 2005
Brad Beveridge wrote:Apple's version of GCC has a -framework option, which GDC and vanilla GCC don't recognise.While the polished version has not been released, the raw patches have: http://dstress.kuehne.cn/raw_results/mac-OS-X-10.3.7_gdc-0.10-patch/ gcc-3.3.5-framework-headers.patch gcc-3.3.5-framework-linker.patch gdc-0.8-framework.patch taken from the original Apple source code for Xcode version 1.1, at: http://www.opensource.apple.com/darwinsource/DevToolsDec2003/gcc-1495/ (haven't checked if they updated the patches in Xcode 1.2 or 1.5, but) --anders
Mar 20 2005