PDA

View Full Version : Porting XBMC to Mac OS X (Leopard) - Developers only!


elan
2007-12-12, 11:12
I've begun porting the code over to Mac OS X 10.5.1, because I'm annoying at how crappy Front Row is, and I've been wanting to use my Mac as a media center. I will have the TV connected to the second DVI port, so I can't just install Linux :grin:

Anyway, I've gotten to the point where the code compiles and almost links, but I'm missing some libraries that come already compiled for Linux, like libXBMS, libshout, librtv, etc. I presume I should build them from the trunk code XMBC/sources/ directories?

So far the port is progressing fairly smoothly. The one hurdle that I haven't solved yet is thread local storage, as OS X doesn't have support for the __thread directive. I'm planning to use Portaudio for sound.

I'll post more as I find the time to make more progress.

-elan

elan
2007-12-12, 11:46
A few more questions to those in the know:

* Mac SDL doesn't use X11. Is that going to be an issue?

* I'm trying to build libGoAhread from xbmc/lib/libGoAhead, and I can build what's in there, but it seems to be missing lots of stuff (e.g. all the um* stuff and the ej* stuff). Any pointers?

Thanks!

elan
2007-12-12, 12:40
Ooo, getting closer...however, it's time for bed!

Available videomodes:
Found mode: 1920x1200
Found mode: 1600x1200
Found mode: 1600x1000
Found mode: 1344x1008
Found mode: 1280x1024
Found mode: 1280x960
Found mode: 1344x840
Found mode: 1360x768
Found mode: 1280x800
Found mode: 1024x768
Found mode: 1024x640
Found mode: 960x600
Found mode: 800x600
Found mode: 848x480
Found mode: 800x500
Xlib: extension "XINERAMA" missing on display ":0.0".
Reading symbols for shared libraries . done
2007-12-12 00:38:44.748 XboxMediaCenter[54121:813] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
Constructing surface
GLX Info: NOT Using destination window
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
GLX Error: No Multisample buffers available, FSAA disabled
GLX Info: Using parent window
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 78 (X_CreateColormap)
Resource id in failed request: 0x9442e6f5
Serial number of failed request: 16
Current serial number in output stream: 18

elan
2007-12-12, 13:14
OK, now it's *REALLY* time for sleep.

http://www.bluemandrill.com/public/untitled.png

elan
2007-12-12, 14:03
Did I mention I have to work in the morning?

http://www.bluemandrill.com/public/xbmc2.png

Clumsy
2007-12-12, 14:17
Cool stuff, keep it up :)

Gamester17
2007-12-12, 15:10
You are using the Linux port branch in the SVN as your base, right? /xbmc/branches/linuxport/XBMC/
http://xboxmediacenter.com/wiki/index.php?title=HOW-TO_compile_XBMC_for_Linux_from_source_code
svn checkout https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC

Also, where did you get that skin, becuase I can tell from the logo in the top left corner that it is a relativly old version of the PM3 skin(!)

I've gotten to the point where the code compiles and almost links, but I'm missing some libraries that come already compiled for Linux, like libXBMS, libshout, librtv, etc., etc. I presume I should build them from the trunk code XBMC/sources/ directories?/xbmc/trunk/sources/ only contains the Xbox versions of those libraries, I think that you may want to /xbmc/branches/linuxport/sources/ instead for the Linux versions.

Mac SDL doesn't use X11. Is that going to be an issue??No, (niether does Windows and as you may know it is possible to build to/for Win32 and SDL from the Linux branch using Microsoft Visual Studio .NET 2003).

For ideas on how to build SDL using OpenGL for Mac OSX I suggest you refer to the documentation (Wiki) on http://www.libsdl.org

I'm trying to build libGoAhread from xbmc/lib/libGoAhead, and I can build what's in there, but it seems to be missing lots of stuff (e.g. all the um* stuff and the ej* stuff). Any pointers?In the SVN look in /xbmc/branches/linuxport/sources/libGoAhead/
...otherwise checkout http://webserver.goahead.com/webserver/webserver.htm


