libftdi Archives

Subject: Re: Patch for building examples on MacOS X Lion

From: Jared Boone <jared@xxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 15 May 2012 09:06:46 -0700
On May 15, 2012, at 3:08 AM, Thomas Jarosch wrote:

> Thanks for the patch. It's a bit odd that the order of the
> include_directories statement matters at all.

Sorry, I'm usually more thorough. Here's everything leading up to the compile 
failure:

$ git clone git://developer.intra2net.com/libftdi
$ cd libftdi
$ mkdir build
$ cd build
$ cmake ..
$ make

...build progresses to examples/eeprom.c, which fails like this:

[ 66%] Building C object examples/CMakeFiles/eeprom.dir/eeprom.c.o
/Users/jboone/src/libftdi/examples/eeprom.c: In function ‘read_decode_eeprom’:
/Users/jboone/src/libftdi/examples/eeprom.c:21: error: too few arguments to 
function ‘ftdi_read_eeprom’
/Users/jboone/src/libftdi/examples/eeprom.c:30: warning: implicit declaration 
of function ‘ftdi_get_eeprom_value’
/Users/jboone/src/libftdi/examples/eeprom.c:30: error: ‘CHIP_SIZE’ undeclared 
(first use in this function)
/Users/jboone/src/libftdi/examples/eeprom.c:30: error: (Each undeclared 
identifier is reported only once
/Users/jboone/src/libftdi/examples/eeprom.c:30: error: for each function it 
appears in.)
/Users/jboone/src/libftdi/examples/eeprom.c:42: warning: implicit declaration 
of function ‘ftdi_get_eeprom_buf’
/Users/jboone/src/libftdi/examples/eeprom.c:61: warning: passing argument 1 of 
‘ftdi_eeprom_decode’ from incompatible pointer type
/Users/jboone/src/libftdi/examples/eeprom.c:61: warning: passing argument 2 of 
‘ftdi_eeprom_decode’ makes pointer from integer without a cast
/Users/jboone/src/libftdi/examples/eeprom.c:61: error: too few arguments to 
function ‘ftdi_eeprom_decode’
/Users/jboone/src/libftdi/examples/eeprom.c: In function ‘main’:
/Users/jboone/src/libftdi/examples/eeprom.c:218: error: ‘CHIP_TYPE’ undeclared 
(first use in this function)
/Users/jboone/src/libftdi/examples/eeprom.c:235: warning: passing argument 1 of 
‘ftdi_eeprom_initdefaults’ from incompatible pointer type
/Users/jboone/src/libftdi/examples/eeprom.c:235: error: too many arguments to 
function ‘ftdi_eeprom_initdefaults’
/Users/jboone/src/libftdi/examples/eeprom.c:236: warning: implicit declaration 
of function ‘ftdi_set_eeprom_value’
/Users/jboone/src/libftdi/examples/eeprom.c:236: error: ‘MAX_POWER’ undeclared 
(first use in this function)
/Users/jboone/src/libftdi/examples/eeprom.c:247: warning: passing argument 1 of 
‘ftdi_eeprom_build’ from incompatible pointer type
/Users/jboone/src/libftdi/examples/eeprom.c:247: error: too few arguments to 
function ‘ftdi_eeprom_build’
/Users/jboone/src/libftdi/examples/eeprom.c:258: warning: passing argument 1 of 
‘ftdi_eeprom_initdefaults’ from incompatible pointer type
/Users/jboone/src/libftdi/examples/eeprom.c:258: error: too many arguments to 
function ‘ftdi_eeprom_initdefaults’
/Users/jboone/src/libftdi/examples/eeprom.c:277: warning: passing argument 1 of 
‘ftdi_eeprom_build’ from incompatible pointer type
/Users/jboone/src/libftdi/examples/eeprom.c:277: error: too few arguments to 
function ‘ftdi_eeprom_build’
/Users/jboone/src/libftdi/examples/eeprom.c:285: error: too few arguments to 
function ‘ftdi_write_eeprom’
make[2]: *** [examples/CMakeFiles/eeprom.dir/eeprom.c.o] Error 1
make[1]: *** [examples/CMakeFiles/eeprom.dir/all] Error 2
make: *** [all] Error 2

Doing a build with "make VERBOSE=1" shows this command line being executed 
before the failure:

cd /Users/jboone/src/libftdi/build/examples && /usr/bin/gcc  -DDEBUG -g 
-I/opt/local/include -I/Users/jboone/src/libftdi/ftdipp 
-I/Users/jboone/src/libftdi/src -I/opt/local/include/libusb-1.0    -Wall -o 
CMakeFiles/eeprom.dir/eeprom.c.o   -c 
/Users/jboone/src/libftdi/examples/eeprom.c

I installed libconfuse 2.7 and got the same result.

Note from the command line above that /opt/local/include is the first -I in the 
command. This directory contains a libftdi 0.20 build from MacPorts, which I'm 
using with other MacPorts-built software (e.g. urJTAG). I wanted to build a 
private version of libftdi so that I could develop a program based on 
examples/stream_test.c and the related streaming API, to talk to some hardware 
I designed around an FTDI FT2232H and synchronous FIFO mode.

I did a diff on /opt/local/include/ftdi.h and src/ftdi (from git) and they're 
very different, including the streaming API and ftdi_eeprom function in the 
failure above. This is why I created a patch to push -I/opt/local/include to 
later in the include list. I wanted to avoid picking up the MacPorts version of 
ftdi.h, which is apparently the reason for my private build failure.

> Which cmake version do you use?

I'm using CMake 2.8.7, built/installed via MacPorts 2.0.4, on Mac OS X Lion, 
and Xcode 4.3.2. Here's the result of "cmake .." from above:

-- The C compiler identification is GNU
-- The CXX compiler identification is Clang
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Build type: Debug
-- checking for module 'libusb-1.0'
--   found libusb-1.0, version 1.0.9
-- Found LIBUSB: /opt/local/lib/libusb-1.0.dylib 
-- Boost version: 1.49.0
-- Detected git snapshot version: v0.17-313-ga7c32c5
-- Building libftdi++
-- Found SWIG: /opt/local/bin/swig (found version "2.0.6")
-- Found PythonLibs: /usr/lib/libpython2.7.dylib 
-- Found PythonInterp: /opt/local/bin/python (found version "2.7.3")
-- Building python bindings via swig. Will be installed under 
/usr/local/lib/python2.7/site-packages
-- checking for module 'libconfuse'
--   package 'libconfuse' not found
-- libConfuse not found, won't build ftdi_eeprom
-- Building example programs.
-- Building libftdi++ examples.
-- Boost version: 1.49.0
-- Found the following Boost libraries:
--   unit_test_framework
-- Building unit test
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Not generating API documentation
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jboone/src/libftdi/build

> Did you use libftdi 0.x-git or 1.x-git?

I'm on the master branch, which I believe is 1.x-git.

If you have further questions, or want me to try something else, don't hesitate 
to ask.

Thanks for your help,

        - Jared


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx

Current Thread