Player/Stage, MacPorts, and iPhone

Today I worked on setting up Player/Stage on my Macbook Pro with Leopard 10.5.6 and I ran into a few issues. I was using Macports 1.710 and I was attempting to install player-stage-player (2.03 2.1.2) and player-stage-stage (2.03 2.1.1) following a short guide at http://bentham.k2.t.u-tokyo.ac.jp/notebook/?p=247

If it's your first time using macports it can take a long time. I waited 2+ hours to download/build/install dependencies

I used the command:

$ sudo port install playerstage-player playerstage-stage

However it errored out at the end with the message:

$ sudo port install playerstage-player playerstage-stage
--->  Building playerstage-player
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_science_playerstage-player/work/player-2.0.4" && make all " returned error 2
Command output: building '_playerc' extension
swigging playerc.i to playerc_wrap.c
swig -python -o playerc_wrap.c playerc.i
playerc.i:44: Warning(124): Specifying the language name in %typemap is deprecated - use #ifdef SWIG instead.
playerc.i:82: Warning(124): Specifying the language name in %typemap is deprecated - use #ifdef SWIG instead.
playerc.i:121: Warning(124): Specifying the language name in %typemap is deprecated - use #ifdef SWIG instead.
playerc.i:127: Warning(124): Specifying the language name in %typemap is deprecated - use #ifdef SWIG instead.
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -I./../.. -I../../../.. -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c playerc_wrap.c -o build/temp.macosx-10.5-i386-2.5/playerc_wrap.o
playerc_wrap.c: In function '_wrap_playerc_mclient_client_set':
playerc_wrap.c:40301: warning: assignment from incompatible pointer type
playerc_wrap.c: In function '_wrap_playerc_mclient_addclient':
playerc_wrap.c:40504: warning: passing argument 2 of 'playerc_mclient_addclient' from incompatible pointer type
playerc_wrap.c: In function '_wrap_playerc_mclient_client_set':
playerc_wrap.c:40301: warning: assignment from incompatible pointer type
playerc_wrap.c: In function '_wrap_playerc_mclient_addclient':
playerc_wrap.c:40504: warning: passing argument 2 of 'playerc_mclient_addclient' from incompatible pointer type
gcc -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc build/temp.macosx-10.5-i386-2.5/playerc_wrap.o -L./../../.libs -L../../../../libplayerxdr/.libs -L../../../../libplayercore/.libs -L../../../../libplayerjpeg/.libs -lplayerxdr -lplayerc -lplayerjpeg -ljpeg -lplayererror -o build/lib.macosx-10.5-i386-2.5/_playerc.so
ld: library not found for -ljpeg
collect2: ld returned 1 exit status
ld: library not found for -ljpeg
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccI9TvVp.out
(No such file or directory)
error: command 'gcc' failed with exit status 1
make[6]: *** [pythonbuild] Error 1
make[5]: *** [all] Error 2
make[4]: *** [all-recursive] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Error: Status 1 encountered during processing.