PS! If you like to chat with the programmers working on the XBMC Linux port (http://xboxmediacenter.com/wiki/index.php?title=Linux_port_project#Linux_port_ment ors_and_developers) then use an IRC client (like mIRC) to visit #xbmc-linux on freenode
....you may also sometimes find developers hanging out at #xbmc on freenode :cool:

yuvalt
2007-12-12, 18:01
A few more questions to those in the know:

* Mac SDL doesn't use X11. Is that going to be an issue?

* I'm trying to build libGoAhread from xbmc/lib/libGoAhead, and I can build what's in there, but it seems to be missing lots of stuff (e.g. all the um* stuff and the ej* stuff). Any pointers?

Thanks!

I can help you later on with that. for now just #undef HAS_WEB_SERVER and forget about it. SDL not using X11 is not an issue.

Good luck! Let me know if there's any commits that needs to be done to support OSX.

-Yuval

yuvalt
2007-12-12, 18:04
OK, now it's *REALLY* time for sleep.

http://www.bluemandrill.com/public/untitled.png

Fuck Broken OwningCiriticalSection I don't recall that debug message :laugh:

El Piranna
2007-12-12, 19:03
You push me out!!!:laugh:

Well, i see that you have little problems, so count with me. The libraries maybe yhou can get them with fink, and no: OSX SDL doesn't need of X11 ;) You can compile it at the "unix way" from terminal and fink and other things (now Leopard has real support to this) or the "osx way" with XCode (that i preffer, but this will not be easy to port...). In any case there is an app that port from makefiles to XCode projects, look for it ;)

shaneuk
2007-12-12, 21:20
this will be extremely popular, there are no decent media centers out there for osx.

thanks for taking the time out to port this, if you'd like anyone to test it i run

17" iMac intel core 2 duo
ati radeon x1600 (128mb vram)

and

Macbook intel core 2 duo
onboard x3100 Intel Video Card, (144mb vram)

both running OS X Leopard 10.5.1

elan
2007-12-13, 00:44
You are using the Linux port branch in the SVN as your base, right? /xbmc/branches/linuxport/XBMC/


Yes, that's the one I'm using.


Also, where did you get that skin, becuase I can tell from the logo in the top left corner that it is a relativly old version of the PM3 skin(!)


Oh, that's funny. I didn't do anything to pick or checkout a skin, so it must be the default one that gets checked out on the Linux port branch? Where should I be getting it from?


/xbmc/trunk/sources/ only contains the Xbox versions of those libraries, I think that you may want to /xbmc/branches/linuxport/sources/ instead for the Linux versions.


Thanks, I'll use those!


For ideas on how to build SDL using OpenGL for Mac OSX I suggest you refer to the documentation (Wiki) on http://www.libsdl.org


Seems to be working great!

Thanks for the helpful information!

-elan

jmarshall
2007-12-13, 01:08
Nice work, elan.

Let us know what modifications are going to be necessary once you've cleaned it up a bit - hopefully we can keep the code as portable as possible :)

Cheers,
Jonathan

elan
2007-12-13, 01:11
Fuck Broken OwningCiriticalSection I don't recall that debug message :laugh:

:grin:

Yeah, I need to figure out how to do TLS on OS X. I think I'll try to use pthread_setspecific...if this works, the Linux port could probably use this as well, so as to have exactly the same implementation, even though using __thread is so much easier.

elan
2007-12-13, 01:23
By the way, I've been treating the OS X target as sort of a sub-port of Linux, so I leave _LINUX defined and then do...

#ifdef __APPLE__
...
#endif

...since OS X is pretty much UNIX. In the long term, it may make sense to define something like _UNIX at the high level and then #ifdef for LINUX, OS X, etc.

I hope this is alright, it certainly made the port easier, but please let me know if this isn't seen as the right way of doing things. Where it made sense I have whole new subclasses for things (like the PortAudio player) that live alongside the Linux and Windows ones.

Anyway, I want to get my changes merged into the branch as soon as possible. I need to do a bit more work and get things working better first.

yuvalt
2007-12-13, 01:39
By the way, I've been treating the OS X target as sort of a sub-port of Linux, so I leave _LINUX defined and then do...

#ifdef __APPLE__
...
#endif

...since OS X is pretty much UNIX. In the long term, it may make sense to define something like _UNIX at the high level and then #ifdef for LINUX, OS X, etc.

I hope this is alright, it certainly made the port easier, but please let me know if this isn't seen as the right way of doing things. Where it made sense I have whole new subclasses for things (like the PortAudio player) that live alongside the Linux and Windows ones.

Anyway, I want to get my changes merged into the branch as soon as possible. I need to do a bit more work and get things working better first.
Yeah, I'm all for it. Actually even today there are places that should not have _LINUX . I think that adding OSX support will be a compelling event to get that #define fixed.

Can you elaborate a bit on what's working for you in the apple port and what requires more work?

-Yuval

elan
2007-12-13, 02:58
Can you elaborate a bit on what's working for you in the apple port and what requires more work?


After a single night's work, not too much (but I was happy to get as far as I did). It starts, I can browse through the menu tree, go to settings, etc. Browsing audio/video/pictures doesn't work because of a TLS issue (I think). Network needs work, and I need to check that DLLs can load and videos play. I also need to write an audio player using Portaudio.

-elan

toonz
2007-12-13, 07:17
I've begun porting the code over to Mac OS X 10.5.1

That's AWESOME!
I personally think this'd be perfect ... just imagine it - a Mac Mini running XBMC. mmmmmm

Gamester17
2007-12-13, 10:30
2007-12-12 00:38:44.748 XboxMediaCenter[54121:813] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.Seems like you need to make SDL use Quartz Extreme (OpenGL acceleration for Quartz Compositor) instead of QuickDraw
http://en.wikipedia.org/wiki/Quartz_Compositor
http://en.wikipedia.org/wiki/Core_OpenGL

Again, best is to refer to the libsdl.org website like their FAQ http://www.libsdl.org/faq.php?action=listentries&category=7

:nerd:

Gamester17
2007-12-13, 10:53
I also need to write an audio player using Portaudiohttp://en.wikipedia.org/wiki/PortAudio
interesting, ...but I thought that libSDL (http://www.libsdl.org) took care of that? or will PortAudio for Mac OS X work like ALSA (http://en.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture) under Linux as a low-level layer for the hardware (leaving libSDL (http://www.libsdl.org) to take care of the high-level stuff)?

Gamester17
2007-12-13, 12:06
Also, where did you get that skin, becuase I can tell from the logo in the top left corner that it is a relativly old version of the PM3 skin(!)Oh, that's funny. I didn't do anything to pick or checkout a skin, so it must be the default one that gets checked out on the Linux port branch? Where should I be getting it from?That is odd, I through that especially the Linuxport branch should use the new logo that simply reads "XBMC" instead of "XBOX MEDIA CENTER", ...well I guess the Linux developers forgot to move that over(?), or maybe they are using the Project Mayhem 3 skin from the trunk instead even under Linux(?)

???

Jezz_X
2007-12-13, 12:30
the linux port does have the new version I bet he has an old xpr see
https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC/skin/Project Mayhem III/media/Home_Top.png

aegzorz
2007-12-13, 12:45
Can't wait to try this Mac-port out. :)
Would be cool if it could be used as a Finder recplacement, so the Mac can boot straight into XBMC.

El Piranna
2007-12-13, 12:56
Can't wait to try this Mac-port out. :)
Would be cool if it could be used as a Finder recplacement, so the Mac can boot straight into XBMC.

Err... it's not a bad idea :) But then XBMC should be improved in a very high way, but it's not a bad idea at all...

Gamester17
2007-12-13, 13:25
Please respect that this is a development forum for developers/programmers, do not post request/suggestion for new features in this forum unless you actually are a developer/programmer yourself and plan to implement that said feature yourself. Thank you!

aegzorz
2007-12-13, 14:35
Sorry didn't mean it as a feature request, I'd love to help out with this Mac-port. I hope this makes it to the svn soon, just hope Xcode 2.5 can open xcode 3.0 files :)

El Piranna
2007-12-13, 17:17
Sorry didn't mean it as a feature request, I'd love to help out with this Mac-port. I hope this makes it to the svn soon, just hope Xcode 2.5 can open xcode 3.0 files :)

