LibFTDI correct compiling / build [ Raspbian ] - c

INTRODUCTION
Hi everyone, I'm making a project in Raspbian (Raspberry Pi3) using the async streaming feature of the libFTDI library.I first tried to build one of their examples that scans all the ftdi devices inside the Build directory following this guide using cmake and I run perfectly ./find_all getting all the FTDI devices, and that's good.
So I wanted to build a custom libFTDI project in another directory by my own and to compile it by the only compiler tool I know: Gnu C Compiler.
PROBLEM
Well, the compiler shows me no errors when I tried to compile out of the Build directory using a code of mine which has an #include libftdi with gcc -lusb -lftdi AND ./find_all gave me back that there's no device found at all.At this point I toke exactly the same piece of code inside 'find_all.c AND ./find_all STILL gave me back that there's no device found at allObviously before I ran gcc I installed all the libFTDI dependencies via apt-get install, to be more specific:
build-essential
git-core
cmake
doxygen
libusb
libconfude-dev
swig
python-dev
libboost-all-dev
QUESTION
Can anyone help me finding out what's wrong in it?I'd really like to use this wonderful library. I state that I'm a newbie in cmake stuff therefore I guess that even if I'm making a custom project (and not an example) using libFTDI most probably I also have to cmake. I should be grateful if someone explained to me how to cmake/build/gcc this library everywhere I want.
Thanks for the attention payed.

Related

Bluetooth C compiling

I am reposting this again in case missed out.
i have installed
sudo apt-get install libbluetooth-dev
and tried to compile btgatt-client.c from Blue5.54/tools/ with
gcc -o btgatt-client btgatt-client.c -lbluetooth
but get '#include "lib/bluetooth.h":no such file or directory'
What could be missing.I have tried move the files from '/usr/include/bluetooth'
the compilation folder but seems doesn't work. I am also curious where does this "src/shared/mainloop" from?
I am able to run the example and connect to nrf app but unable to compile the .c file.
The source files in BlueZ are not designed to be compiled singularly. Instead, you are supposed to build and install the entire BlueZ source, which in turn will compile btgatt-client.c for you. Please see the link below for instructions on how to build the entire BlueZ source:-
How to rebuild bluez
You will probably find that you need to install a lot of dependencies along the way, but you can either install these using sudo apt-get install <dependency> or try and not include it in the build. For example, to build BlueZ without systemd, you can do the following:-
./configure --disable-systemd
make
I hope this helps.
#Youssif Saeed. Thanks for the replies.
The good news is i have found out the cause.It seems the BlueZ bluetooth stack has an issue running in Raspbian Buster. I have downgrade the OS to Stretch and all seems up and running.
However i am trying gatt-client example and seems like not working when i set nrf app to advertising mode with exact UUID as in example. Or maybe i missed out certain part.Going to give a try with a simpler device like ESP32.
UPDATED
Thanks again guys.DBus gatt-client able to connect to BLMCU's. They key of operation is it needs to be paired > connected and read the BLE Server

How to cross-build luajit-5.1 for an ARM Linux device? (Trying to build LÖVE framework)

I'm trying to cross-build LÖVE (https://love2d.org) for an ARM Linux device (Rockchip RK3066) from Ubuntu 16.04.
As the documentation says, I installed all dependencies on Ubuntu and was able to build it (for Ubuntu, as a test). Now I'm going for the cross-build.
Before building, I have to run ./configure. So far I've been able to get the toolchain's gcc compiler to be accepted, but when it looks for the dependencies, I get this error:
checking for luajit5.1... no
checking for luajit51... no
checking for luajit... no
configure: error: Package requirements (luajit) were not met:
No package 'luajit' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables lua_CFLAGS
and lua_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Could this be fixed by cross-building luajit for the device and add it to the toolchain binaries, or could I just try to make the ./configure script look for the luajit I installed in Ubuntu?
If it's the latter, would someone kindly point me on the right direction? I've opened like 20 pages already with a similar error message and none of them had a valid answer.
Thanks a lot in advance.

How to install packages or natively compile package on a minimal Linux kernel compiled with Buildroot

