Search code examples
linuxwindowscross-compilingintel-fpgasoc

Cross-compilation with libraries


I am working on Windows 7, using Eclipse DS-5, to cross-compile projects for Altera SoC (FPGA+ARM). The toolchain is supplied by Altera tools, and it looks as follows :

GCC C++ Compiler 4 [arm-linux-gnueabihf]
GCC C Compiler 4 [arm-linux-gnueabihf]
GCC Assembler 4 [arm-linux-gnueabihf]
GCC C Linker 4 [arm-linux-gnueabihf]
GCC C++ Linker 4 [arm-linux-gnueabihf]
GCC Archiver 4 [arm-linux-gnueabihf]

The Altera SoC board is running Angstrom Linux distribution on ARM.

I need to add some libraries (e.g. libcURL) and set the Eclipse project settings, to include the library in compilation.

MY UNDERSTANDING: Libraries in general contain 2 components. The headers and the library definition files (in binary format). The compiler requires the header files, The linker is then linking the library files.

(If anything above is wrong, please correct me).

MY QUESTIONS:

1) In case the binary files are not supplied for ARM processor, do I need to use Altera tools to compile the library source code on my Windows 7 machine with ARM compiler ? I believe to use the Altera supplied compiler terminal, to run ./configure, make

2) For such widely used libraries such as libcURL, there are pre-compiled binaries for different platforms. How do I know what the compiled library looks like ? What files are necessary for Eclipse to compile the whole project (please be specific : *.lib, *.a, *.h, ...)

SUMMARY: I am perplexed by cross-compilation, I am not sure, which compiler is required, and which library files are required.

Most common error I have came across is :

cannot find -lcurl

Does that mean the compiler can see *.h files, but the Linker is not able to locate binary files ?


Solution

  • Finally, I did the following :

    I have copied the library source files to my target platform (Altera De_nano_SoC ARM) and compiled the library there (Angstrom Linux, compiler arm-angstrom-linux-gnueabi). This requires setting configuration file in library folder, and running make and make install commands.

    Once compiled, I copied the output files (headers *.h and static library files *.a OR shared library files *.so - depending on compilation configuration) to my host machine (Windows 7). Then I have added the files to my Eclipse DS-5 project.

    The Eclipse requires the path of .../include folder with header files *.h and the .../lib folder including *.a or *.so files.