I'm not sure (about XCode 2.5 Apple updated the XCode project format) but in any case, better update to XCode 3.0 ;) It has some strange behaviours, but it's very cool when you config it:nod:

elan
2007-12-13, 20:53
http://en.wikipedia.org/wiki/PortAudio
interesting, ...but I thought that libSDL (http://www.libsdl.org) took care of that? or will PortAudio for Mac OS X work like ALSA (http://en.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture) under Linux as a low-level layer for the hardware (leaving libSDL (http://www.libsdl.org) to take care of the high-level stuff)?

Exactly, that is the idea.

-elan

yuvalt
2007-12-13, 21:41
Generally I would like to get rid of SDL_Audio. Currently it is used only for skin audio.

elan
2007-12-13, 22:13
Generally I would like to get rid of SDL_Audio. Currently it is used only for skin audio.

The nice thing about it is that it is portable across a bunch of systems, and it's easy to just play a fixed piece of audio (like a skin sound).

However, Portaudio is very portable too, and would probably serve well, although it would need higher level code to playFile(...), etc. If the lower level Linux stuff had used it instead of ALSA, the port to OS X would have been trivial, and it's even portable to Windows, so it might be a good common layer. I used Portaudio extensively in a former job, and it's a solid bit of code.

yuvalt
2007-12-13, 23:00
The nice thing about it is that it is portable across a bunch of systems, and it's easy to just play a fixed piece of audio (like a skin sound).

However, Portaudio is very portable too, and would probably serve well, although it would need higher level code to playFile(...), etc. If the lower level Linux stuff had used it instead of ALSA, the port to OS X would have been trivial, and it's even portable to Windows, so it might be a good common layer. I used Portaudio extensively in a former job, and it's a solid bit of code.

I'd love to see a common audio library used for both Linux and OSX. Just make sure that this library can play both on the analog device (2ch) and on the digital device (2ch pcm and passthrough for Dolby Digital/DTS).

-Yuval

Gamester17
2007-12-14, 11:24
I'd love to see a common audio library used for both Linux and OSX....and Windows (Win32)? ???

yuvalt
2007-12-14, 11:30
...and Windows (Win32)? ???

Yeah.

elan
2007-12-14, 12:59
Got TLS stuff working better, networking, photo browsing, and now I'm stuck on an annoying problem where DVDDemuxFFmpeg is having trouble talking to libavformat...strange stuff.

http://bluemandrill.com/public/network.png

http://bluemandrill.com/public/photos.png

http://bluemandrill.com/public/movie.png

http://bluemandrill.com/public/movielist.png

yuvalt
2007-12-14, 13:29
Excellent progress!

MPauley73
2007-12-14, 18:58
Would these changes also allow XBMC to compile under Tiger?

griffore
2007-12-14, 20:19
awesome work! keep it up! :)

btw, when is the linux branch moving into the main trunk?

SandmanCL
2007-12-14, 20:41
elan -- this is looking promising ! Thanks for working on this. I have an old G4 PowerBook through work (hopefully I'll get upgraded to a MacBook Pro after Christmas) that has been a faithful travel companion for years. Running XBMC on a plane will make traveling seem more like being at home :)

elan
2007-12-14, 22:12
Would these changes also allow XBMC to compile under Tiger?

In theory, yes. In practice, I've been focusing on Leopard. I'm sure once I merge to svn, other people can complete the work (if any) for Tiger.

yuvalt
2007-12-14, 23:28
awesome work! keep it up! :)

btw, when is the linux branch moving into the main trunk?

There's no plan in the horizon to merge it back. Not sure it's worth the effort as a lot of changes have occured in the linux branch. Vulkanr merges very often so no change that's in the main trunk is missing in the linux branch.

-Yuval

elan
2007-12-15, 10:00
I finally got DVDDemuxFFmpeg working, although all the MMX/SSE stuff is turned off because of an ld regression in Leopard. Hence video thumbs now show up, which is kind of cool. Performance is EXCELLENT.

Browsing for photos, videos, and music seems to work well, so now I'm working on get the playing to work. Playing photos and videos should work, but it crashes right at the start, there's something basic wrong but I'm not sure what it is yet.

I'm also having a really hard time building MACDll.so (for paplayer), as I'm not sure what sources were used, and the ones I found don't match up with the calling code.

http://bluemandrill.com/public/videothumbs.png

nikothebouriko
2007-12-16, 11:13
hi

I hope you post the complet command line/add lib for compiling testing ^^

macmini coreduo gma950
macbookpro ati x1600

