Page 1 of 1

libftdi problem

PostPosted: Aug 28th, '15, 17:55
by milan
I am trying to compile simple test program using libftdi driver for FTDI chips, but unsuccessfuly.
Part of code:
Code: Select all
/* hello-ftdi.c: flash LED connected between CTS and GND.
   This example uses the libftdi API.
   Minimal error checking; written for brevity, not durability. */
#include <stdio.h>
#include <ftdi.h>
#define LED 0x08  /* CTS (brown wire on FTDI cable) */
int main()
{........

Command and its failure:
Code: Select all
milan ~/CCPP $ gcc ftdi.c -o helloftdi
ftdi.c:6:18: fatal error: ftdi.h: File or directory does not exist
 #include <ftdi.h>
                  ^
compilation terminated.

And now little bit mismatch (for me)
Code: Select all
milan ~/CCPP $ urpmq libftdi1
Package with name libftdi1 does not exists
milan ~/CCPP $ urpmq libftdi1_2
libftdi1_2

ftdi.h located in /usr/include/libftdi1

mga5 specfile:
Code: Select all
%define api 1
%define major 2
%define libname %mklibname ftdi %{api} %{major}


1.Why must be there major2?
2.What is the solution for my program?

Thank You for answers, Milan

Re: libftdi problem

PostPosted: Aug 29th, '15, 20:13
by doktor5000
milan wrote:Command and its failure:
Code: Select all
milan ~/CCPP $ gcc ftdi.c -o helloftdi
ftdi.c:6:18: fatal error: ftdi.h: File or directory does not exist
 #include <ftdi.h>
                  ^
compilation terminated.


You're missing the package which includes the header ftdi.h, so search for that file:

Code: Select all
[doktor5000@Mageia5]─[20:06:49]─[~] urpmf ftdi.h                                                                                                                                                                 
lib64ftdi1-devel:/usr/include/libftdi1/ftdi.h
lib64ftdi1-devel:/usr/include/libftdi1/ftdi.hpp
lib64ftdi1-devel:/usr/share/doc/lib64ftdi1-devel/html/group__libftdi.html
lib64ftdi1-devel:/usr/share/doc/lib64ftdi1-devel/html/namespaceFtdi.html
lib64ftdi1-devel:/usr/share/man/man3/ftdi.h.3.xz
lib64ftdi1-devel:/usr/share/man/man3/ftdi.hpp.3.xz
libftdi1-devel:/usr/include/libftdi1/ftdi.h
libftdi1-devel:/usr/include/libftdi1/ftdi.hpp
libftdi1-devel:/usr/share/doc/libftdi1-devel/html/group__libftdi.html
libftdi1-devel:/usr/share/doc/libftdi1-devel/html/namespaceFtdi.html
libftdi1-devel:/usr/share/man/man3/ftdi.h.3.xz
libftdi1-devel:/usr/share/man/man3/ftdi.hpp.3.xz


milan wrote:And now little bit mismatch (for me)
Code: Select all
milan ~/CCPP $ urpmq libftdi1
Package with name libftdi1 does not exists
milan ~/CCPP $ urpmq libftdi1_2
libftdi1_2

ftdi.h located in /usr/include/libftdi1

What mismatch in particular?

milan wrote:mga5 specfile:
Code: Select all
%define api 1
%define major 2
%define libname %mklibname ftdi %{api} %{major}


1.Why must be there major2?
2.What is the solution for my program?

1. because the SONAME of that library has 2 as the major version.
Code: Select all
[doktor5000@Mageia5]─[20:11:01]─[~] objdump -ap /usr/lib64/libftdi1.so.2 | grep -i soname
  SONAME               libftdi1.so.2

2. install the package with the missing header file and compile again.

Re: libftdi problem

PostPosted: Aug 30th, '15, 07:21
by milan
1. Thank You for explaining, I didn´t know this.
2. libftdi1-devel was installed

Re: libftdi problem

PostPosted: Aug 30th, '15, 17:33
by doktor5000
Please mark the thread accordingly by editing the topic of the first post and prefix it by [SOLVED], thanks

Re: libftdi problem

PostPosted: Aug 30th, '15, 18:36
by milan
Very sorry for this misunderstanding.
It was meant so that libftdi-devel was installed before compilation, so the problem persists.
The same problem I have with Pclos via Virtualbox, so I will try to find out any other solution.
Thank You