How to (cross)compile my own C [+GTK] source code
Being off-topic in guide-for-beginners-app-development-ubuntu-touch I create this new subject to move some posts here.
The question was : how to reuse my own software sources, developed since a long time on desktop for terminal commands and other ones with GTK ?
Is there a solution to (cross)compile, please ?
Where can the include and libraries be found ?
Thanks to @Lakotaubp for posts move
This is fine for people knowing Clickable and QT and so on, or having time and fun to learn that ...
But what about if I want to reuse my own software sources, developed since a long time for terminal commands and other ones with GTK ?
Is there a solution please ?
Is this software written by you that you want to use on your own device(s)? Or is it software that you want to publish to the OpenStore too?
The first idea is to use some own programs for my own needs on my own phone. However, once validated, it is also possible to publish the source code if it can be useful to someone.
Have a nice day
If just the source code is going to be made available, and there are no plans to publish binaries or such to the OpenStore, then a Libertine container might be a good fit for your command line tools. It might also work for your GTK tools, but that is more hit or miss.
@arubislander OK, thank you
I'll have a look to Libertine solution.
Have a nice day
Unfortunaly, Libertine is another sort of container and isn't what I'm looking for. Here are the reasons why :
I'm really paranoid and happy that UT has high confinement solution but if I need some own pieces of code, it's precisely because I want to overide these limitations, as well as I can do with Terminal. This doesn't create security breaks because it is my code and I would be the only one that knows it is there.
I would be surprised if Libertine could run desktop applications without compiling them for my phone's processor. Even if this is the case, I need true code execution, not emulation.
I use Eclipse CDT to compile and debug my (desktop) code. I'm looking for tools and files needed to compile my code for UT.
- Can I cross-compile on my desktop with Eclipse (and how) ?
- Must I compile on the phone (and how) ?
- Where are the include files and libraries (including GTK) ?
Hope someone can answer.
Thank you and have a nice day
When you can cross compile your programs you can copy them to your phone and run them.
How difficult this task will be depends largely what dependencies your programs have.
Before some time (Canonical was still working on Ubuntu Touch). I remounted the system rw and installed some programs via apt. Than they could be used in terminal like normal programs.
I do not know if apt can still be used, but with your own programs this should be a possible way. Maybe it is sufficient to have them only in your home directory.
By the way it should also be possible to build click apps with unconfined access. I never tried it my self, but I have used own build apps with extended privileges to access the sdcard in my phone.
@Pulsar33 You can use Libertine as a means to install the tools and compile your app, and then simply install your app into your home directory somewhere in the host. You can bind mount a sub-directory of the home directory, into the Libertine container.
Libertine does not emulate things. It is simply a way to get a chroot for using legacy apps and CLI tools, as the system root is readonly.
You don't necessarily need to compile on your phone. I don't know how Eclipse works for cross-compilation, but compiling in a container is better, because you can keep everything needed to build for another architecture, in a confined place, rather than mixing in with your host OS. At the most basic level to compile a
armhfarchitecture, you can install the gcc cross compiler for armhf, and then for example just run
gcc-cross-armhf helloworld.c -o helloworldto get a
helloworldbinary compiled for
armhfarch (actual gcc executable may be named differently).
The include files are the same. However, when cross-compiling, the tools should be picking up the correct values for the other architecture to compile and link. You may also need to include additional dependencies in the installation of your app, as they may not be included in Ubuntu Touch.
No sure I understand everything but I will try to analyze your proposal ... and come back.