Mac build instructions

From PinballControllers Wiki

Jump to: navigation, search

Contents

Mac Build Instructions

These instructions were written based on a system running Mac OS X 10.6.4 (Snow Leopard).

libpinproc Prerequisites

libpinproc uses libftdi to talk to the P-ROC hardware. libftdi depends on libusb-0.1.x for this, but we have found that libusb-1.0.x works much better on Mac OS X (which libftdi-0.16 does not support). Fortunately we can use libusb-compat to provide a 0.1.x-compatible interface for libftdi to use.

libpinproc's example program (pinproctest) depends on the yaml-cpp project. In order to build yaml-cpp, cmake is required.


libusb

Building libusb version 1.0.8:

   ./configure
   make CFLAGS="-arch i386"
   sudo make install

libusb-compat

Building libusb-compat version 0.1.1:

   ./configure
   make CFLAGS="-arch i386"
   sudo make install

libftdi

Building libftdi version 0.18:

   ./configure
   make CFLAGS="-arch i386"
   sudo make install

yaml-cpp

yaml-cpp is used by libpinproctest.

  • Download and extract yaml-cpp into a directory of your choice. Latest version tested: 0.2.6
  • If you haven't already installed cmake, install it now.
  • From the command line, 'cd' into your yaml-cpp directory and run the following commands:
   mkdir bin
   cd bin
   cmake ..
   make
   sudo make install

libpinproc

  • Download (and extract) libpinproc into a directory of your choice. Note - make sure you select the desired branch to download (either master or dev).
    • Download either by clicking 'Download Sources' or by installing a git client and checking out the repository.
  • From the command line, 'cd' into the libpinproc directory and run the following commands:
  • Supported:
   mkdir bin
   cd bin
   cmake -DBUILD_SHARED_LIBS=ON ..
   make
   sudo make install
  • Unsupported:
   make CFLAGS="-arch i386" LDFLAGS="-arch i386"

pypinproc

  • Build pypinproc - libpinproc Python extension
    • Download (and extract) pypinproc into a directory of your choice. Note - make sure you select the desired branch to download (either master or dev).
      • Download either by clicking 'Download Sources' or by installing a git client and checking out the repository.

By default distutils likes to build i386 and PPC binaries, presumably for creating a binary distribution. In our case we only want the current architecture, the one we used to build the previous libraries. The pypinproc setup.py script checks for the ARCH environment variable; if it is set it will build pypinproc using that architecture.

   ARCH=i386 python setup.py build
   sudo python setup.py install

PyYAML

Install PyYAML:

   sudo python setup.py install

Additional Notes

Determining Library Architecture

You may need to determine the architecture of a library (.a file). The best way to do this seems to be:

   otool -hv filename.a

The output will be verbose, but you should see, in the cputype column, i386 or x86_64.

pkgconfig

If you receive the error:

   configure: error: The pkg-config script could not be found or is too old.

You will need to install/update pkgconfig. One approach is to install it using the MacPorts project:

    sudo port install pkgconfig

libftdi Errors

-3: device not found

This error seems to be caused by bugs in versions of libusb prior to 1.0.8; if you see this error ensure that your libraries are up to date.

-5: unable to claim usb device

This error appears to be related to a conflicting kernel extension called FTDIUSBSerialDriver. You can disable this driver with the following command:

   sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext

See also: "Can't claim device" forum thread.

Personal tools