GCC hiding standard C header files

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
WIckedWitch
Posts: 276
Joined: Thu 29 Mar 2018, 22:13
Location: West Wales bandit country

#21 Post by WIckedWitch »

rcrsn51 wrote:
WIckedWitch wrote:... but their developers do not take that as a reason to exclude them from the compiler install package.
Like I said before, stddef.h is NOT excluded from the install. It is in a subpackage that would be automatically installed by apt.

How is that different?

Even Debian tcc has extra header files in a separate package.
That's fine if, when you install gcc, it hauls in all the other packages it needs to ensure that you have a complete useable compiler after the install has finished. But with tahrpup you can install a gcc from ubuntu/main and be left without a stddef,h until you manually insert it into one of the include directories or else install devx.

The critical thing there is that the installed gcc is not complete and that to set up the repeatable environment, you have to decide the order of installation of gcc and devx and then prove repeatability by checksumming.
Sometimes I post mindfully, sometimes not mindfully, and sometimes both mindfully and not mindfully. It all depends on whether and when my mind goes walkies while I'm posting :?

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#22 Post by rcrsn51 »

WIckedWitch wrote:That's fine if, when you install gcc, it hauls in all the other packages it needs to ensure that you have a complete useable compiler after the install has finished.
That's exactly how a package management system like dpkg/apt works.
But with tahrpup you can install a gcc from ubuntu/main and be left without a stddef,h until you manually insert it into one of the include directories or else install devx.
Exactly, as explained above.

So your thread title "GCC hiding standard C header files" is disingenuous. Your particular method of installing gcc was at fault.

WIckedWitch
Posts: 276
Joined: Thu 29 Mar 2018, 22:13
Location: West Wales bandit country

#23 Post by WIckedWitch »

rcrsn51 wrote: So your thread title "GCC hiding standard C header files" is disingenuous. Your particular method of installing gcc was at fault.
But there was nothing that I saw that would have told me in advance that i needed both gcc and devx to end up with a functioning compiler. (Incidentally, it was only gcc-4.8 thst gave me the problem. gcc-4.6 installed with its own stddef.h and so didn't need devx.

Again, perhaps I should emphasise that I am talking about very high integrity testing. With all the commercial compilers I have used, the documentation explains clearly how to do the install so that you end up with a full working compiler when the install has finished. This is not the case with some versions of gcc. Installing gcc-4.6 from ubuntu/main *does* give me a complete working compiler. Installing gcc-4.8 from ubuntu/main does not.

How was I to know other than by trial and error?
Sometimes I post mindfully, sometimes not mindfully, and sometimes both mindfully and not mindfully. It all depends on whether and when my mind goes walkies while I'm posting :?

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#24 Post by rcrsn51 »

Just to be clear, a devx contains a complete C compiler.

WIckedWitch
Posts: 276
Joined: Thu 29 Mar 2018, 22:13
Location: West Wales bandit country

#25 Post by WIckedWitch »

rcrsn51 wrote:Just to be clear, a devx contains a complete C compiler.
Yes - but which complete C compiler? How could I identify it unambiguously?
Sometimes I post mindfully, sometimes not mindfully, and sometimes both mindfully and not mindfully. It all depends on whether and when my mind goes walkies while I'm posting :?

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#26 Post by rcrsn51 »

This is not the case with some versions of gcc. Installing gcc-4.6 from ubuntu/main *does* give me a complete working compiler. Installing gcc-4.8 from ubuntu/main does not.
That's true. The Ubuntu gcc-4.6 package contains stddef.h. In gcc-4.8, they split it off into a separate -dev sub-package, which would be auto-installed by the package manager.

That's why piece-meal software installation in Puppy is risky.

WIckedWitch
Posts: 276
Joined: Thu 29 Mar 2018, 22:13
Location: West Wales bandit country

#27 Post by WIckedWitch »

rcrsn51 wrote:
This is not the case with some versions of gcc. Installing gcc-4.6 from ubuntu/main *does* give me a complete working compiler. Installing gcc-4.8 from ubuntu/main does not.
That's true. The Ubuntu gcc-4.6 package contains stddef.h. In gcc-4.8, they split it off into a separate -dev sub-package.

That's why piece-meal software installation in Puppy is risky.
When I installed gcc-4.8, no such separate -dev subpackage was installed by PPM.

From the point of view of a certification-level tester, I think the best maxim is never to install from a Linux respository but to get the required gcc install package direct from the relevant GNU site.

Paradoxically, though this kind of thing is nothing but obstructive when you are setting up a high-integrity test platform, it is actually very helpful when you are developing the kinds of tests that I am currently working on. It tells me, for example, what kinds of checks I need to perform to provide an assurance of the integrity of an installed compiler before I even get to running the tests proper.
Sometimes I post mindfully, sometimes not mindfully, and sometimes both mindfully and not mindfully. It all depends on whether and when my mind goes walkies while I'm posting :?

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#28 Post by rcrsn51 »

WIckedWitch wrote:From the point of view of a certification-level tester, I think the best maxim is never to install from a Linux respository
Or do the installation on the specific platform for which the packages were built.

Tahrpup is NOT Ubuntu Trusty.
When I installed gcc-4.8, no such separate -dev subpackage was installed by PPM.
Exactly.

WIckedWitch
Posts: 276
Joined: Thu 29 Mar 2018, 22:13
Location: West Wales bandit country

#29 Post by WIckedWitch »

rcrsn51 wrote:
WIckedWitch wrote:From the point of view of a certification-level tester, I think the best maxim is never to install from a Linux respository
Or do the installation on the specific platform for which the packages were built.

Tahrpup is NOT Ubuntu Trusty.
Fair comment. I certainly wouldn't use tahrpup as a platform for high-integrity testing (although it's great for exposing you to problems that you may have to guard against).

