LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Determining GCC, binutils and libc version compatibility (https://www.linuxquestions.org/questions/linux-software-2/determining-gcc-binutils-and-libc-version-compatibility-799876/)

dar_beh_dar 04-04-2010 12:08 AM

Determining GCC, binutils and libc version compatibility
 
Hi everyone,

this questions pertains mainly to building a brandnew GNU toolchain on one machine for deployment on fs of another machine that has no toolchain installed.

I understand the machine on which GNU toolchain is going to be built as the 'build' machine.

I understand the machine on which GNU toolchain is going to be deployed as the 'host' machine.

I understand the machine on which the code generated by the new GNU toolchain is going to be run as the 'target' machine.

Q1.) Is there a fixed 'rule', 'matrix' or 'table' somewhere which
tells me exactly which versions of 'binutils' and 'libc' are
required by a particular version of GCC? I.e. something along the
lines of:

- gcc ver.'k' can be built using gcc ver.'m'(or later)
with binutils ver.'i' and libc ver. 'j'
- gcc ver.'k' will operate with binutils ver.'t' and libc
ver.'r'(or later)

Is there some 'rule of thumb' / 'heuristics' giving me the above
version requirements for the building and operating GCC, or is this
information somehow implied or derived systematically. Where can I
find more about the above?


Q2) I assume that the libraries have no dependencies on any
underlying software other than the system calls provided by the
kernel. Furthermore it appears that the libraries are not too
sensitive about the kernel version they run on ( I found this out
from experience ). Therefore I could build the libraries on some
build machine and place them on the bare naked newly set up host
file system without regard to any other prerequisite SW
components?

Q3) During operation, do GCC and its various components place system
calls directly to the kernel or via library calls (or both)? In
other words I am trying to understand conceptually if GCC requires
'Glibc' for its own operation or not?

Q4) During operation, do the 'binutils' components place system calls
directly to the kernel or via library calls (or both)? In other
words I am trying to understand conceptually if the 'binutils'
require 'Glibc' for their operation or not?

( Of course it is clear to me that when GCC is operating it will need
libraries and headers to resolve object references in the target code
it produces, but that would be a >different< question )

I appreciate your feedback

Regards

dar_beh_dar

bcwagne 04-04-2010 12:16 AM

I'm afraid I can't answer your questions, but reading up at linuxfromscratch.org may help. Good luck!

knudfl 04-04-2010 03:15 AM

May be tell, which Linux you intend to use for
building a tool chain. Often it is easier to set
up a copy of the destination OS on a spare partition,
or a spare HD.
And please tell, what is the destination Linux.

Q3 - Q4 : The kernel is mainly about hardware.
http://en.wikipedia.org/wiki/Kernel_%28computing%29
.....
.....

ls /lib/libdl*
.. and others will show the glibc version.

ls /usr/lib/libbfd*
..or libopcodes* .. will usually id the binutils version.

cat /proc/version
may tell the kernel version and id the used compiler ( gcc ).
.....

dar_beh_dar 04-04-2010 09:53 PM

Thanks to the members who have supplied responses so far.

My question does not pertain to a particular HW or configuration.

I am after a general conceptual answer to the following question:

* Given a brandnew LINUX filessystem, what applications ( apart from the shell ) need to be present or installed >before< you can install the GNU toolchain?

The libraries seem to have no dependencies on anything else. In practice I have managed to install a given library version on several different versions of the kernel. So the kernel version determines the libc version somewhat loosely.

* Within the GNU toolchain it is interesting to know if the binutils components need libraries to function? Stupid but important conceptual question.

* Same for the compiler collection ( GCC ). Do any of its components rely on underlying libc services? Or do they invoke kernel services directly?

* Finally: How does one determine which version of gcc goes with which version of binutils and which version of libc? Is there a specific relationship/rule which dictates which versions of gcc, binutlis and libc work together or is the selection of version numbers for the gcc, binutlis and libc toolchain components based on experience / trial & error or even some heuristics or rule of thumb?

I have my own thoughts on this. However coming out in the forum with this question serves as sort of a consultation with other forum members to see what other ( perhaps more experienced and knowledgeable ) LINUX community members think.

Thanks again for the answers supplied so far.

knudfl 04-05-2010 04:26 AM

See LFS for build instructions, ref. post # 2.
http://archive.linuxfromscratch.org/lfs-museum/

Requirements to build a tool chain, etc. :
LFS, Minimum ""Host System Requirements""
http://archive.linuxfromscratch.org/.../hostreqs.html
I.e. all twenty "packages".

Most questions will be answered by reading the LFS books :
Which version is required for which version, etc. etc.

And better read about what a kernel is and does.
Objects that are build with gcc will depend on the version
of glibc ( or a later version ) used at build time.


Unless you understand it all in depth, you will not
be able to build a tool chain for another Linux.
The recommended way is to build LFS ( a couple of times ).
And then later move on to CLFS, Cross Linux From Scratch.
To find out, how all things are connected.
.....

dar_beh_dar 04-05-2010 11:14 PM

Hi knudfl,

thanks for your feedback. I think your reference to the LFS project helped to answer my question.

There does not seem to be a 'rule' for matching up verions of the GNU toolchain components. It is simply heuristics. Good.

However the PDF book for each of the LFS versions has two sections:

* Host System Requirements
* All Packages

If one looks up the PDF books from all of the LFS versions, one should be able to compile a matrix of what GCC, binutlis and libc versions go together.

That could serve as starting point.


However one of my questions remains unanswered still...perhaps because it was not suitably formulated.

I am still intrigued to know:

i) whether the 'binutils' components actually need to use the system C libraries or if they actually place system calls directly ( that would determine which headers to use in order to build them, amongst other things ).

ii) whether the 'gcc' components actually need to use the system C libraries or if they actually place system calls directly ( that would determine which headers to use in order to build it amongst other things ).

Thanks again for your tip though


Regards

dar_beh_dar


All times are GMT -5. The time now is 08:51 PM.