Cross-compiling ALSA-lib for Raspberry PI on eclipse windows PC - c++

I want to cross-compile alsa-lib for raspberry pi using eclipse on windows pc. I am using Sysgcc toolchain for windows used for cross-compiling on Raspberry PI.
I downloaded the alsa-lib library package from
"https://www.alsa-project.org/main/index.php/Download"
and copied it to my 'src' folder. I also added paths to this library as follows.
1) "Project-> Properties-> C/C++ Build-> Settings-> Cross GCC Compiler -> Includes"
and added the library path "C:\Users..\workspace\wavfileplay\src\alsa-lib-1.1.4.1"
2) "Project-> Properties-> C/C++ Build-> Settings-> Cross G++ Compiler -> Includes"
and added the library path "C:\Users..\workspace\wavfileplay\src\alsa-lib-1.1.4.1"
3) "Project-> Properties-> C/C++ Build-> Settings-> Cross G++ Linker -> Libraries"
and added "asound" in Libraries(-l) and gave the library search path for 'libasound.so' as "C:\Users..\workspace\wavfileplay\src".
But I am unable to compile the code. I removed several errors like not finding the header files by giving it the right path in different files. But now I am facing another error
expected ')' before '__SYMBOL_PREFIX' local.h
I didn't change the local.h file as it is part of the alsa-lib library. I alsa checked the brackets and they are fine.
First, is it possible to cross-compile alsa-lib for Raspberry PI on Windows using Eclipse?
If yes, then any ideas on how to remove this error?
Thanks alot

Related

Eclipse Environment setup using Protocol Buffers (Protobuf)

Jetson Nano - Jetpack 4.5.1
G++ Version - 4.8
Protobuf Version - 3.0
I've been messing with a gstreamer framework and creating a custom plugin for it, and essentially I want to make a managing process as a gstreamer plugin to communicate to an SDK compiled through Eclipse. It's not my software and therefore I stick to following the environment setup and using eclipse to compile the executable.
I've added a single file where I am trying to extract data from the SDK, in the SDK, and want to use protobufs and zmq as the inter-process communication.
How I was able to get ZMQ to compile in Eclipse was by apt installing libczmq on the Jetson Nano and scp'd the .so binaries over to our host machine (amd64 architecture, I understand this was a workaround but I couldn't figure out how to cross compile it). The binaries are stored in a directory on the host machine and the paths are individually being added to the Eclipse Project Properties -> C/C++ Build -> Settings -> Tool Settings -> Cross G++ Linker -> Miscellaneous -> Other objects, since they are not in a normal .so format for Eclipse.
This solved all the ZeroMQ issues.
Protobuf has been a real issue. The best attempt was using a plugin called protobuf-dt which adds a menu to Eclipse for configuration to automatically generate the .pb.h and .pb.cc file from the given .proto file. The problem, I think, is it generates the files only using the connection to a descriptor.proto which is a location passed to the plugin as shown in the image below. Under /usr/include/google/protobuf/ there are multiple .proto files, not just the descriptor.proto, and we believe these are the missing connections that are causing undefined references to typeinfo for google::protobuf::Message or google::protobuf::internal::empty_string_ errors when invoking the G++ Linker.
I also tried manually adding the include path of where the google protobuf header/.proto files to the Project Properties -> C/C++ Build -> Settings -> Tool Settings -> Cross G++ Compiler -> Includes path. The last thing we tried was giving the Cross G++ Compiler the defined symbol of -D_GLIBCXX_USE_CXX11_ABI=0 for resolving C++11 ABI issues but that didn't seem to be the problem.
Any help on how to get protobuf to work with Eclipse for cross-compilation would be greatly appreciated.

Specify external library for linux from Visual Studio 2017

I'm developing linux(ubuntu) c++ project from Visual Studio 2017. I want to integrate googletest into my code. I have installed googletest and run test example according following tutorial. Everything works fine when I run it from bash terminal using cmake.
Now I need to run it using VS. For that I need to specify path to /usr/lib/libgtest.a from VS. I added /usr/lib into Linker->General->Additional Library Directories and added libgtest.a into Linker->Input->Additional Dependencies. But compiler still cannot link the library:
g++: error: libgtest.a: No such file or directory
Try omit "lib" and ".a" from the file name as these portions of the filename seem to be added by the linker itself. In your case you would reference "gtest".
Try Configuration Properties -> Linker->Input->Library Dependencies with "gtest". Note: libgtest.a must in standard location so linker can search.

