Building OpenOCD with new ftdi library on (PPC) Mac

I’ve been using OpenOCD 0.4, 0.5, 0.6 and 0.6.1 with usblib 0.1.12; I can compile these, no problems there.

As I’d like my OpenOCD to be as good as possible, I’m interested in getting it to work with libftdi1 and usblib 1.0.

However, my attempts so far have failed miserably.

First real problem is with boost. To me that is a huge heap of obsolete bits.

I’m experienced with compiling GCC and would be interested to know if it’s possible to bypass compiling boost, and just making symlinks (like when compinling gmp, mpfr and mpc into GCC), so I don’t have to wait half an hour for boost to finish compiling.

Apart from that, usblib 1.0 seem to compile fine, but libftdi fails for me with the following error:

Linking CXX executable test_libftdi1

Undefined symbols:

“boost::unit_test::unit_test_main(bool (*)(), int, char**)”, referenced from:

_main in basic.cpp.o

ld: symbol(s) not found

collect2: ld returned 1 exit status

make[2]: *** [test/test_libftdi1] Error 1

make[1]: *** [test/CMakeFiles/test_libftdi1.dir/all] Error 2

make[1]: *** Waiting for unfinished jobs…

(Sidenote: I had to type this by hand, as my terminal just locked up while building OpenOCD without libftdi1; eg. compiling nuc912.c is where the lockup happened. Terminal is now useless and I have to make another duplicate; one copy was dead already.)

Here’s what I am hoping for…

1: Writing a script that does it all the same way, each time I compile, so I can fine-tune the settings if necessary.

2: Link with as few shared libraries as possible, for easy distribution (so I can make an installer for those who find it difficult to compile OpenOCD)

3: Use the best possible configuration; eg. with libftdi1 for instance.

4: Keep the size of the binary as low as possible (eg. if it’s possible to tear parts of boost in an official way, that would be excellent)

Please know that building this for a PowerPC based Mac is not straightforward. Building on intel-based platforms is far easier, as I’m limited to using gcc 4.2, and Apple’s PPC version of gcc 4.2 differs from their intel version of gcc 4.2!

    • This is basically what I’m currenly attempting to use: - -

build libConfuse:

mkdir -p “$build/libconfuse”; cd “$build/libconfuse”

“$source/confuse-2.7/configure”

make

sudo make install

build libusb 0.1:

mkdir -p “$build/libusb0”; cd “$build/libusb0”

“$source/libusb-0.1.12/configure”

make

sudo make install

build libusb 1.0:

mkdir -p “$build/libusb1”; cd “$build/libusb1”

“$source/libusb-1.0.9/configure”

make

sudo make install

build boost:

cd “$source/boost_1_53_0”

./bootstrap.sh

./b2 install --prefix=“/usr/local” --build-dir=“$build/boost”

build the old libftdi:

mkdir -p “$build/libftdi0”; cd “$build/libftdi0”

“$source/libftdi-0.20/configure”

make all

sudo make install

build libftdi1:

mkdir -p “$build/libftdi1”; cd “$build/libftdi1”

cmake -DLIBUSB_INCLUDE_DIR=“/usr/local/include/libusb-1.0” -DCMAKE_INSTALL_PREFIX=“/usr/local” “$source/libftdi1-1.0/”

make all

sudo make install

build OpenOCD:

cd “$source/openocd-0.6.1”

“$source/openocd-0.6.1/configure” --enable-ft2232_libftdi --enable-usbprog --enable-presto_libftdi --enable-stlink --enable-arm-jtag-ew --enable-jlink --enable-rlink --enable-vsllink --enable-usb_blaster_libftdi --enable-remote-bitbang --enable-vsllink --enable-ulink --enable-osbdm --enable-opendous --enable-ftdi

make

sudo make install

    • (end of build-commands) - -

Note: -DLIBUSB_INCLUDE_DIR seems to be necessary, as it’s not found otherwise.

(If I could make a wish, I’d ask for cmake and boost to be taken out; this may be easier said than done, though).

What’s the recommended way of compiling libftdi for use with OpenOCD ? (and is it possible to make it a static library, so there’s less stuff to install/remove for other users ?)

Have not tried the latest version of libftdi as i generally use the new ftdi OpenOCD driver, all it requires is libusb-1.0 or libusbx

configure with --enable-ftdi - you will find it much faster then the other available ftdi drivers.

The only other change is to select the updated interface config, generally by adding ftdi to the path, eg

old - source [find interface/olimex-arm-usb-ocd-h.cfg]
new - source [find interface/ftdi/olimex-arm-usb-ocd-h.cfg]

Cheers

Spen