FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Derelict on Mac, Status
Goto page 1, 2  Next
 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Thu May 25, 2006 8:44 am    Post subject: Derelict on Mac, Status Reply with quote

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
View user's profile Send private message
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Thu May 25, 2006 1:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Fri May 26, 2006 6:51 am    Post subject: Reply with quote

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
View user's profile Send private message
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Fri May 26, 2006 7:19 am    Post subject: Reply with quote

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
View user's profile Send private message
Jedive



Joined: 01 Jan 2007
Posts: 7

PostPosted: Mon Jan 01, 2007 10:55 am    Post subject: Reply with quote

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
View user's profile Send private message
Crispy



Joined: 26 Nov 2005
Posts: 67

PostPosted: Tue Jan 02, 2007 2:04 am    Post subject: Reply with quote

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. Smile
Back to top
View user's profile Send private message
michael



Joined: 23 Aug 2006
Posts: 13

PostPosted: Tue Jan 02, 2007 3:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
Jedive



Joined: 01 Jan 2007
Posts: 7

PostPosted: Tue Jan 02, 2007 8:56 pm    Post subject: Reply with quote

Quote:
I'm not sure why you wouldn't want to use Derelict. It does work, and well.
Then... does Derelict work on Mac?

Quote:
Already know about this one?
http://shinh.skr.jp/d/porting.html
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... Very Happy
Back to top
View user's profile Send private message
Crispy



Joined: 26 Nov 2005
Posts: 67

PostPosted: Wed Jan 03, 2007 12:09 am    Post subject: Reply with quote

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
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Wed Jan 03, 2007 4:50 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Jedive



Joined: 01 Jan 2007
Posts: 7

PostPosted: Wed Jan 03, 2007 6:28 am    Post subject: Reply with quote

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
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Wed Jan 03, 2007 10:24 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Crispy



Joined: 26 Nov 2005
Posts: 67

PostPosted: Wed Jan 03, 2007 10:08 pm    Post subject: Reply with quote

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.


Sad

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. Razz )
Back to top
View user's profile Send private message
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Wed Jan 03, 2007 10:10 pm    Post subject: Reply with quote

I'll gladly port Derelict to mac if someone will buy me one Smile. Gotta be recent enough to have fun with opengl though.

I think this is one of those "as if" moments.
Back to top
View user's profile Send private message
Crispy



Joined: 26 Nov 2005
Posts: 67

PostPosted: Wed Jan 03, 2007 10:33 pm    Post subject: Reply with quote

Heh, same (and I expect aldacron would be fine with that as well Very Happy ). The only difference in my case is that I already have a Mac - it's an ancient 266 Mhz iMac, released in 1998. OpenGL is not fun on it. Most things are not fun on it. Razz

Also, the keys are really icky, so I hate typing on it. Sad Needs a new keyboard.

Still, it works.


As for loading frameworks - I've been reading Apple docs...

http://developer.apple.com/documentation/DeveloperTools/Reference/MachOReference/index.html#//apple_ref/doc/uid/TP40001398
http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/index.html#//apple_ref/doc/uid/10000183i
http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachOTopics/Articles/loading_code.html

...and it sounds like dlopen() can load bundles as well as .dylib files. Bundles are, I think, that wacky folder-structure thing that Mac OS X uses to package applications and frameworks. Could it be as simple as passing the path of the framework's main folder ("blahblah.framework") to dlopen()???

Edit: Nope, that doesn't work.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group