MVoz / libmpsse

Automatically exported from code.google.com/p/libmpsse
0 stars 0 forks source link

FIXED Apple OS X library compilation and installation with libftdi1 from MacPorts #49

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. "./configure" fails

This problem is related to my previous response on another issue:
https://code.google.com/p/libmpsse/issues/detail?id=32#c2

For Mac OS X + MacPorts, it seems that there is an easier way to globally 
enable (custom) builds to use the "/opt/local" in the search path of compiler.

edit your environment settings (eg. "/etc/profile") and append:
export LDFLAGS="-L/opt/local/lib"
export CFLAGS="-I/opt/local/include"
export CPPFLAGS="-I/opt/local/include"

Remember to (re)open a new terminal for the changes to take effect and then it 
works just fine to execute the default configure:
------------------------------------------
$ ./configure
------------------------------------------

Although it actually might make sense to update the install path for libmpsse 
accordingly:
------------------------------------------
$ ./configure --prefix=/opt/local/
------------------------------------------

Next, to be able to run "make install" in OS X, the "-D" option should not 
present in the Makefile. So replace all "install -D ..." to "install ..." and 
you can install it without a problem.
------------------------------------------
$ sudo make install
------------------------------------------
I'm not sure if the "-D" option is necessary for other unix systems like 
linux/bsd, otherwise it might be a suggestion to just remove this directive 
from the "Makefile.in" in the current repository.

Last issue I ran into is compiling the examples afterwards.
The Makefile in the "libmpsse/src/examples" directory currently does not work 
with globally defined compile and linker flags.
------------------------------------------
$ cd libmpsse/src/examples
$ make
------------------------------------------
cc -I/opt/local/include spiflash.c -o spiflash -lmpsse
ld: library not found for -lmpsse
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spiflash] Error 1
------------------------------------------

However, when we patch the first line of "libmpsse/src/examples/Makefile":
"LDFLAGS=-lmpsse" -> "LDFLAGS+=-lmpsse"
Then it works just fine!
------------------------------------------
$ cd libmpsse/src/examples
$ make
------------------------------------------
cc -I/opt/local/include spiflash.c -o spiflash -L/opt/local/lib -lmpsse
cc -I/opt/local/include spiflashfast.c -o spiflashfast -L/opt/local/lib -lmpsse
cc -I/opt/local/include i2ceeprom.c -o i2ceeprom -L/opt/local/lib -lmpsse
cc -I/opt/local/include ds1305.c -o ds1305 -L/opt/local/lib -lmpsse
cc -I/opt/local/include gpio.c -o gpio -L/opt/local/lib -lmpsse
cc -I/opt/local/include bitbang.c -o bitbang -L/opt/local/lib -lmpsse
------------------------------------------
Also this patch might be useful to actually embed into the repository.

Original issue reported on code.google.com by verdult on 19 Aug 2014 at 8:28