I'm pretty much a C newbie, and am trying to learn how to compile an x86 application so it can run on an MMU-less CPU.
The toolchain uses "ar" and "ranlib", which Google tells me are used to build a library, but this article shows that gcc itself can compile a library:
Quote
gcc -c -g util.c
The -c causes the compiler to produce an object file for the library. The object file contains the library's machine code. It cannot be executed until it is linked to a program file that contains a main function. The machine code resides in a separate file named util.o.
To compile the main program, type the following:
gcc -c -g main.c
This line creates a file named main.o that contains the machine code for the main program. To create the final executable that contains the machine code for the entire program, link the two object files by typing the following:
The -c causes the compiler to produce an object file for the library. The object file contains the library's machine code. It cannot be executed until it is linked to a program file that contains a main function. The machine code resides in a separate file named util.o.
To compile the main program, type the following:
gcc -c -g main.c
This line creates a file named main.o that contains the machine code for the main program. To create the final executable that contains the machine code for the entire program, link the two object files by typing the following:
So, when are ar/ranlib needed?
Thank you.

New Topic/Question
Reply




MultiQuote




|