Files
smargopolo/LabJack/exodriver-master/INSTALL.MacOSX

224 lines
7.2 KiB
Plaintext

Exodriver (liblabjackusb) Library Installation Instructions
============================================================
Table of Contents
-----------------
Installation From Installer
Installation from Source Code
Mac OS X Requirements
About These Instructions
Installing libusb-1.0
liblabjackusb Library Script Installation
Compiling and Running the Example Programs
Optional: Build a combined 32-/64-bit Exodriver on Mac OS X
Uninstalling the Old U3 and UE9 Driver
Installation From Installer
============================
First, download the installer online here:
http://labjack.com/support/linux-and-mac-os-x-drivers
Next, unzip the downloaded file (if not done automatically) and run the
Exodriver_NativeUSB_Setup.pkg package installer. Follow the instructions
from the installer to install the Exodriver and required libusb-1.0 libraries.
Note that the installed libraries are both 32 and 64-bit binaries. The
installer does not have the source code installation requirements mentioned
below.
To install the latest Exodriver from source code instead, use the instructions
in the "Installation from Source Code" section below.
Installation from Source Code
==============================
Mac OS X Requirements
---------------------
1. Xcode developer tools
2. The libusb-1.0 library. See the "Installing libusb-1.0" for the libusb-1.0
download and installation instructions.
3. Mac OS X 10.5 Leopard or later.
4. Uninstall any MacOSX_C_NativeUSB based drivers. The old driver conflicts
with the current liblabjackusb library. See the "Uninstalling the Old U3 and
UE9 Driver" section for more information.
About These Instructions
------------------------
All lines that start with a dollar sign ($) are commands and need to be run
from a terminal. For example, the Terminal application is usually located in
the Applications folder.
Installing libusb-1.0
---------------------
Mac OS X requires libusb-1.0 to be built from the source. Download the source
from the libusb project page:
http://libusb.info
Version 1.0.21 is the latest as of 2017. From the directory containing
the libusb source download, build it in the standard way:
$ tar xvfj libusb-1.0.21.tar.bz2
$ cd libusb-1.0.21/
$ ./configure
$ make
$ sudo make install
For building a combined 32/64-bit libusb-1.0 library, refer to the
"Optional: Build a combined 32-/64-bit Exodriver on Mac OS X" section.
liblabjackusb Library Script Installation
-----------------------------------
First, go to the Exodriver directory.
To install by script, run the following command:
$ sudo ./install.sh
This script will attempt to build, install, and make any necessary
system configurations.
Alternatively, without using the script go to the liblabjackusb/
directory and run the following commands:
$ cd liblabjackusb/
$ make
$ sudo make install
For building a combined 32/64-bit liblabjackusb library, refer to the
"Optional: Build a combined 32-/64-bit Exodriver on Mac OS X" section.
Compiling and Running the Example Programs
------------------------------------------
The example code/programs use the liblabjackusb library and the labjackusb.h
header files in the liblabjackusb/ directory.
The examples are located in the U3, U6, and UE9 subdirectories in the examples/
directory. To compile the programs go to your device's directory and run
$ cd examples/U6/
$ make
Run one of example programs like this:
$ ./u6BasicConfigU6
Optional: Build a combined 32-/64-bit Exodriver on Mac OS X
-----------------------------------------------------------
These steps are generally not needed, but there are circumstances that require
a combined 32-bit and 64-bit Exodriver. You need both architectures when you
get error messages like the one in "this LabJack forum
topic":http://forums.labjack.com/index.php?showtopic=4983
dlopen(liblabjackusb.dylib, 6): no suitable image found. Did find:
/usr/local/lib/liblabjackusb.dylib: mach-o, but wrong architecture
In this case, a 32-bit process tried to load a 64-bit Exodriver. Here's how it
happened: When following the instructions in the Quickstart, the compiler built
a copy of the Exodriver for its native architecture. On modern Mac OS X
systems, that's x86_64 (64-bit). Verify this by running:
$ file /usr/local/lib/liblabjackusb.dylib
/usr/local/lib/liblabjackusb.dylib: Mach-O 64-bit dynamically linked shared library x86_64
Normally, this is what you want. The programs you will use to call the
Exodriver will also be 64-bit. The built-in Python on Mac OS X, for example, is
compiled for three architectures, including x86_64:
$ file /usr/bin/python
/usr/bin/python: Mach-O universal binary with 3 architectures
/usr/bin/python (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/python (for architecture i386): Mach-O executable i386
/usr/bin/python (for architecture ppc7400): Mach-O executable ppc
There are some programs on Mac OS X, though, that are not 64-bit (they're i368
only), and they can't load a 64-bit Exodriver. The Python download from
python.org, for example, is 32-bit at the time of this writing. We recommend
using the built-in Python on Mac OS X.
When you must load the Exodriver from a 32-bit process, you must compile
libusb-1.0 and the Exodriver to be combined 32-/64-bit libraries. Start with
libusb-1.0:
$ tar xvfj libusb-1.0.21.tar.bz2
$ cd libusb-1.0.21/
$ export CFLAGS="-arch i386 -arch x86_64"
$ ./configure --disable-dependency-tracking
$ make
$ sudo make install
Confirm it worked by running:
$ file /usr/local/lib/libusb-1.0.dylib
/usr/local/lib/libusb-1.0.dylib: Mach-O universal binary with 2 architectures
/usr/local/lib/libusb-1.0.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/usr/local/lib/libusb-1.0.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
After libusb-1.0 is installed correctly, move on to the Exodriver. Find the
Exodriver download directory
$ cd path/to/exodriver
$ cd liblabjackusb/
Now edit the Makefile in a text editor to comment out (put a # sign in front
of) this ARCHFLAGS line:
#ARCHFLAGS =
and uncomment (remove the # sign from) this ARCHFLAGS line two lines below it:
ARCHFLAGS = -arch i386 -arch x86_64
Now build and install the software
$ make clean
$ make
$ sudo make install
Verify that it worked by running:
$ file /usr/local/lib/liblabjackusb.dylib
/usr/local/lib/liblabjackusb.dylib: Mach-O universal binary with 2 architectures
/usr/local/lib/liblabjackusb.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/usr/local/lib/liblabjackusb.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
Because libusb-1.0 and the Exodriver are built for the i386 architecture,
32-bit applications can load them.
Uninstalling the Old U3 and UE9 Driver
--------------------------------------
The old U3 and UE9 driver, previous to the libusb 1.0 requirement, used custom
kernel modules, and will conflict with with the current liblabjackusb library.
To uninstall the old driver, delete the liblabjackusb.dylib:
$ sudo rm -f /usr/lib/liblabjackusb.dylib