thx

elan
2007-12-16, 12:33
hi

I hope you post the complet command line/add lib for compiling testing ^^

macmini coreduo gma950
macbookpro ati x1600

thx

Once I get basic functionality complete to my satisfaction (and to the satisfaction of the other team members), I'll prepare some sort of release, as well as commit back to the trunk.

It'll be a while, though, there are definitely still big issues to resolve.

elan
2007-12-17, 08:52
I got PortAudio integrated, and build a PAplayer for it, and now I can play music just fine, even with cross-fading, works perfectly. No visualizations yet, although supposedly the OpenGL spectrum should work.

B4tm4n
2007-12-17, 16:34
I've been away from the xbmc scene for awhile, since moving to a mac from a pc, but having read this thread I'm looking forward to running xbmc on my macbook.

I really impressed with work you guys do in your free time, so people like me who can't program for toffee can use this wonderful app.

Cheers.

tokyovigilante
2007-12-19, 11:43
This is absolutely fantastic, thanks. Keep up the good work, looking forward to a build.

pike
2007-12-19, 13:45
Brief Announcement

There will be a short break before Elan has a chance to resume work on this due to the upcoming Holidays

Nick8888
2007-12-19, 13:52
unacceptable.

nah enjoy the holidays, i doubt anyone would expect any less.

you too pike.

slang123
2007-12-19, 17:20
Thanks for the update Pike.

Geeba
2007-12-20, 15:42
I really impressed with work you guys do in your free time, so people like me who can't program for toffee can use this wonderful app.

Cheers.

Hmmmmmm... buy an Xbox? :laugh:

OwlBoy
2007-12-28, 09:09
I appreciate the effort you are putting in on this! Keep it up!

elan
2007-12-29, 11:34
Got it building under XCode 3.0. No more Makefiles, and a much better development environment.

Now to resolve the few remaining issues before checking in so that others can help out!

-elan

darky17
2007-12-29, 14:47
Can't wait!!! hopefully we will be able to use it on apple tv aswell?:D

slang123
2007-12-29, 17:55
Thats great news! Thanks for your work, can't wait to see it.

elan
2007-12-31, 11:24
I'm starting to check my patches in...expect it to take the next day or so as I go through, clean them up, and check them in. But they're starting to trickle in.

yuvalt
2007-12-31, 17:46
congrats, try not to break anything please please please :-)

elan
2007-12-31, 19:20
congrats, try not to break anything please please please :-)

I'm being really, really careful, but we'll see how lucky I am. 90% of the changes are ifdef'd for OS X, and the only one that has the potential to affect Linux are my threading changes (rewrite of Event code to use SDL_cond), and a few bugfixes.

I'll be on IRC so you can yell at me if I do manage to break anything :grin:

-elan

Versatile
2007-12-31, 20:54
That's really really nice work elan
Can you already tell us what you're compute configuration is (cpu/mem/etc) and how long it takes to boot ?
Just to make us even more excited :-)

thanks, looking forward for it to use

cullman
2008-01-01, 01:13
That's really really nice work elan
Can you already tell us what you're compute configuration is (cpu/mem/etc) and how long it takes to boot ?


I've started working with Elan in the background on this. On my MBP C2D 2.33 w/ 3Gb of ram it "boots" in about 3 seconds.

Also, we've set up a trac server for all of XBMC using a read-only copy of the svn repository. Located here : http://dn-0.com/xbmc-trac

Jezz_X
2008-01-01, 05:30
Also, we've set up a trac server for all of XBMC using a read-only copy of the svn repository. Located here : http://dn-0.com/xbmc-trac


Nice trac dude I love the way track shows changes

elan
2008-01-01, 09:16
Revision 11180 now contains all the changes I needed to compile XBMC on Leopard 10.5.1.

I also checked in an XCode 3.0 project, although I've run into so many serious issues with XCode (especially debugging), that I'm now moving to Eclipse, which seems to be a much better environment (plus I'm used to it from Java work). I'll check in the Eclipse project shortly.

You'll need to install a bunch of MacPorts stuff, and the 1.2.12 libSDL has a nasty bug that causes lots of crashes (that's fixed in SVN).

I'll try to post more instructions to the Wiki shortly.

Happy 2008, everyone! XBMC on OS X is going to be great!

-elan

elan
2008-01-01, 09:18
That's really really nice work elan
Can you already tell us what you're compute configuration is (cpu/mem/etc) and how long it takes to boot ?

Thanks! I have a quad core 3GHz box with 8GB of memory, and it boots nearly instantly. Much faster than Front Row. Also, bear in mind XBMC is built to run in a really lean environment (the XBox), so it does really nicely on faster hardware.

-elan

monkeyman
2008-01-01, 09:22
Great to see that you're checking in an Eclipse project, I can't wait to start using Eclipse to build XBMC. I was actually working on a similar patch, but you beat me to it. Thanks a million!

PS: You may want to add a newline to the end of ALSADirectSound.cpp, it causes a warning.

elan
2008-01-01, 09:27
Great to see that you're checking in an Eclipse project, I can't wait to start using Eclipse to build XBMC. I was actually working on a similar patch, but you beat me to it. Thanks a million!

Glad to hear others are interested as well! I hope to check it in tomorrow evening.


PS: You may want to add a newline to the end of ALSADirectSound.cpp, it causes a warning.

Many thanks, I just fixed that.

-elan

monkeyman
2008-01-01, 09:31
Also, SDL_SemWaitTimeout2() in XSyncUtils.cpp can exit without a return value.

elan
2008-01-01, 09:41
Also, SDL_SemWaitTimeout2() in XSyncUtils.cpp can exit without a return value.