I enconter a problem I hope to be solved quickly.
I have grace to BUILDROOT compile a Linux zImage Kernel, build a rootfs, have a bootloader, so everething is right.
But at the boot, the system is so minimal that i don't have got some package manager like apt-get, yum, etc....
Despite the fact i've got the network (wget is possible), I don't know how to have a simply gcc in my host (Buildroot don't permit to compile gcc anymore)
or more simply a package manager.
It is so boring to cross compile everything that I think the better solution is to apt-get packages, resolve dependencies and install it for an ARM architecture..
I recompile with Package manager options including IPKG and OPKG but the repositories don't work and the commands return nothing (I.E. ipkg --list, etc..)
Did someone had the same problems and what is the best way to have a good Package Manager on a minimal system compiled and build grace to Buildroot.
What is the best way to have anymore a Native compile toolchain on the ARM host ?
Thanks to your answers
My purpose is to natively compile my code including -lm -lpthread and LIRC module and header files on this minimal host system.
Stefan, France
---- additional informations ---
hello,
i refresh this tag for set informations :
recently buildroot does no longer permit natively compile gcc package
even if make and other tools are available on the recent buildroot distribution
gcc and other tags are marked as deprecated
so it is needed / obligated to cross compile on the host
so what i did
for convenience, i've the Makefile for my code with dependencies
for pthread and lirc_client
If anybody interested, ask me,
stef, France
The Buildroot reference documentation has plenty of details about these questions. Please see http://buildroot.org/downloads/manual/manual.html#faq-no-compiler-on-target and http://buildroot.org/downloads/manual/manual.html#faq-no-binary-packages.
I've added dpkg inside buildroot in order to have dpkg on my board... it was really easy to do.
The only thing I had to hack is to create a fake ldconfig.

error: unknown type name 'CURL'

I wrote a C library that utilizes the libcurl library to interact with a REST API. I wrote this on a debian based system, but am now attempting to use it on an Arduino, which runs an OpenWRT distribution. When trying to use it, I noticed there was an issue when the compiler attempts to use the libcurl library, so I wrote a super simple program to test it.
#include <curl/curl.h>
void main() {
CURL *curl;
}
I then compiled it like so...
gcc -lcurl test.c -o test
and got back the following.
test.c: In function 'main':
test.c:4:2: error: unknown type name 'CURL'
libcurl was already installed on the device.
Package libcurl (7.29.0-1) installed in root is up to date.
Here's what displays when I run opkg files libcurl
Package libcurl (7.29.0-1) is installed on root and has the following files:
/usr/lib/libcurl.so.4
/usr/lib/libcurl.so.4.3.0
Having the hardest time trying to figure out what the problem is. This link was the only thing I found remotely close to being similar to my problem, but the solutions didn't work for me. Does anyone have any suggestions?
Thanks.
EDIT: So I think I found some more information about the problem. I think I'm missing a lot of the libcurl development packages as well because I looked at the opkg.conf file and saw that the only package list was the following.
http://downloads.arduino.cc/openwrtyun/1/packages
Maybe I need to find an OpenWRT package list having the extra libcurl packages I need? I can't seem to find them though.
So I was able to solve my problem, but I guess not "properly".
Apparently, the OpenWRT distribution I'm running uses a completely different libcurl library, and when I tried to uninstall it, the opkg package manager warned me that because it too also utilizes the currently installed libcurl library, it might break if I remove it.
Therefore, I manually installed the version of libcurl I needed from Github, and then made the proper references in my code to use this other version instead.
Thanks everyone for helping me get in the right direction.

How do I statically link to a lib when creating a command line program in xcode?

I'm new to OSX and XCode and I'm trying to statically link to a C app. I downloaded and installed libconfig and I link to the installed libconfig.a. It works great on my machine but when I run my binary on another machine I get an error that says libconfig.dylib can't be found. Naturally, I don't want to have to install libconfig everywhere I use my app.
I've scoured through the xcode build settings and the only reference I see is the one for libconfig.a. What am I doing wrong?
I got this to work. This seems to be a libconfig build issue, maybe expected behavior but it surprised me. I was linking to libconfig.a, but it appears that libconfig.a was linking to libconfig.dylib. I reconfigure libconfig and reinstalled it.
./configure --disable-shared
make clean
make
make install

Resources