Talk:Devkitppc setup (Mac OS X)

From WiiBrew
Jump to: navigation, search

I welcome discussion and indeed useful editing.

Unfortunately due to ill health maintenance of the page will be erratic at best, therefore I'd appreciate anyone with the knowledge to do so maintaining it and this discussion page.

Errors

Opening Projects

I've attempted installation of this on my macbook running leapeard 1.5.3 but can't open any of the project files with xcode (which is installed fine). Any obvious things anyone can think of? I've got it running on my windows machine at the moment, so its nothing drastic. JD 15:33, 13 June 2008 (CEST)

Not off hand, presumably you're using Xcode tools 3 not an older version? try importing the .xcodeproj, alternatively ignore the .xcodeproj completely and try staring a new project using the other source files. Nliwilson
Cheers for the quick reply. yep, running xcode 3.0 will give a new project/importing a run.. JD 16:05, 13 June 2008 (CEST)
OK, I created a fresh new project and its up and its opening it and I'm able to compile ok, hopefully that should be enough ;) JD 16:12, 13 June 2008 (CEST)
Nice one, since this is much more representative of what you'll have to do with a real, from scratch project anyway why not amend the article to reflect what you did? Your work, you should take credit. :) nliwilson
Might get round to it at some point, but I'm not sure if it was just my install that may have fudged things a little?? JD 17:48, 13 June 2008 (CEST)

Actually your not the 1st person to have problems with the included xcodeproj files, my user account has been altered, tweaked, mangled and handed down from Mac to Mac so may times I've lost track of the changes I've made so it's perfectly possible I can do things I'm not supposed to be able to (in fact I know for sure I can in other respects). nliwilson 19:01, 13 June 2008 (CEST)

Missing Libraries vs PC

error on compiling "could not find -lfat" checked out the libraries and confirmed it was missing. I copied it from the PC version to the gc and wii folders and all worked fine, but just thought I'd let you know JD 11:39, 14 June 2008 (CEST)

That's interesting, it's set in the make file, that's actually DevkitPPC for Mac failing to comply with "LIBS :="?
What version of DevkitPPC did you download? I take it when you started it as a new project you specified it as a DevkitPPC target? I originally wrote this article with r14 Universal. I'll test r15 and see if it needs libs adding manually or if it needs more than that, Xcode can be difficult with you when it comes to generic make files. nliwilson 16:03, 14 June 2008 (CEST)
It was devkitPPC r15 (universal osx leopard package). It wasn't a new project that I started on the mac, it was one which I was working on with another machine which I think was originally the spritetest demo from wiisprite package.
The file was just missing from the installer package as far as I can tell, but it did come with the windows installer. it shouldn't matter for a lot of developers anyway, only those who want to access the SD card and its not hard to remedy JD 16:20, 14 June 2008 (CEST)

Hmm.. you're quite correct, it's not in the installer and not one of of Xcode's libraries? If you want to include it you'll need to grab it from another app/project/OS's install of DevkitPPC I guess. I'll spend more time on this over the week and see if there's anything else missing. I'll also install it on a PowerPC Mac and see if building for PowerPC on PowerPC makes any difference, it's not supposed to as Xcode compiles universal binaries by default but best to be thorough. nliwilson 17:20, 14 June 2008 (CEST)

The issue is that libfat is separate from devkitPPC. Which PC installer did you use? Take a look at this Sourceforge view: http://sourceforge.net/project/showfiles.php?group_id=114505
If you just install the devkitPPC release from that page, that's all you get -- except in the Mac installer, I cheated and added in libogc (but not libfat). Neither libogc nor libfat is included in the Windows or Linux archives. I guess the eventual solution is to reimplement something like the Windows "automated installer" (although I'm open to suggestions). Bushing 13:01, 16 June 2008 (CEST)
I used the automated installer, which I suppose explains things. I should probably note down on the wiisprite guide about the libfat requirement as I don't think it mentioned it at all? JD 20:33, 16 June 2008 (CEST)

More Missing Libraries

I'm having issues with Xcode and the kernel structure of OS X, due to OS X not having the Bluez Library installed.

