l29ah / libmpsse

(a maintenance fork of the) Open source library for SPI/I2C control via FTDI chips

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

building issues (not respecting PYDEV -> defaulting to Python 2.7, libftdi.h not found)

NeoFromMatrix opened this issue · comments

I'm running Fedora 30 and currently face two isses when building libmpsse.

It appears that the PYDEV variable is not respected. I have python2-devel and python3-devel installed. I want to build with python3, therefore I set my include dir; PYDEV=/usr/include/python3.7m/

But when running ./configure it always takes python/python2

checking for python... /usr/bin/python
checking for python version... 2.7
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.7/site-packages
checking for python extension module directory... ${exec_prefix}/lib64/python2.7/site-packages
checking for python2.7-config... /usr/bin/python2.7-config
checking Python include flags... -I/usr/include/python2.7 -I/usr/include/python2.7
checking Python libs flags... -lpython2.7 -lpthread -ldl -lutil -lm

Second issue: while compiling with make, it fails to find ftdi.h (of course, libftdi and libftdi-devel is installed)
libftdi.h is in /usr/include/libftdi1/ present

If I add the full path to the header file to the Makefile after calling ./configure (line 163, to variable DEFAULT_INCLUDES) the build is successful. Otherwise I will get an error:

In file included from mpsse_wrap_python.c:3028:
mpsse.h:9:10: fatal error: ftdi.h: No such file or directory
9 | #include <ftdi.h>
| ^~~~~~~~
compilation terminated.

Any idea what the reasons could be?

Version numbers of the installed packages:
autoconf.noarch 2.69-31.fc30
automake.noarch 1.16.1-13.fc30
libtool.x86_64 2.4.6-29.fc30
libtool-ltdl.i686 2.4.6-29.fc30
libtool-ltdl.x86_64 2.4.6-29.fc30
swig.x86_64 3.0.12-24.fc30
python2-devel.x86_64 2.7.17-1.fc30
python3-devel.x86_64 3.7.5-1.fc30
libftdi.x86_64 1.3-16.fc30
libftdi-devel.x86_64 1.3-16.fc30

The $PYDEV thing is obsolete and should be removed from the docs it seems. Does $PYTHON supplied as mentioned in ./configure --help work for you?

Yes, it worked. I can either set it in one command or export it first then use it in the same session with configure. Thanks!

$ PYTHON=/usr/bin/python3 ./configure
or

$ export PYTHON=/usr/bin/python3
$ ./configure

I played around and the second problem might be an issue with the define HAVE_LIBFTDI1
What I got so far:

in mpsse.h there is following preprocessor statement:

#if HAVE_LIBFTDI1 == 1
#include <libftdi1/ftdi.h>
#else
#include <ftdi.h>         
#endif

I modified it to:

#if HAVE_LIBFTDI1 == 1
#include <libftdi1/ftdi.h>
#else
#include <libftdi1/ftdi.h>
#warning "### CALLING WITH WRONG FTDI INCLUDE ###"        
#endif  

Now it compiles without errors as ftdi.h is present in /usr/include/libftdi1 and not /usr/include.

But it seems it tries to call with HAVE_LIBFTDI1 != 1 two times, see the attached make output (maybe from swig?)

make_out.txt

Hey @maksymko check this out!

libftdi include issue should be addressed by #15
@NeoFromMatrix, can you please check my branch (the Pull Request) from here https://github.com/maksymko/libmpsse/tree/fix_libftdi_dep and see if it truly fixes this?

Yes, compiles with the stated branch, no further problems were noticed.

Did not perform any further tests as I didn't know what to test for. I also did not further investigate the pull request, just used your branch. Just for completeness.

Thanks for your help!
I'm leaving this issue open/up to someone else to close (either now or when #15 or equivalent is merged).

@NeoFromMatrix , Thanks! I meant to ask to test the build, i.e. if it builds, so that's enough, thank you.