Very true :grin: Fixed, thanks!

-elan

monkeyman
2008-01-01, 09:50
I'm sorry, I don't mean to nit, really. But, I think nRet should be returned at the very bottom of the function, after the end of the #ifdefs.

If APPLE is not defined, the function can still return without a value. Also, I think that there's some code at the end that is unreachable if APPLE is defined.

Thanks again for your work.

elan
2008-01-01, 10:02
I'm sorry, I don't mean to nit, really. But, I think nRet should be returned at the very bottom of the function, after the end of the #ifdefs.

If APPLE is not defined, the function can still return without a value. Also, I think that there's some code at the end that is unreachable if APPLE is defined.

Thanks again for your work.

All valid points. I fixed it up for __APPLE__ and left a comment for the Linux folks, as I'm not sure what the default return should be.

Thanks, and Happy New Year.

-elan

monkeyman
2008-01-01, 10:06
Looks good to me.

Have a happy holiday.

ezar
2008-01-01, 14:00
Wow! Perfect!
Can you upload a preview? I'm trying to build with xcode 3.0 but I have a lot of problems!
Please elan post a preview or how to compile XBMC_OSX!

Good Job!

ezar
2008-01-01, 14:27
Do you have a .dmg? xD

yuvalt
2008-01-01, 14:28
Yeah, I suggest elan will write a short README.osx to describe how to build + develop. Thanks!

ukp62
2008-01-01, 15:28
Well I managed to get it to compile on my macbook pro. Unfortunately it does not run.

Here is the first part of the backtrace:

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0

Thread 0 Crashed:
0 XBMC 0x002ceda6 CUtil::GetHomePath(CStdStr<char>&) + 74 (cstring:119)
1 XBMC 0x00080d5a CApplication::Create(void*) + 134 (Application.cpp:820)
2 XBMC 0x0035c348 SDL_main + 160 (XboxMediaCenter.cpp:59)
3 XBMC 0x0038f79c -[SDLMain applicationDidFinishLaunching:] + 76

Not really got the time at the moment to look deeper into it.

To get it to compile in xcode 3.0 you need to make a few changes to the project properties.

1) Change Valid Architectures to i386 only.
2) Add the header search path to where your libSDL headers are. In my case this is /usr/local/include/
3) Do the same for libs. In my case /usr/local/lib/
4) Set user Header Searchpath to /opt/local/Library/Frameworks/Python.framework/Versions/2.4/include/

Use macports to install python2.4 and the other libraries mentioned in the readme.linux file. Do not install SDL with macports, go to http://www.libsdl.org/ and download the svn version of 1.2. Also download SDL_image, SDL_mixer (same site) and SDL_gfx from http://www.ferzkopp.net/joomla/content/view/19/14/

I'm pretty sure that is all I did.

ukp62
2008-01-01, 15:49
ok, managed to get a bit further.

export XBMC_HOME=<dir where xbmc binary is run from>

Gives me a white app that is almost fullscreen.

Missing from my previous post was, you need to add /opt/local/lib/ to the Library Search Paths in the xcode project.

Gamester17
2008-01-01, 16:55
Great stuff! ...and happy new year!

I'll try to post more instructions to the Wiki shortly.You have Ninja status for the WIKI right? http://xboxmediacenter.com/wiki/index.php?title=HOW-TO_compile_XBMC_for_Mac_OS_X_from_source_code&action=edit

:grin:

shaneuk
2008-01-01, 17:56
im not at all familiar with compiling code or anything like that, but if anyone has built an osx binary, would they be kind enough to send it me, i can also host the file for others to download.

slang123
2008-01-01, 18:54
When running ./configure i get:
checking for main in -lGL... no
configure: error: libGL is required. Please see README.linux

Any idea how to fix this?

Gamester17
2008-01-01, 18:58
@everyone, a new 'end-user' forum has now been created for the Mac OS X version of XBMC!
The same terms and rules applies for that forum as the Linux end-user forum!

Please respect that this development forum is for developers (programmers) only!

Thanks!

ukp62
2008-01-01, 19:38
When running ./configure i get:
checking for main in -lGL... no
configure: error: libGL is required. Please see README.linux

Any idea how to fix this?

You don't run ./configure

Open XBMC.xcodeproj

slang123
2008-01-01, 19:45
But then xcode says:
/Users/stuart/XBMC_OSX/XBMC/guilib/system.h:128:23: error: ../config.h: No such file or directory

??

ukp62
2008-01-01, 19:52
Yes. this appears to be a bug. For now just remove that config.h line from the file system.h

shaneuk
2008-01-01, 19:56
can you send me the binary when its built? then i can stick it on my webspace for others. - dont have xcode installed.

cullman
2008-01-01, 19:59
ok, managed to get a bit further.

export XBMC_HOME=<dir where xbmc binary is run from>

Gives me a white app that is almost fullscreen.

Missing from my previous post was, you need to add /opt/local/lib/ to the Library Search Paths in the xcode project.

ukp62, I had the same problem the first time running, try mv'ing your system/profiles.xml out of the way in your xbmc binary dir.

cullman
2008-01-01, 20:09
ukp62, that probably won't fix it in your case....what is on your console?

ukp62
2008-01-01, 20:13
ukp62, that probably won't fix it in your case....what is on your console?

I solved the problem by doing the following:

(Move the build dir xcode makes out of the way first)

./build.sh NOUPDATE NOCOMPILE

This creates the BUILD dir with the necessary userdata. system etc directories.

Copy the freshly compiled XBMC binary to the BUILD directory.