[ad# Link Banner]

So I searched around the MacPorts website and I came across the ticket #18891, which basically said to run the following command to change the version of python being used from 3.0 to 2.5.

$ sudo port install python_select && sudo python_select python25
Skipping org.macports.activate (python_select +darwin_9) since this
port is already active
--->  Cleaning python_select
Selecting version "python25" for python

Following that command I was able to finish installing Player/Stage via MacPorts by using the orginal port command.

$ sudo port install playerstage-player playerstage-stage
--->  Building playerstage-player
--->  Staging playerstage-player into destroot
--->  Installing playerstage-player @2.0.4_2
--->  Activating playerstage-player @2.0.4_2
--->  Cleaning playerstage-player
--->  Fetching playerstage-stage
--->  Attempting to fetch stage-2.0.3.tar.bz2 from
http://voxel.dl.sourceforge.net/playerstage
--->  Verifying checksum(s) for playerstage-stage
--->  Extracting playerstage-stage
--->  Configuring playerstage-stage
--->  Building playerstage-stage
--->  Staging playerstage-stage into destroot
--->  Installing playerstage-stage @2.0.3_0
--->  Activating playerstage-stage @2.0.3_0
--->  Cleaning playerstage-stage

I tried to use player stage from MacPorts.

$ player /opt/local/var/macports/software/playerstage-stage\
/*/opt/local/share/stage/worlds/simple.cfg

And I received the error:

rr: unable to open color database /usr/X11R6/lib/X11/rgb.txt
 : No such file or directory (stage.c stg_lookup_color)

Following the advice from http://bentham.k2.t.u-tokyo.ac.jp/notebook/?cat=5 I added the following link.

$ sudo ln -s /usr/X11/share/X11/rgb.txt /usr/X11R6/lib/X11/rgb.txt

Now I am able to create a player server and connect with a client with the commands:

$ player /opt/local/var/macports/software/playerstage-stage\
/*/opt/local/share/stage/worlds/simple.cfg

/opt/local/var/macports/software/playerstage-player\
/*/opt/local/share/player/examples/libplayerc++/laserobstacleavoid

With the ability to run player/stage I will post again on my progress as I use an iPhone to run the Player client, rather than my Macbook Pro.

[caption id="attachment_209" align="alignleft" width="443" caption="Player client running on iPhone with Player/Stage."]Player client running on iPhone with Player/Stage.[/caption]

[ad#Large Box]

Macbook Pro + Windows + Dual Monitors = Painful

I didn't think it would be so hard to just get my taskbar and icons on a second monitor using Windows on my Macbook Pro. It doesn't seem like a whole lot of people run Windows on the Mac, so there isn't a whole lot of resources if you get stuck. It takes a lot of digging to find the real answers. Turns out the display drivers from NVIDIA/Apple for Windows don't support making an external monitor as a primary monitor. It only gives the option of making the laptop display primary. This limitation is very painful and kept me up for hours/days searching for registry hacks, hacked drivers, and more. Here's what I found that didn't work and what did:

Registry hack: Fail = True;

The Apple nVidia driver INF file is missing 2 registry entries for using external display as primary in a dual display setup. The keys you need are:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video{C0FF928A-9E27-40AE-845F-E0D8A8E03216}\0000 "DualViewAllow2ndViewAsPrimary"=dword:00000001 "DualViewMobile"=dword:00000002

Do not import these lines directly. Do them manually via REGEDIT. The hardware ID (C0FF928A-9E27-40AE-845F-E0D8A8E03216) is different in every system, so put the keys in the correct video hardware key in your system.

[ad#Large Box]

Turns out Windows didn't like the registry hack and I couldn't get anything up on the display, even though I was able to get the primary display option on my external monitor with the hack. I also had to guess which hardware ID to use, since there were 5 hardware key options. I tried the logical one with a lot of registry entries for display modes/settings under the 0000 folder.

Updated Supported Drivers: Fail = True; Again I began searching for something else, but there's not a whole lot of information on this topic. I contemplated installing a different set of drivers for Windows, but the one I found referenced from Apples discussion page was older than the current driver I have now. There was a recent update for Boot Camp to 2.1 this summer which looks like it included new NVIDIA drivers.

Updated Un-supported Drivers: Fail = True; Not having a real solution from Apple I looked into the drivers from http://www.laptopvideo2go.com/ however I found a few posts that said it didn't help or wasn't performing as well. I'm doing game development (XNA) on my laptop and I don't want to ruin a working system or introduce incompatibilities; so stability is very important for me at the moment. I decided to try and avoid non-standard drivers and look for another alternative.

nView Desktop Manager: Success = True; nView Desktop Manager Here is the solution that I had been looking for; it was something I found last year, but forgot about since I didn't have dual monitors. To enable it you'll need to go to 'Control Panel' -> 'NVIDIA nView Desktop Manager' -> click 'Enable'. Now you should see the nView Properties option when you right click on your desktop and you've just opened a whole can of worms for customizing your desktop.

[ad#Link Banner]

  • You can move your Taskbar/icons to your second display by the 'Tools' tab and 'Move to Display' button.
  • Set multiple desktop backgrounds using the 'Desktops' tab and the Properties button. There's a check box to 'Allow different backgrounds per display'
  • Hotkeys to perform various tasks related to windows management
  • Profiles to save/load settings when switching between a dual monitor/single display setup.
  • Transparency effects on window drags and more...

Edit: As much as I'd like this solution to work all the time; it still has bugs. Dialogs on different applications appear on the laptop display and the software can sometimes be glitchy for the development work I'm doing. WinForms development with Visual Studio 2005 Express seems to bug it out the most and causes Icons to flicker. I'm not sure if that flicker is because of the dual monitor setup or from WinForm editing in VS 2005.

[ad#Large Box]