Embed aws iot device sdk to Micropython as user C module - c

Since there's no official aws iot device sdk for micropython, I'd like to compile embed the official C SDK into micropython as a user module.
I following the guide from micropython official documentation on how to compile an external C modules into micropython.
The first method I'd like to use is initializeMqtt(). I added the include directories to the makefile (e.g.: CFLAGS_USERMOD += -I$(LIBS)/$(OPENSSL_DIR)/include/). Then I could compile it, but after I got some linker errors in connection with openssl. I cloned openssl from the official openssl Github page, and update the include directories, and started to add the missing .c files to the makefile, to compile it in. After I had the same results, and tried to found the missing references (search in openssl source), and I add the neccessary .c files, to the makefile (e.g.: SRC_USERMOD += $(LIBS)/$(OPENSSL_DIR)/crypto/cryptlib.c). Now I got more and more linking, errors like:
undefined reference to X509_VERIFY_PARAM_move_peername.
undefined reference to tls1_set_groups_list
and so on.
I use MacOS, I have installed openssl, added the must have flags to .profile.
Is it even possible achieve what I want?

Related

How add all libs src and main c files to same VS2022 project

I am tinkering with this C MXChip IoT project. This may be a supid question but hacking and navigating the code is difficult because there is no single project with all libraries and src files. Is there a way to have all main program, libs, src c and h files on the same Visual Studio project (not VSCode, I'm using VS2022)?
Most probably my tries were wrong, I tried dragging all the files into the solution of a new C project but references or variables are still unrecognized. Same result adding in solution properties->c/c++->Additional include directories/#using directories, and this latter approach doesn't show me the file to navigate and see the code.
I see the following folders with its subfolders used by the project:
app;lib;shared;
I installed dev env vcpkg following guide https://vcpkg.io/en/getting-started.html with package azure-iot-sdk-c found in https://vcpkg.io/en/packages.html. vcpkg is a MSFT supported env. And also installed Azure IoT Edge Tools for VS 2022 following guide https://learn.microsoft.com/en-us/azure/iot-edge/how-to-visual-studio-develop-module?view=iotedge-1.4 and works great !

Integrating Tapku Library to XCode 4.6 project

Its been a long since I am struggling integrating the Tapku Library in my Xcode project. I want to implement the Day View component from Tapku into my project. I followed the instructions from read-me on github but had no success. I am getting following error, "Apple Compiler LLVM Error" when I add the files to my project. Anyone who has successfully integrated the same please help.
I solved this issue by using Finder (before opening xCode) copy the src folder to my projects directory.
So my project structure is MyProject/Frameworks/src
For the rest of the steps just follow the guide on Tapku's GitHub page.
Only add the 2 TapkuLibrary.xcodeproj and src/TapkuLibrary.bundle files
Select the Build Phases
Link Binary With Libraries
For the Header Search Path you can use $(SRCROOT)/Frameworks/src remember to use non-recursive option
And for Other Linker Flags add -ObjC
Hope this helps

xcode c include files

I would like to use XCode 4 as IDE for my C program.
I am using few libraries, which are not installed in system paths. Also, I am using external program for building (waf).
So, basically, I need XCode for everything, except building.
But I can't figure out how to tell XCode where my library include files are for it to be able to autocomplete functions and everything from that libraries?
In the build settings for the Target - look for the HEADER_SEARCH_PATHS setting.
Have you added the library headers to the project? You can just add them by reference.

Compiling C code as static library for use in iPhone app?

Pardon me if this is a "noob" question, I'm overextending myself a bit with this.
I'm trying to compile a library written in C for use in an iPhone app I'm developing. I can't seem to figure out how to do this, and I've been searching and trying things for hours.
I've tried using an External Build System project, and selecting the folder where the makefile.in.am.mingw are.
I've tried creating a Static Library project and adding the header\source files to the project. Which looked good until I tried to compile and got 260k+ errors.
When I 'cd' to the directory with the makefiles and type 'make' I get:
No targets specified and no makefile found. Stop.
I have no idea how makefiles work, I just want to use the library!
Is there a simple way to do this? If someone could at least point me in the right direction, I would be quite appreciative.
The makefiles you have are for GNU automake (under MINGW by the look of it). Even if you get them working (automake can be tricky, but it is included in Mac OS X's development thankfully), it probably won't help you much in building an iPhone library.
I did this with an existing C library by creating a new framework target in Xcode with the right include settings, etc gleaned from looking at the makefiles. That created a .framework bundle with headers and an iPhone .a library ready to be used by an iPhone project. You could also just import the C source into the iPhone project, and have it compiled in that way which would probably be quicker.

How to statically link libevent with gcc while compiling?

I have used event.h in on of my project but the server it has to run on does not support it. Moreover I can not install it also. Is there a way I can run my project with minimum modifications.
It has to be compiled statically linked in but how do I do that?
What do you mean the server it has to run on does not support it? If a shared library is not installed, you can just build your project with the library statically linked in.
Alternatively, compile a shared library of libevent and include it with your application. I have had success using the RUNPATH headers in ELF binatries and shared libraries to put an application directory at the beginning of the dynamic library loading search path.
https://github.com/wavetossed/pybuild is an example of a build script for Python 2.7.2 and a couple dozen binary modules, which includes using libevent. Building just a single library using RUNPATH is much simpler.

Resources