I'm not sure that installing on the platform for which the package is built would necessarily steer me clear of all the problems that a high-integrity test platform has to guard against. On the other hand, once I've developed configuration integrity checks for gcc on tahrpup, I could certainly then go on to installing on a real ubuntu platform and see what else can go wrong there.

Thanks, anyway, for your engagement with this thread :-)

*** MODS: Possibly better to retitle this thread "gcc 4.8 missing stddef.h header" ? ***
Sometimes I post mindfully, sometimes not mindfully, and sometimes both mindfully and not mindfully. It all depends on whether and when my mind goes walkies while I'm posting :?

WIckedWitch
Posts: 276
Joined: Thu 29 Mar 2018, 22:13
Location: West Wales bandit country

#30 Post by WIckedWitch »

rcrsn51 wrote:
Tahrpup is NOT Ubuntu Trusty.
When I installed gcc-4.8, no such separate -dev subpackage was installed by PPM.
Exactly.
One last remark:
Interesting that you refer to what is essentially part of the IEEE 1003-1 standard for a definition of stddef.h. That definition in turn refers to the ANSI/ISO C language standard, which, at least in matters relating to C implementations, takes precedence over IEEE 1003-1.

Tahrpup may not be Ubuntu Trusty but neither is C POSIX, especially not when it's implemented in a cross-compiler running in a Windows environment, which is currently the case for a substantial proportion of critical embedded C applications.

Perhaps my perspective on this may seem a little narrow but I have worked in international standards for programming and formal description languages on and off for over 25 years. For matters of language definition and implementation, I always and exclusively refer to the relevant International Standard for the language. Indeed, never since 1976 have I used anything but national and international standards as my programmer's reference manuals for any language that has such a standard.

... and one last question:

What do Synaptic or apt-get do that PPM does not when it is installing packages from a ubuntu repository?
Sometimes I post mindfully, sometimes not mindfully, and sometimes both mindfully and not mindfully. It all depends on whether and when my mind goes walkies while I'm posting :?

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#31 Post by jafadmin »

C was designed to be a portable language, and as such, C compilers can be found for most architectures and Operating systems.

Examples of things that are system dependent are endianess, bytesize, integer size, and pointer size.

So while the contents of <stdio.h> will likely be the same across platforms and architectures, the content of those header files that define the hardware to the compiler will always vary.

WIckedWitch
Posts: 276
Joined: Thu 29 Mar 2018, 22:13
Location: West Wales bandit country

#32 Post by WIckedWitch »

jafadmin wrote:C was designed to be a portable language, and as such, C compilers can be found for most architectures and Operating systems.

Examples of things that are system dependent are endianess, bytesize, integer size, and pointer size.

So while the contents of <stdio.h> will likely be the same across platforms and architectures, the content of those header files that define the hardware to the compiler will always vary.
AFAI can see, after rummaging around more sets of header files than I care to recall over the years, architecture-specific adaptation of headers is readily, if not always entirely straightforwardly, effected by defining a (sometimes large) number of scalar parameters as macros and then conditionally compiling headers as chunks of code that are conditionally included according to the values of those parameters.

It is technically possible to do this without having to separate any standard headers from the compiler install package, as is routine practice in all commercially supported compilers that I have looked into. Indeed the typical practice for commercial, multi-targettable embedded C compilers, is to give a complete set of architecture-dependent standard headers for each supported target architecture - and often for different chip variants within a single architecture.

Given that there is no technical necessity for separation of standard headers from the rest of the compiler, I am at a loss to see why gcc seems to think it a good thing to do - unless as far as gcc is concerned, POSIX is the only platform they are concerned with. This, of course, makes it far harder than necessary to create verifiably repeatable installed compiler configurations, the absence of which is utter anathema in the development of critical systems.
Sometimes I post mindfully, sometimes not mindfully, and sometimes both mindfully and not mindfully. It all depends on whether and when my mind goes walkies while I'm posting :?

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#33 Post by jafadmin »

Run these two commands from a console to produce all the info about the linux gcc compiler environment:

Code: Select all

#touch a.c
#gcc -v -E a.c

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#34 Post by s243a »

Some symbolic links might help like I did here:
http://murga-linux.com/puppy/viewtopic. ... 688#992688

WIckedWitch
Posts: 276
Joined: Thu 29 Mar 2018, 22:13
Location: West Wales bandit country

#35 Post by WIckedWitch »

jafadmin wrote:Run these two commands from a console to produce all the info about the linux gcc compiler environment:

Code: Select all

#touch a.c
#gcc -v -E a.c
Thanks. This is helpful. Although it isn't acceptable for certification-level testing, it does tell me a lot about how I can design an environmental enquiry program to obtain the required configuration information by acceptable means (i.e. by running a conforming C test program that discovers what the config is rather than simply by asking gcc to say it).

I'm currently putting together a prototype system written in Tcl that will generate the required conforming C test programs. More when I've got it up and running and have played with it a bit.

###### Added 23:54 GMT+1 2018-05-22

I've got the first results from my Tcl test system and have started a new thread entitled

Determining C compiler implementation characteristics #####
Sometimes I post mindfully, sometimes not mindfully, and sometimes both mindfully and not mindfully. It all depends on whether and when my mind goes walkies while I'm posting :?

Post Reply