I do not think the word "kernel" means what you think it means. You don't need the Bluez library installed.

This is required for some of the libraries compiled with wiiuse.

 ?? Which?

All of Apple's bluetooth libraries are proprietary, (but documented) and from what I can see, unless I am overlooking something, compiling and installing the Bluez library, which contains <bluetooth/bluetooth.h> and its related header files, will cause more conflicting problems within OS X than will solve for this issue. The two libraries are not compatible with each other.

It's not clear why you need bluetooth.h. The following code exists inside of wiiuse:
#if !defined(unix)
        #include <arpa/inet.h>                          /* htons() */
        #include <bluetooth/bluetooth.h>
#endif
This is not compiled in on OS X, because it's Unix.

I'm not competent enough with Obj-C to understand exactly what is happening there, and I really don't have the time to re-write alot of the libogc source to be able to use these tools. I found these issues when trying to compile Wii programs with the wiimote. It did not appear to have issue with any of the GC pads, since they don't use bluetooth for connectivity. Anyone else notice these issues, or is my system just all screwed?Uxp 00:21, 16 October 2008 (UTC)

This has nothing to do with ObjC. Absolutely no header file -- or library -- from the host system is used when compiling code with devkitPPC or libogc. Can you please show us the code you're trying to compile, and the exact errors you are seeing? Bushing 13:11, 16 October 2008 (UTC)
Wow. I apologize. I was reading the error of one completely unrelated output and interpreting it as the error I was receiving from wiiuse. It seems that when compiled on my system, it is math.h that is giving issue. NOT bluetooth.h. This is through wpad.h. here is the output from make:
user@localhost:~/wpadinit$ make
main.c
linking ... wpadinit.elf
/opt/devkitpro/libogc/lib/wii/libwiiuse.a(dynamics.o): In function `calc_joystick_state':
dynamics.c:(.text.calc_joystick_state+0xa0): undefined reference to `atanf'
dynamics.c:(.text.calc_joystick_state+0xf0): undefined reference to `sqrt'
dynamics.c:(.text.calc_joystick_state+0x154): undefined reference to `atanf'
/opt/devkitpro/libogc/lib/wii/libwiiuse.a(dynamics.o): In function `calculate_orientation':
dynamics.c:(.text.calculate_orientation+0x230): undefined reference to `atan2f'
dynamics.c:(.text.calculate_orientation+0x25c): undefined reference to `atan2f'
/opt/devkitpro/libogc/lib/wii/libwiiuse.a(ir.o): In function `calc_yaw':
ir.c:(.text.calc_yaw+0x28): undefined reference to `atanf'
/opt/devkitpro/libogc/lib/wii/libwiiuse.a(ir.o): In function `apply_ir_smoothing':
ir.c:(.text.apply_ir_smoothing+0x3c): undefined reference to `sqrtf'
ir.c:(.text.apply_ir_smoothing+0xa4): undefined reference to `atan2f'
ir.c:(.text.apply_ir_smoothing+0xac): undefined reference to `cosf'
ir.c:(.text.apply_ir_smoothing+0xc8): undefined reference to `sinf'
/opt/devkitpro/libogc/lib/wii/libwiiuse.a(ir.o): In function `rotate_dots':
ir.c:(.text.rotate_dots+0xa0): undefined reference to `cos'
ir.c:(.text.rotate_dots+0xb4): undefined reference to `sin'
/opt/devkitpro/libogc/lib/wii/libwiiuse.a(ir.o): In function `find_sensorbar':
ir.c:(.text.find_sensorbar+0x5d4): undefined reference to `atan2'
ir.c:(.text.find_sensorbar+0x624): undefined reference to `atan2'
ir.c:(.text.find_sensorbar+0x8d4): undefined reference to `atan2'
collect2: ld returned 1 exit status
make[1]: *** [/Users/uxp/wpadinit/wpadinit.elf] Error 1
make: *** [build] Error 2

which is from this "main.c" file:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <ogcsys.h>
#include <gccore.h>
#include <wiiuse/wpad.h>

static void *xfb = NULL;
static GXRModeObj *rmode = NULL;

void Initialize() {

	VIDEO_Init();
	WPAD_Init();
	
	xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
	console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
	
	VIDEO_Configure(rmode);
	VIDEO_SetNextFramebuffer(xfb);
	VIDEO_SetBlack(FALSE);
	VIDEO_Flush();
	VIDEO_WaitVSync();
	if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
}
	
int main(int argc, char **argv) {

	while(1) {
		
		Initialize();
		
		WPAD_ScanPads();
		
	}

	return 0;
}

If I was to comment the WPAD_ScanPads() line then the source would compile fine. If I leave it, then I get undefined references to functions from math.h, which should be defined, afaik. Once again, I apologize for being a complete moron last night and not checking this further before crying for help. Uxp 23:05, 16 October 2008 (UTC)

I am also experiencing this exact issue. What did you have to do to get math.h working? Thanks! --Hizna 15:25, 23 June 2009 (UTC)
Got it working - had to add -lm to the makefile. --Hizna 15:49, 23 June 2009 (UTC)

Automating Wiiload with Xcode's Build and Run feature

Not an error exactly. I have been able to successfully Build projects and manually wiiload the resulting .dol file to my Wii but I haven't been able to figure out how to automate wiiload with Xcode's Build and Run which remains grayed out. The Makefile I'm using contains the following lines:

run:
	wiiload $(TARGET).dol

I've also tried adding a new custom Executable in Xcode. This results in Build and Run becoming available but wiiload doesn't seem to be receiving any arguments (from the Makefile or from the Arguments tab of the custom Executable's info window). Any ideas how to get this working? Sinman 1:00, 9 January 2009 (UTC)

GCUBE

FYI: I've fixed the broken gcube link but gcube for Mac still sucks badly. You may need to test most projects live but with the introduction of TCP Loader, the HomeBrew Channel and Wiiload that's pretty easy these days. nliwilson

Wiiload kicks ass!! I'm not even bothering with the gcube emu thing on my windows machine because of how easy it is! then again I do have my Wii on a composite input on the PC!! JD 17:48, 13 June 2008 (CEST)
Yes it does! :D As well as being a cinch form a command line there are 2 GUI's for Mac (I built one of them because I couldn't get the other one up and running), I've considered taking gcube out of this article altogether and just advising the use of WiiLoad instead, any thoughts? BTW: I also started writing a similar article to this one and scripted a WiiLoad GUI for Linux but realised there'd be absolutely no demand for it. ;) nliwilson 19:01, 13 June 2008 (CEST)

Xcode 3

Nice walkthrough! With the r15 installer, as long as you're running on Leopard with Xcode 3, you should be able to simplify this quite a bit:

  • If people are not seeing their environment updated ($PATH), I need to know, because this is a bug. I have not heard any reports of this failing.
  • The steps to manually open the example xcodeproj are redundant. Those sample projects aren't projects, but project templates -- I don't even know if they will work properly when used in the manner described here. Just go to File -> New Project -> User Templates -> devkitPro -> "devkitPPC Wii Project". Again, if this is not working correctly, I need to know so i can fix it. Bushing 05:14, 15 June 2008 (CEST)

Thanks, this walkthrough's been up for a while so really need's updating, however if I'm going to give it an overhaul I need to go through the process on a "virgin" machine. I'll let you know the result by the end of the week. nliwilson 12:03, 16 June 2008 (CEST)

Sorry about the long delay in getting back to you, my health is pretty bad at the moment. Just an update to say you're quite correct in that the path does not need updating manually, also when I get back to editing this walkthrough (or some kind soul does it for me) there needs to be a simple build example to take people through the basic steps of building/compiling a project. nliwilson 15:27, 3 July 2008 (CEST)

Install Package

Does anybody want me to create a package installer for r17 of this? I don't know DevKit's policy but if it is okay with them I can create one and upload it to WiiBrew. Or if someone would be lending enough, some site with FTP access to some drop-off spot. Pinball wizard 01:27, 8 May 2009 (UTC)

New Guide

Does anyone have a new guide that applies for the newest version? Pinball wizard 23:33, 22 March 2010 (UTC)