Author Topic: Help for compiling missing libs  (Read 1169 times)

chataigne (OP)

  • Posts: 4
Help for compiling missing libs
« on: January 06, 2020, 02:24:22 pm »
Hello.
I'm a beginner developper who needs help for continue learning...

What I have :
- ubuntu machine
- installed and working gcw0 toolchain

I'm trying to compile a project who needs libraries that are not present cross-compile toolchain.
For compiling this project (who uses a Cmakelist file) I use : cmake -DCMAKE_TOOLCHAIN_FILE="/opt/gcw0-toolchain/usr/share/buildroot/toolchainfile.cmake"


What I understand is that :
- I have to cross compile those libraries
- Then I have to add them in the toolchain

So first I try to compile those libs.

For example, I have to compile Freeimage :
- I downloaded Freeimage source code (http://downloads.sourceforge.net/freeimage/FreeImage3180.zip)
- I decompress it

Then, how do I cross-compile ?

When compiled, where do I put the compiled libs in the toolchain ?

Thanks for your help

Ryvan

  • Posts: 55
Re: Help for compiling missing libs
« Reply #1 on: February 20, 2020, 03:30:47 am »
Cross-compilation refers to compiling code targeting a different system than the one the compilation is being done on. To my knowledge this is the usual way of doing development for embedded devices, handheld game consoles, etc. E.g. Android app development on an x86 system. It is also done in development for retro systems like the Apple II or C64 to leverage the power and ease of development on modern machines. 
 
Using the gcw zero toolchain to produce an application (or a library) for the GCW Zero is cross-compilation
 
I don't know the exact process myself, but as long as the library in question has no special dependencies beyond those already included in the toolchan you should be able to just cross-compile it like you would anything else as a static library.

Once you have a compiled static library then you just need to give the right parameters when you compile your program to have it bundled into the executable. Such an approach will obviously increase the size of the result program binary but it shouldn't be a problem in this case. And doing so saves you the trouble of making a shared library that than has to go onto the GCW Zero in the correct spot in the filesystem.


https://www.fabriziodini.eu/posts/cross_compile_tutorial/
^ this might be a useful overview, if not you can always use Google to search for a better explanation/tutorial.
 
 
I have no idea how to 'put the compiled libs in the toolchain' nor am I sure that you should/would want to.

P.S.
https://en.wikipedia.org/wiki/Static_library
https://elinux.org/Toolchains
« Last Edit: February 20, 2020, 03:39:25 am by Ryvan »

 

Post a new topic