View previous topic :: View next topic |
Author |
Message |
afb
Joined: 26 Jan 2005 Posts: 137 Location: Sweden
|
Posted: Thu May 25, 2006 8:44 am Post subject: Derelict on Mac, Status |
|
|
The SDL examples crash at runtime due to the wrong "SDL_main",
the GL examples don't build since no "loadPlatformGL" just yet...
Build places the object files in the current directory with the "buildme",
but I'm sure that's just a flag that you can pass to put it next to source ?
Path patches for the _Load functions coming separately, for "darwin".
Searching: frameworks (3 locations) /opt/local (DP) /sw (Fink) /usr/local |
|
Back to top |
|
|
JoeCoder
Joined: 29 Oct 2005 Posts: 294
|
Posted: Thu May 25, 2006 1:23 pm Post subject: |
|
|
I haven't looked at all of them, but some of the libraries in the bindings project have code for version(darwin).
I'd be anxious to see derelict run on Mac myself, but since I don't have a Mac box (nor do I know much about them), it's only Win32 and linux for me. |
|
Back to top |
|
|
afb
Joined: 26 Jan 2005 Posts: 137 Location: Sweden
|
Posted: Fri May 26, 2006 6:51 am Post subject: |
|
|
To be perfectly clear, SDL and OpenGL is working fine on the Mac with GDC.
The thing we're talking about here is loading it through Derelict, nothing else. |
|
Back to top |
|
|
afb
Joined: 26 Jan 2005 Posts: 137 Location: Sweden
|
Posted: Fri May 26, 2006 7:19 am Post subject: |
|
|
Here are the commands I use to build it:
Code: |
# ./buildme DerelictUtil
# mv *.o DerelictUtil/derelict/util
# ./buildme DerelictUtil
# ranlib lib/libDerelictUtil.a
# ./buildme DerelictSDL
# mv *.o DerelictSDL/derelict/sdl
# ./buildme DerelictSDL
# ranlib lib/libDerelictSDL.a
# cd examples
# gdmd sdl_ex1.d -I../DerelictUtil -I../DerelictSDL ../lib/libDerelictSDL.a ../lib/libDerelictUtil.a
|
The extra time is because Build puts the .o files in the current directory,
and because you need to an extra "ranlib" on Darwin after moving a lib.
(the above builds, but it doesn't work) |
|
Back to top |
|
|
Jedive
Joined: 01 Jan 2007 Posts: 7
|
Posted: Mon Jan 01, 2007 10:55 am Post subject: |
|
|
Quote: | To be perfectly clear, SDL and OpenGL is working fine on the Mac with GDC. |
Sorry for resurrecting an old post, but I thought it was better to post here than to start a new thread... how can I use SDL and OpenGL with GDC on the Mac without using Derelict?
Sorry, I am new to D. |
|
Back to top |
|
|
Crispy
Joined: 26 Nov 2005 Posts: 67
|
Posted: Tue Jan 02, 2007 2:04 am Post subject: |
|
|
I'm new to Macs too, and have no idea... but I'm not sure why you wouldn't want to use Derelict. It does work, and well. |
|
Back to top |
|
|
michael
Joined: 23 Aug 2006 Posts: 13
|
Posted: Tue Jan 02, 2007 3:55 pm Post subject: |
|
|
Jedive wrote: | [...] how can I use SDL and OpenGL with GDC on the Mac without using Derelict? |
Already know about this one?
http://shinh.skr.jp/d/porting.html
But I unfortunately don't know if it's working for Mac, too. |
|
Back to top |
|
|
Jedive
Joined: 01 Jan 2007 Posts: 7
|
Posted: Tue Jan 02, 2007 8:56 pm Post subject: |
|
|
Quote: | I'm not sure why you wouldn't want to use Derelict. It does work, and well. | Then... does Derelict work on Mac?
No, I'm new to D, but many thanks for the link!
Nice to see a newspost in OSNews only a few days after I start to play with D... |
|
Back to top |
|
|
Crispy
Joined: 26 Nov 2005 Posts: 67
|
Posted: Wed Jan 03, 2007 12:09 am Post subject: |
|
|
Crispy wrote: | I did manage to get it to compile, but only with minor source modifications (mostly just adding filenames for the Mac versions of libraries). I haven't been able to try running it properly yet, since I can't figure out how to build dynamic libraries (of the type that the Unix-style loader will load) of SDL (etc.) on Mac. |
I know next to nothing about Macs, but I have seen two different ways of loading libraries in some open source code I've looked at. I know that frameworks/bundles can be loaded in Cocoa via NSBundle (or CFBundle?) routines. I'm also aware that dylibs can be loaded via a family of functions related to NSAddImage. Apparently, Apple discourages the use of the latter and recommends the former only.
If someone with a Mac could implement framework/bundle loading in DerelictUtil, that would go a long way toward where we want to be. From that point on it really would just be a matter of adding the proper file names to the loaders (baring any GDC issues with the code base). I suppose we could, on Mac, actually implement all three styles: loading of bundles, loading of dylibs, and loading of unix .so libraries, based on file extension (does anyone actually use so files on Mac?).
If I could spare the cash to buy a Mac right now, I would do so and knock this out. This, right now, is the last major hurdle to get over. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Wed Jan 03, 2007 4:50 am Post subject: |
|
|
Damn it! That's the second time in the past day that I've edited a post instead of quoting it. Sorry, Crispy. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
Jedive
Joined: 01 Jan 2007 Posts: 7
|
Posted: Wed Jan 03, 2007 6:28 am Post subject: |
|
|
Quote: | I suppose we could, on Mac, actually implement all three styles: loading of bundles, loading of dylibs, and loading of unix .so libraries, based on file extension (does anyone actually use so files on Mac?). | Well, I didn't even know that there was .so files on Mac. I always thought that a .dylib on Mac was the equivalent to .dll on Windows or .so on Linux. I think you can dinamically load .dylib files with the standard Unix functions: dlopen(), dlsym()... |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Wed Jan 03, 2007 10:24 am Post subject: |
|
|
Jedive wrote: | Quote: | I suppose we could, on Mac, actually implement all three styles: loading of bundles, loading of dylibs, and loading of unix .so libraries, based on file extension (does anyone actually use so files on Mac?). | Well, I didn't even know that there was .so files on Mac. I always thought that a .dylib on Mac was the equivalent to .dll on Windows or .so on Linux. I think you can dinamically load .dylib files with the standard Unix functions: dlopen(), dlsym()... |
Yeah, I don't know if there are .so files or not, hence the question at the end. I just assumed that since it's unix-based, it would be possible. If dylibs and frameworks are it, then that's all we need be concerned with. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
Crispy
Joined: 26 Nov 2005 Posts: 67
|
Posted: Wed Jan 03, 2007 10:08 pm Post subject: |
|
|
aldacron wrote: | Damn it! That's the second time in the past day that I've edited a post instead of quoting it. Sorry, Crispy. |
To reiterate what I said in that post: Derelict does not work on Mac as-is. It needs some minor tweaks to get it to compile and run (most of them fairly trivial, if memory serves). Also, I couldn't figure out how to compile/obtain dynamic libraries (as opposed to frameworks) on Mac, so I didn't get any further than that.
Now back to the rest of the thread...
All the SDL libraries are built as frameworks. Getting Derelict to load frameworks would definitely be the best solution; unfortunately I have no idea how to do that. If I get time I might be able to look into it, but don't expect anything.
I believe you're right, Jedive; .dylib files are just the Mac version of .so files (they have a different internal format - Mach-O instead of ELF). They can indeed be loaded using (the Mac OSX version of) the standard Unix dlopen/dlsym functions.
( Please don't edit this post, aldacron. ) |
|
Back to top |
|
|
JoeCoder
Joined: 29 Oct 2005 Posts: 294
|
Posted: Wed Jan 03, 2007 10:10 pm Post subject: |
|
|
I'll gladly port Derelict to mac if someone will buy me one . Gotta be recent enough to have fun with opengl though.
I think this is one of those "as if" moments. |
|
Back to top |
|
|
Crispy
Joined: 26 Nov 2005 Posts: 67
|
|
Back to top |
|
|
|