export XBMC_HOME=/Volumes/Data/Users/ukp/xbmc/XBMC/BUILD

./XBMC

this allows the app to run.

ezar
2008-01-01, 22:34
ukp62, Can you up or send me a zip with all XBMC application... I want to test it...

ukp62
2008-01-01, 22:57
ukp62, Can you up or send me a zip with all XBMC application... I want to test it...

See my post at http://xbmc.org/forum/showthread.php?t=30397

Gamester17
2008-01-01, 22:59
@shaneuk, ezar and anyone else who IS NOT A DEVELOPER, please stop requesting binay builds, etc.

Please respect that this topic thread is now only by and for developers/programmers only!

...or else! :stare:

ezar
2008-01-01, 23:10
See my post at http://xbmc.org/forum/showthread.php?t=30397

Thank You! Now I compile XBMC myself! Thank You! Only I need the library list... and you post Here (http://xbmc.org/forum/showthread.php?t=30397)

Regards

ezar
2008-01-02, 03:54
I build correctly XBMC in XCODE 3.0... but when I execute ./xbmc crash :(

The error_log was:
0 ??? 0000000000 0 + 0
1 XBMC 0x0005e45d CGUIImage::Render() + 2313 (guiImage.cpp:271)
2 XBMC 0x00512e2c CSplash::Show() + 428 (Splash.cpp:57)
3 XBMC 0x000e1f66 CApplication::Create(void*) + 4974 (Application.cpp:1312)
4 XBMC 0x0057be8d SDL_main + 227 (XboxMediaCenter.cpp:59)
5 XBMC 0x005c377c -[SDLMain applicationDidFinishLaunching:] + 76

ezar
2008-01-02, 03:58
xbmc.log

02:56:43 T:2693680992 M:813555712 NOTICE: Mapping drive Q to /Users/ezar/Documents/SVN/XBMC/BUILD
02:56:43 T:2693680992 M:813531136 NOTICE: -----------------------------------------------------------------------
02:56:43 T:2693680992 M:813531136 NOTICE: Starting XBoxMediaCenter. Built on Jan 2 2008
02:56:43 T:2693680992 M:813531136 NOTICE: Q is mapped to: /Users/ezar/Documents/SVN/XBMC/BUILD
02:56:43 T:2693680992 M:813531136 NOTICE: The executeable running is: 
02:56:43 T:2693680992 M:813531136 NOTICE: Log File is located:
02:56:43 T:2693680992 M:813531136 NOTICE: -----------------------------------------------------------------------
02:56:43 T:2693680992 M:813461504 NOTICE: Mapping drive T to /Users/ezar/Documents/SVN/XBMC/BUILD/UserData
02:56:43 T:2693680992 M:813461504 NOTICE: Setup SDL
02:56:43 T:2693680992 M:811372544 INFO: Available videomodes:
02:56:43 T:2693680992 M:811368448 INFO: Found mode: 1280x800
02:56:43 T:2693680992 M:811368448 INFO: Found mode: 1152x720
02:56:43 T:2693680992 M:811368448 INFO: Found mode: 1024x768
02:56:43 T:2693680992 M:811368448 INFO: Found mode: 1024x640
02:56:43 T:2693680992 M:811368448 INFO: Found mode: 800x600
02:56:43 T:2693680992 M:811368448 INFO: Found mode: 800x500
02:56:43 T:2693680992 M:808787968 INFO: GL: OpenGL Vendor String: Intel Inc.
02:56:43 T:2693680992 M:808779776 ERROR: LIRC Initialize: connect failed: No such file or directory
02:56:43 T:2693680992 M:808660992 NOTICE: Mapping drive Z to /tmp/xbmc
02:56:43 T:2693680992 M:808656896 INFO: Drives are mapped
02:56:43 T:2693680992 M:808656896 NOTICE: load settings...
02:56:43 T:2693680992 M:808652800 NOTICE: Mapping drive P to /Users/ezar/Documents/SVN/XBMC/BUILD/UserData
02:56:43 T:2693680992 M:808648704 NOTICE: loading /Users/ezar/Documents/SVN/XBMC/BUILD/UserData/guisettings.xml
02:56:43 T:2693680992 M:808476672 NOTICE: Getting hardware information now...
02:56:43 T:2693680992 M:808472576 INFO: Using analog output
02:56:43 T:2693680992 M:808472576 INFO: AC3 pass through is enabled
02:56:43 T:2693680992 M:808464384 INFO: DTS pass through is enabled
02:56:43 T:2693680992 M:808464384 NOTICE: Checking resolution 10
02:56:43 T:2693680992 M:808464384 NOTICE: Setting autoresolution mode 6
01:56:43 T:2693680992 M:808456192 NOTICE: Per AV pack settings are off
01:56:43 T:2693680992 M:808439808 NOTICE: /Users/ezar/Documents/SVN/XBMC/BUILD/UserData/sources.xml
01:56:43 T:2693680992 M:808435712 ERROR: Load Error loading /Users/ezar/Documents/SVN/XBMC/BUILD/UserData/sources.xml: Line 0, Failed to open file
01:56:43 T:2693680992 M:808378368 INFO: Checking skinpath existance, and existence of keymap.xml:Q:\skin...
01:56:43 T:2693680992 M:808378368 INFO: load language info file: /Users/ezar/Documents/SVN/XBMC/BUILD/language/English/langinfo.xml
01:56:43 T:2693680992 M:808366080 INFO: load keyboard layout configuration info file: /Users/ezar/Documents/SVN/XBMC/BUILD/language/English/keyboardmap.xml
01:56:43 T:2693680992 M:808366080 ERROR: unable to load /Users/ezar/Documents/SVN/XBMC/BUILD/language/English/keyboardmap.xml: Failed to open file at line 0

ezar
2008-01-02, 17:17
Finally I test XBMC-OSX

I use only macports.org releases... For libsdl I modify portfile to use 1.2.13 (relased 12-30-2007)
I create a ticked to macports (http://trac.macosforge.org/projects/macports/ticket/13780) to include it!

More detail in user forum (http://xbmc.org/forum/showthread.php?t=30407)

elan
2008-01-04, 00:25
I think the easiest way to move forward on this problem (which is preventing video and photos from working) is to move to using SDL 1.3. This newer version supports the following calls:

SDL_GL_CreateContext
SDL_GL_MakeCurrent
SDL_GL_DeleteContext

Which should help in converting the GL code over to OS X. The main problem is that SDL/OS X actually uses Cocoa, so I can't use the AGL calls, which are deprecated and Carbon based. I could use CGL calls too, which are the basis of the higher level GL APIs on OS X.

(Of course, I'm writing this right now and I did all the research in the middle of the night when I couldn't sleep, so I may have dreamt most of it.)

Also, I have a basic Eclipse project working, which uses xcodebuild to do the actual building. Error parsing works fine, and that means that XCode and Eclipse development can proceed alongside each other, and we don't have to force anyone into using one or the other. Debugging is much better with Eclipse, at least for me.

The standard Makefile/CDT builders in Eclipse are some buggy crap, let me tell you, which is another reason I moved to simply invoking XCode's builder.

-elan

elan
2008-01-04, 14:18
Alright, I'm now using SDL 1.3, and got the basic OpenGL context stuff in there. It almost works, no more crashes, but now seemingly hitting a deadlock, and things are far from perfect. But at least it displayed the first image from a slideshow.

http://bluemandrill.com/public/photo-almost-working.png

laserheart
2008-01-04, 19:29
Thank you all for your efforts! This is awesome!

griffore
2008-01-04, 22:28
Alright, I'm now using SDL 1.3

Do you mean SDL 1.2.13? I can't find any reference to 1.3. :confused2:

elan
2008-01-04, 22:31
Do you mean SDL 1.2.13? I can't find any reference to 1.3. :confused2:

SDL 1.3 is here (http://www.libsdl.org/svn.php). There's been a lot of work done on OpenGL/OS X/Cocoa, but I'm not entirely convinced this is the right route to take. I may go back and hack 1.2.13 more.

elan
2008-01-05, 23:04
I'm basically back to a slightly hacked SDL 1.2.13 and using AGL calls in XBMC's CSurface. I can now create and manage AGL contexts fine, and now I'm running into a critical section issue that I was aware of when first porting, but now seems to be actually biting me when I go to display a photo :rolleyes:

Hopefully I'll get a chance to work on this more later on today.

-elan

gmackenz
2008-01-06, 08:19
I am curious how are either of you able to compile SDL with Leopard...I've tried with both SDL 1.2 and 1.3 and had make errors. Obviously neither fink nor macport support libSDL with 10.5.x just yet.

Is it possible to put online somewhere (if not in this discussion) where you got 1.2.13 and how you modified it ( I assume there where changes made to certain of the make files)?

gmackenz
2008-01-06, 09:21
I am curious how are either of you able to compile SDL with Leopard...I've tried with both SDL 1.2 and 1.3 and had make errors. Obviously neither fink nor macport support libSDL with 10.5.x just yet.

Is it possible to put online somewhere (if not in this discussion) where you got 1.2.13 and how you modified it ( I assume there where changes made to certain of the make files)?

Thanks to a kind soul who sent me a private message, I'd gotten so forgetful in my middle-aged-mindness that I need to configure/compile as root for Mac OS X...Been using Fink/Macports too much ;)

Better documentation/current work-arounds in the README.mac_os_x is always appreciated.

elan
2008-01-06, 10:29
Better documentation/current work-arounds in the README.mac_os_x is always appreciated.

Yeah, next time I come up for air in my development work, I'll improve the documentation. The more people who are able to build it, the more people who are able to help out in the porting effort.

-elan

elan
2008-01-07, 12:39
I ran a slideshow with music for 3 hours while I was out for dinner, and it worked perfectly. The key was getting the AGL contexts working, rewriting the critical section code to use standard pthread constructs, and hacking SDL 1.2 to return me the Carbon WindowRef.

I have one interesting display glitch (title bar is garbage), and I'm pretty sure it's because I'm using the top-level WindowRef instead of the subframe I should be using. I'm brand new to Carbon/Cocoa/Quartz/AGL coding, so hopefully you'll cut me some slack while I figure out how to fix it :grin:

http://www.bluemandrill.com/public/slideshow.png

petsounds
2008-01-07, 23:46
Superb work, elan.

Are you planning to stick with Carbon/Eclipse at this point? I know that Apple has deprecated the Carbon and QuickDraw libs, and highly recommends that people move to a pure Cocoa environment. They also recommend using XCode because it will be easier to maintain the codebase going forward as things evolve. Less significantly but still something to note, under 10.5 Carbon apps have no support for 64-bit.

Of course, if you're feeling really crazy you can mix Cocoa into a Carbon app (http://developer.apple.com/documentation/Cocoa/Conceptual/CarbonCocoaDoc/Articles/WrapperFunctions.html) or vice versa.


Aside from the great Apple Developer (developer.apple.com) site, this is also a good resource for learning Cocoa:
http://cocoadevcentral.com/

elan
2008-01-08, 00:54
Are you planning to stick with Carbon/Eclipse at this point? I know that Apple has deprecated the Carbon and QuickDraw libs, and highly recommends that people move to a pure Cocoa environment. They also recommend using XCode because it will be easier to maintain the codebase going forward as things evolve. Less significantly but still something to note, under 10.5 Carbon apps have no support for 64-bit.

Thanks for your kind message.

In terms of Eclipse, I've configured it to call xcodebuild externally, so XCode manages the configuration. This seemed the best of both worlds, because Eclipse works fine, highlights errors, etc., and the debugging (for me, at least) works much better. The people who want to use XCode are set, and the people who want to use vi or emacs can use xcodebuild.

In terms of Carbon etc., XBMC is built on top of SDL, which in 1.2 is Cocoa/Quartz, and 1.3 seems to be just Cocoa (assuming I know what I'm talking about). In getting multiple OpenGL contexts to work, this first attempt uses AGL which needs access to a Carbon WindowRef.

Since I already have a tiny bit of Obj-C in XBMC, I could probably move to a pure Cocoa implementation, I just haven't been brave enough to do that yet. AGL seemed to provide the easiest way forward, although, to be fair, there is that graphical glitch in the titlebar which would probably be solved if I went to using Cocoa's OpenGL API.

-elan

elan
2008-01-09, 07:05
Mmmmm, tasty, got ProjectM (which can read Milkdrop settings) mostly working.

senz
2008-01-10, 13:02
Nice work Elan!

Is there enough power in the new macminis to run XBMC MAC OSX?

Is it possible to stream movies from rar archives in network?

regards

/Dennis

Gamester17
2008-01-10, 13:33
Is there enough power in the new macminis to run XBMC MAC OSX?That is end-user discussion! Please see http://xbmc.org/forum/showthread.php?t=30410

EVERYONE AGAIN! PLEASE RESPECT THAT THIS TOPIC THREAD IS FOR DEVELOPERS ONLY!

elan
2008-01-12, 02:17
I'll be checking in all the changes I've made very shortly.

-elan

elan
2008-01-13, 10:11
I've set up a site for the OS X porting effort: http://www.osxbmc.com. I'll be posting subsequent updates there, as well as posting download links for builds when they become available. The site has an RSS feed you can subscribe to.

-elan

elan
2008-01-14, 05:26
I've checked in, packaged a binary release, and posted build instructions. See the blog for details.

-elan

elan
2008-01-16, 02:18
New download link and instructions on the blog.

-elan

Gamester17
2008-01-16, 10:51
Any updates for the related wiki articles?:
http://www.xboxmediacenter.com/wiki/?title=HOW-TO_compile_XBMC_for_Mac_OS_X_from_source_code
http://www.xboxmediacenter.com/wiki/?title=Linux_port_project

Keep up the great work! :cool:

griffore
2008-01-16, 15:01
Does this mean XBMC would be running in 64-bit?

Isn't Mac OSX 64-bit running on 64-bit processors?

elan
2008-01-17, 11:17
Does this mean XBMC would be running in 64-bit?
Isn't Mac OSX 64-bit running on 64-bit processors?

No, it's not 64 bit. Mac OS X can run 64-bit binaries, but XBMC ain't one of 'em. I would assume both that (a) it would take a fair bit of work to get a 64-bit version working and (b) the real-world speed gains would be modest.

Now a version of ffmpeg with highly optimized SSE4 assembly, that would make a difference.

elan
2008-01-17, 11:17
Green screen issues with video on ATI video cards? Check my blog for a new version which fixes this problem.

elan
2008-01-20, 05:48
Looking for some input on audio interfaces on difference Mac models on the blog.

Thanks,

-elan

elan
2008-01-22, 10:35
Much blathering and a download link on the blog.

griffore
2008-01-22, 17:32
is svn all up to date?

griffore
2008-01-22, 17:34
also, does a release build with xcode work now?

jerkychew
2008-02-24, 02:12
Elan, I noticed some mention on your blogs about improving Mplayer's performance. Over on the MythTV mailing list "davilla at 4pi" (aka Scott Davilla) has made huge strides getting MythTV and MPlayer running smoothly on an AppleTV. I'm no developer so I apologize if none of it is useful to you, but I thought some of the work he's done might help you in getting XBMC's Mplayer running more smoothly. A great thread with his progress is archived over at http://www.gossamer-threads.com/lists/mythtv/users/315018?search_string=appletv;#315018

dogk1cker
2008-02-25, 23:01
elan:

Dooood, you should run for president!! I'll vote for you!!

Keep up the good work.

Dogk1cker

elan
2008-02-25, 23:07
@Dogk1cker: Thanks! However, I can't accept your endorsement unless you refrain from abusing Canines. Barkley just doesn't approve.

@jerkychew: Thanks for the link. I read through it, doesn't look relevant for us (I think).

@griffore: Release builds work now. I need to check in quite a bit of stuff, trying to finish up a next release first.

gold
2008-02-27, 23:02
I don't know if this is the appropriate place to post this, but here's a patch against the latest linuxport branch that allows XBMC to build on OS X:

http://www.xmission.com/~gold/xbmc_osx_patch.diff

This fixes several compile and link errors, as well as a few compile warnings. Note that you'll need to install pcre and python24 via MacPorts.

elan
2008-03-05, 01:14
I don't know if this is the appropriate place to post this, but here's a patch against the latest linuxport branch that allows XBMC to build on OS X:

http://www.xmission.com/~gold/xbmc_osx_patch.diff

This fixes several compile and link errors, as well as a few compile warnings. Note that you'll need to install pcre and python24 via MacPorts.

Nice work, Gold! I'll be incorporating this patch into my tree and checking in shortly.

Thank,

-elan