| Deutsch English Français Italiano |
|
<vi08u5$av3b$1@paganini.bofh.team> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.nobody.at!2.eu.feeder.erje.net!feeder.erje.net!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
From: antispam@fricas.org (Waldek Hebisch)
Newsgroups: comp.lang.c
Subject: Re: else ladders practice
Date: Sun, 24 Nov 2024 22:21:59 -0000 (UTC)
Organization: To protect and to server
Message-ID: <vi08u5$av3b$1@paganini.bofh.team>
References: <3deb64c5b0ee344acd9fbaea1002baf7302c1e8f@i2pn2.org> <vhje8l$2412p$1@dont-email.me> <WGl%O.42744$LlWc.33050@fx42.iad> <vhkr9e$4bje$1@dont-email.me> <vhptmn$3mlgf$1@paganini.bofh.team> <vhq6b4$17hkq$1@dont-email.me> <vhqm3l$3ntp7$1@paganini.bofh.team> <vhso61$1o2of$1@dont-email.me> <vhtrns$71ic$1@paganini.bofh.team> <vhtvvc$1ukc7$1@dont-email.me> <vhuc2j$7s5i$1@paganini.bofh.team> <vhv5m4$27sco$1@dont-email.me> <87wmgsmme0.fsf@nosuchdomain.example.com> <vi03n5$2c7jl$1@dont-email.me>
Injection-Date: Sun, 24 Nov 2024 22:21:59 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="359531"; posting-host="WwiNTD3IIceGeoS5hCc4+A.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A";
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
X-Notice: Filtered by postfilter v. 0.9.3
Bytes: 6205
Lines: 113
Bart <bc@freeuk.com> wrote:
> On 24/11/2024 20:01, Keith Thompson wrote:
>> Bart <bc@freeuk.com> writes:
>> [...]
>>> Most of a gcc installation is hundreds of header and archive (.a)
>>> files for various libraries. There might be 32-bit and 64-bit
>>> versions. I understand that. But it also makes it hard to isolate the
>>> core compiler.
>> [...]
>>
>> That doesn't agree with my observations.
>>
>> Of course most of the headers and libraries are not part of gcc itself.
>> As usual, you refer to the entire implementation as "gcc".
>>
>> I've built gcc 14.2.0 and glibc 2.40 from source on Ubuntu 22.04.5,
>> installing each into a new directory.
>>
>> The gcc installation is about 5.6 GB, reduced to about 1.9 GB if I strip
>> the executables.
>
> That's even huger than mine! So, that are those 3.7GB full of? What does
> the 1.9GB of executables do?
The 3.7GB is debug info which Keith removed. gcc is now written in
C++ and when you compile with debug info on about 90% of executable
is debug info.
>> Of course there are other libraries that can be used with gcc, and they
>> could take a lot of space -- but they're not part of gcc.
>
> So, what /is/ gcc? What's the minimum installation that can compile
> hello.c to hello.s for example?
>
> I've done that experiment on my TDM version, and the answer appears to
> be about 40MB in this directory structure:
>
> Directory of c:\tdm\bin
> 24/07/2024 10:21 1,926,670 gcc.exe
> 24/07/2024 10:21 2,279,503 libisl-23.dll
> 24/07/2024 10:22 164,512 libmpc-3.dll
> 24/07/2024 10:22 702,852 libmpfr-6.dll
>
> Directory of c:\tdm\libexec\gcc\x86_64-w64-mingw32\14.1.0
> 24/07/2024 10:24 34,224,654 cc1.exe
That is reasonably good apporximation to the compiler proper.
More preciesly, to compile you need 'cc1.exe' and libraries
it uses. On Linux I get:
ldd /sklad0/p0/kompi/gcc_pp/usr_14.2.0/libexec/gcc/x86_64-pc-linux-gnu/14.2.0/cc1
linux-vdso.so.1 (0x00007ffc8a8f2000)
libmpc.so.3 => /lib/x86_64-linux-gnu/libmpc.so.3 (0x00007fa55e071000)
libmpfr.so.6 => /lib/x86_64-linux-gnu/libmpfr.so.6 (0x00007fa55dfb7000)
libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007fa55df36000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa55de57000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa55dc76000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa55e0a9000)
This is list of libraries needed by 'cc1'. /lib64/ld-linux-x86-64.so.2,
libc.so.6 and libm.so.6 are system libraries needed by almost all
things. linux-vdso.so.1 is virtual thing, IIUC there is nothing
corresponding on the disc.
> Directory of c:\tdm\x86_64-w64-mingw32\include
> 17/01/2021 17:33 368 stddef.h
> 27/03/2021 20:07 2,924 stdio.h
>
> 7 File(s) 39,301,483 bytes
>
> Here I cheated a little and used the minimum std headers from my
> compiler, otherwise I could have spent an hour chasing down dozens of
> obscure nested headers that gcc's stdio.h likes to make use of.
Yes, beside compiler propor you also need headers used by the C
file.
> Is /this/ gcc then? Will you agree that it is by no means clear what
> 'gcc' includes, or what to call the part of a gcc installed bundle that
> is not technically gcc?
>
> A more useful installation would of course need more standard headers,
> an assembler, linker, and whatever .a files are needed to provide the
> standard library.
Debian splits gcc into several package. One of them is 'cpp-12'
and this one gives you 'cc1' (that is compiler proper). There
is 'gcc-12' which actually mainly provides extra features like
lto (link time optimization), sanitizers. It also provides
things like 'collect2' (wrapper around linker to have extra
features) and 'x86_64-linux-gnu-gcc-ar-12' (I do not know why
this is needed). 'gcc-12' pulls several dependencies:
cpp-12, gcc-12-base, libcc1-0, binutils, libgcc-12-dev,
libc6, libgcc-s1, libgmp10, libisl23, libmpc3, libmpfr6,
libstdc++6, libzstd1, zlib1g
binutils gives you assembler and linker, libgcc-s1 is shared
support library (needed to run dynamically linked programs),
libgcc-12-dev contains startup files (needed to link any program)
and bunch of libraries and headers supporting extra features,
libgmp10, libmpc3, libmpfr6 (and of course libc6) are needed
to run compiler. I am not sure about libisl23, libstdc++6,
libzstd1, zlib1g.
To get standard header files you need to install 'libc6-dev'.
> With clang, it is easier: apparently everything needed to do the above,
> other than header files, is contained with a 120MB executable clang.exe.
Probably you means things needed to run the compiler. clang compiled
executable need libraries too, on Debian this is shared with gcc.
--
Waldek Hebisch