Linking bluetooth library bluez in eclipse

I want to compile and run the following bluetooth scan code bluetooth scan code on eclipse neon.
I need to run it on Raspberry pi 3, so I did the following:
1- I downloaded the latest bluez version 5.43 from bluez
2- I compiled the downloaded file on my pi following the steps mentioned at Adafruit
3- I copied the compiled folder "bluez-5.43" from my Pi to the Pc to use it with eclipse. I am developing using Sysgcc cross compiling toolchain Cross Compiling on windows using SyssGcc toolchain
4- I prepared the eclipse after installing the SyssGcc toolchain using the steps on Setting Up Cross-Compilation In Eclipse
5- I created a c++ project and copied the main code of the bluetooth mentioned in the first URL and went to:
Project > Properties > C/C++ Build > Settings > GCC C++ Compiler > Includes
In Include paths (-l) i add: .....\bluez-5.43\lib\
On eclipse
Project > Properties > C/C++ Build > Settings > GCC C++ Linker > Libraries
In libraries (-l) i add: bluetooth
In Library search path (-L) i add: ....bluez-5.43\lib.libs
but when I compile I get the following error, any help please for some one knows how to compile the code using eclipse and the cross compiling toolchain ??
10:17:08 **** Incremental Build of configuration Debug for project Bluetooth_test ****
make all
'Building target: Bluetooth_test'
'Invoking: Cross GCC Linker'
arm-linux-gnueabihf-gcc -L"C:\Users\aawad\Desktop\bluez-5.43\lib\.libs" -o "Bluetooth_test" ./src/Bluetooth_test.o -lbluetooth
c:/sysgcc/raspberry/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -lbluetooth
collect2.exe: error: ld returned 1 exit status
make: *** [Bluetooth_test] Error 1
10:17:11 Build Finished (took 3s.57ms)
the above did not suffice for me, to understand what I was missing I configured bluez with
--disable-silent-rules (enables seeing compilation full commands)
--enable-testing (so I can see a code similar to what I needed)
then I run make VERBOSE=1 to see all needed linking:
lib/libbluetooth-internal.la
src/libshared-glib.la
-lglib-2.0
After several trials I was able to solve this error and the steps I mentioned above in the question are considered to be general preparation for some one wants to develop C using the Bluez Bluetooth protocol stack.
What worked out for me was:
Add the headers in the eclipse includes to make the CDT indexers know where the files are located
Project > Properties > C/C++ Build > Settings > GCC C++ Compiler > Includes
In Include paths (-l) i add: "C:\Users\aawad\Desktop\bluez-5.43\lib"
In the linking section:
On eclipse Project > Properties > C/C++ Build > Settings > GCC C++ Linker > Libraries
In libraries (-l) i add: bluetooth-internal
In Library search path (-L) i add: "C:\Users\aawad\Desktop\bluez-5.43\lib.libs"
compile and run the final executable on the Pi.. Turn your phone bluetooth and make it visible . You will find that the Pi can read your phone on the screen.

Libxml2 for c++ project configuration issue windows

I am using eclipse Version: Luna Release (4.4.0), MingW 32 bit compiler, window 64 bits along with libxml2-2.7.8.win32. I successfully compiled and build the project with no error but while i tried to run there is no output nor any error message.
I have specified path of 'lib' folder of libxml2 in eclipse as project-> Properties -> c/c++ build -> setting -> toolsetting -> mingW c++ linker -> libraries (-l) and Library search path (-L). In library i have used full name "libxml2" and search path i have placed "${workspace_loc:/${ProjName}/libxml2-2.7.8.win32/lib}"
there is a dll file "libxml2.dll" in the bin folder and have doubt whether i should place it some where or set reference path somewhere.
or should i use any c++ wrapper to execute the libxml2

OpenCV Install problems windows

I want to install OpenCV 2.4.6 On Code::blocks
I already linked the files in the compiler settings
C:\OpenCV\cv\include
C:\OpenCV\cvaux\include
C:\OpenCV\cxcore\include
C:\OpenCV\otherlibs\highgui
C:\OpenCV\otherlibs\cvcam\include
and Linker
C:OpenCV\lib
but it doesn't work
there's no more cvaux or cxcore or cvcam.
that part comes from another millenium
use: c:/opencv/build/include for the includes,
and the mingw folder for the linker ( there's an additional x64 / x86 hurdle built in, can't remember, but you'll manage! )