Building SleepyHead for Mac OS X 10.6 from Source Code

General Discussion on any topic relating to CPAP and/or Sleep Apnea.
User avatar
Breathe Jimbo
Posts: 954
Joined: Sun Sep 12, 2010 3:02 pm
Location: Pasadena, CA

Building SleepyHead for Mac OS X 10.6 from Source Code

Post by Breathe Jimbo » Fri Jul 01, 2011 7:48 pm

These are the steps that I used to build SleepyHead for Mac OS X 10.6 (Snow Leopard). These steps include the prerequisites of installing Xcode (and all related Apple development stuff) and using MacPorts to install QT 4.7.3. If you already have Xcode and QT on your Mac running Snow Leopard, you can skip some of these steps. N.B. I am not a programmer and cannot provide real "support" if these instructions do not work for you.

1. Open the App Store (in the Apple pull-down menu in the upper left-hand corner). Purchase and download Xcode for $4.99. This will take a while because Xcode is big.

2. Open your Applications folder and double-click on Install Xcode. I don't remember installation options, but if you see any you basically want EVERYTHING. Installation will take a while because Xcode is big. After installation, reboot to be on the safe side.

3. Go to http://www.macports.org/install.php Since you have installed Xcode and X11 is installed by default as part of Snow Leopard, you can scroll to the second section called "Mac OS X Package (.pkg) Installer." Left-click on the hyperlink for "Snow Leopard" and follow the instructions to install MacPorts from the .dmg file that will be downloaded.

4. Open your Applications folder and the Utilities subfolder therein, and double-click on the Terminal icon.

5. Right-click on the Terminal icon in your Dock, left-click on Options, and left-click again on Keep in Dock. All your commands to MacPorts, and other commands set forth below, will be via the command line in the Terminal, so you should have the Terminal handy in your Dock.

6. Save these two commands to a file somewhere because you will want to enter them periodically, on the command line in the Terminal, to keep MacPorts up-to-date:

sudo port selfupdate
sudo port upgrade outdated

7. Enter "sudo port selfupdate" (no quotes) on the command line, hit Return, enter your password, and hit Return again. Wait for the command line to reappear.

8. Same for "sudo port upgrade outdated" (no quotes) and hit Return, etc. Wait for the command line to reappear. If you see the "Error: No ports matched the given expression," that is not a problem. It means everything is up to date, so just continue.

9. Warning: it took about 7 hours to build QT on my iMac and MacBook, so you may want to do the next step near bedtime and let it run overnight. Enter "sudo port -v install qt4-mac +debug +universal" on the command line, hit Return, etc. Remember: this takes a long, long time to finish.

10. When you see the command line again (after several hours), enter "port info qt4-mac" and hit Return. You are ready to get and build the SleepyHead source code if you see the following output:

$ port info qt4-mac
qt4-mac @4.7.3 (aqua)
Variants: (+)debug, demos, examples, framework, mysql,
odbc, psql83, psql84, psql90, psql91, [+]quartz,
raster, sqlite2, (+)universal

Description: Qt Tool Kit: A cross-platform framework
(headers, data, and libraries) for writing
cross-platform GUI-based applications.
Homepage: http://qt.nokia.com/

Build Dependencies: pkgconfig
Library Dependencies: zlib, dbus, openssl, sqlite3, tiff, libpng,
libmng, jpeg
Conflicts with: qt3, qt3-mac, qt4-mac-devel
Platforms: macosx
License: unknown
Maintainers: michaelld@macports.org

11. In the Terminal, enter "cd" (no quotes here or below) and hit Return.

12. Enter "mkdir git" and hit Return.

13. Enter "cd git" and hit Return.

14. Enter "git clone git://sleepyhead.git.sourceforge.net/gitroot/sleepyhead/sleepyhead" and hit Return. (The forum software likes to abbreviate this long command, so you may need to right click on the preceding link, copy the link, and then paste the link into the Terminal.)

15. Once git finishes the download and you see the command line again, enter "cd sleepyhead" and hit Return.

16. Enter "qmake" and hit Return.

17. Enter "make" and hit Return.

18. Enter "mv sleepyheadqt.app ~/desktop" and hit Return.

19. Housekeeping: enter "make clean" and hit Return.

20. Go to your Desktop and double-click on the sleepyheadqt icon.

21. To load your data, your SD card must be mounted on your system, so that it appears as a Device in the list on the upper left side of a Finder window. Alternatively, you can make a "duplicate" of your SD card and drag the duplicate folder to your Desktop, the Documents folder, or elsewhere. To load your data in SleepyHead, click on the Import icon on the right side of the Welcome window and navigate to your SD card or the duplicate folder. It takes about 10 second to import at this point.

N.B. SleepyHead is currently alpha code - a very rough work in progress. Much does not work, and many things will change. At this point, your use is experimental and should be focused primarily on finding bugs and problems. SleepyHead is not "ready" for ordinary use and should not be used as your main software. Keep your old software and always backup your data.

If you are successful in following these steps and building SleepyHead for your Mac, please subscribe to the developer mailing list at https://lists.sourceforge.net/lists/lis ... head-devel so that you can report bugs and problems to Mark.

_________________
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Since 9/9/10; 13 cm; ResScan 3.16; SleepyHead 0.9; PapCap
Last edited by Breathe Jimbo on Sun Jul 10, 2011 9:17 pm, edited 4 times in total.

User avatar
dlg_az
Posts: 28
Joined: Tue Jun 21, 2011 1:11 pm
Location: Arizona

Re: Building SleepyHead for Mac OS X 10.6 from Source Code

Post by dlg_az » Fri Jul 01, 2011 9:08 pm

Wow. Thanks for this, Jimbo. I'm going to give it a try this weekend. I'd love to be able to use sleepyhead on my iMac. Have you by chance tried to use something like Virtual Box or Parallels? I've tried Virtual Box but can't seem to get the SD card reader recognized on the VM.

_________________
Machine: PR System One REMStar 60 Series Auto CPAP Machine
Mask: Swift™ FX Nasal Pillow CPAP Mask with Headgear
Additional Comments: Diagnosed June 9, 2011

User avatar
Breathe Jimbo
Posts: 954
Joined: Sun Sep 12, 2010 3:02 pm
Location: Pasadena, CA

Re: Building SleepyHead for Mac OS X 10.6 from Source Code

Post by Breathe Jimbo » Fri Jul 01, 2011 9:24 pm

dlg_az wrote:Have you by chance tried to use something like Virtual Box or Parallels?
No. Since we have to build from source at this point, might as well build for one's platform - Linux, OS X, or windoze.

_________________
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Since 9/9/10; 13 cm; ResScan 3.16; SleepyHead 0.9; PapCap

User avatar
Breathe Jimbo
Posts: 954
Joined: Sun Sep 12, 2010 3:02 pm
Location: Pasadena, CA

Re: Building SleepyHead for Mac OS X 10.6 from Source Code

Post by Breathe Jimbo » Sat Jul 09, 2011 9:06 pm

I cleaned up the instructions in the first post starting this topic.

_________________
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Since 9/9/10; 13 cm; ResScan 3.16; SleepyHead 0.9; PapCap

User avatar
tschultz
Posts: 257
Joined: Sun Dec 19, 2010 9:36 pm
Location: Moncton, NB, Canada, Earth, Milky Way Galaxy

Re: Building SleepyHead for Mac OS X 10.6 from Source Code

Post by tschultz » Sun Jul 10, 2011 8:18 pm

I would highly recommend not using the Qt version from MacPorts, but instead use the version that is available natively for the Mac. There is no need to have to build Qt using MacPorts to build and/or develop using the SleepyHead source code.

The native version for Mac, as well as Windows or Linux, can be found here http://qt.nokia.com/downloads/. This would replace steps 3 through 10 in the instructions. I used to have the MacPorts version installed and removed it once I found the native version a few months back. I have conformed that the native version compiles the project fine, with only a few warnings that are unrelated to the Qt version(s). The built-in Qt update manager also works very well allowing Qt to be easily kept up to date if you like.

Although you can use MacPorts it tends to be rather finicky when future updates to packages in MacPorts come along as they inevitably do. Things tend to get broken at times, and the complies are inconsistent on the various Mac systems for a number of the packages. The native version(s) will always be more stable and better supported than trying to make the Linux version compile under the Mac.

_________________
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Currenlty using Auto 15-20, EPR 1 with medium response; 95% pressure is 16.8
Adjusting to life with OSA and being pressurized each night ...

User avatar
Breathe Jimbo
Posts: 954
Joined: Sun Sep 12, 2010 3:02 pm
Location: Pasadena, CA

Re: Building SleepyHead for Mac OS X 10.6 from Source Code

Post by Breathe Jimbo » Sun Jul 10, 2011 9:15 pm

Troy, does the Mac version you prefer install the multiple dependencies of QT? MacPorts does so automatically when QT is installed. I dare say that, for the average non-programmer like me, it would be essentially impossible to figure out all the other software packages that are necessary, and to install each and every one manually. I included the MacPorts steps because that may be the only practical way for a non-programmer to proceed. Programmers are, of course, a completely different story and don't need any instructions from me in the first place.

_________________
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Since 9/9/10; 13 cm; ResScan 3.16; SleepyHead 0.9; PapCap

User avatar
tschultz
Posts: 257
Joined: Sun Dec 19, 2010 9:36 pm
Location: Moncton, NB, Canada, Earth, Milky Way Galaxy

Re: Building SleepyHead for Mac OS X 10.6 from Source Code

Post by tschultz » Mon Jul 11, 2011 7:58 pm

Breathe Jimbo wrote:Troy, does the Mac version you prefer install the multiple dependencies of QT? MacPorts does so automatically when QT is installed. I dare say that, for the average non-programmer like me, it would be essentially impossible to figure out all the other software packages that are necessary, and to install each and every one manually. I included the MacPorts steps because that may be the only practical way for a non-programmer to proceed. Programmers are, of course, a completely different story and don't need any instructions from me in the first place.
MacPorts is much more a "programmers" solution than not. The native Qt installer takes care of everything needed for Qt out of the box and does not take the many hours needed to compile.
I did not take a look at any other dependencies that may be needed by SleepyHead as anything needed I already had installed. The OpenGL and TrueType support I think are the only things needed and I do believe they are already part of Qt as it has direct support for them.

MacPorts takes a non-standard Apple approach to where it places certain files and what it does. This can then become easily broken or actually cause issues with other native Mac applications especially if there are conflicting libraries. You already found some of these problems with the wxWidgets from MacPorts, those problems were not all wxWidgets but partly MacPorts. I did not use the MacPort versions of wxWidgets due to several of these kinds issues as well.

_________________
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Currenlty using Auto 15-20, EPR 1 with medium response; 95% pressure is 16.8
Adjusting to life with OSA and being pressurized each night ...