GCC On IRIX -- a lot of stuff I'm learning about this
#71
RE: GCC On IRIX -- a lot of stuff I'm learning about this
https://pastebin.com/dUrTrP3x

GCC libgo dies around here.

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,240
Threads: 533
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
12-24-2024, 09:50 PM
#72
RE: GCC On IRIX -- a lot of stuff I'm learning about this
Well I've said it a million times, but I don't understand why anyone would want to use GCC on an SGI. And again, to reiterate, Mipspro 7.4.4 is available, with a working license, on my website, smigt.org/m65 - enjoy!

Project: Temporarily lost at sea
Plan: World domination! Or something...
vishnu
Tezro, Octane2, 2 x Onyx4

Trade Count: (0)
Posts: 1,245
Threads: 41
Joined: Dec 2017
Location: Minneapolis, Minnesota USA
Find Reply
12-25-2024, 09:13 PM
#73
RE: GCC On IRIX -- a lot of stuff I'm learning about this
(12-25-2024, 09:13 PM)vishnu Wrote:  Well I've said it a million times, but I don't understand why anyone would want to use GCC on an SGI. And again, to reiterate, Mipspro 7.4.4 is available, with a working license, on my website, smigt.org/m65 - enjoy!

Well not getting into a compiler war here, not about what's better. But GCC supports more languages than MIPS Pro does.  If you're doing "classic" and 1999-style C/C++ work...I agree.  If you're working in another language well what are my options?  SGI did put compilers out for a few other languages but, just like C++, those languages have evolved and some of them in very significant ways!  Some later revisions added much needed features and even syntax changes. Making older revision compilers essentially no longer fit for their purpose for code written after a certain period of time.  

If you were trying to target older platforms you could definitely try to avoid using all these new incredibly handy language features and write in an older style to be more broadly compatible. But I don't know anyone, unless you're being paid a good salary, who would willingly restrict themselves against a featureset that they know to be incredibly useful.

Modern GCC provides that and if you want to run newer libraries you're often going to run up against it, and it's going to happen more and more with the passage of time.

So while I would agree that it's great to maximize the OEM compiler as much as possible, the freedom to compile in later language revisions of other languages not released before the death of SGI is incredibly important if you want to keep porting software backwards to the old operating system in the foreseeable future.

Otherwise it becomes an uphill battle that keeps getting steeper with time to keep a relatively recent repository of open source software available for this platform unless it's written in a classic sea style that is meant to be timeless like a core UNIX utility being updated for the past several decades.
(This post was last modified: 12-26-2024, 01:22 AM by weblacky.)
weblacky
I play an SGI Doctor, on daytime TV.

Trade Count: (10)
Posts: 1,716
Threads: 88
Joined: Jan 2019
Location: Seattle, WA
Find Reply
12-26-2024, 01:22 AM
#74
RE: GCC On IRIX -- a lot of stuff I'm learning about this
Moreorless what Weblacky said. My patches incorporate all the major fixes that are necessary for later GCC usage. I generally don't mind hacking in C code to make it work for IRIX (especially because C11/C20 is really rare for what we have been looking at bringing to IRIX) but for C++ it quickly becomes impractical and untenable with the number of C++11 projects out there. How do you expect us to get modern CMake on IRIX without a recent compiler?

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,240
Threads: 533
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
12-26-2024, 02:05 AM
#75
RE: GCC On IRIX -- a lot of stuff I'm learning about this
Unfortunately, the development of the C and C++ languages are classic examples of useless scope growth and feature creep.

Project: Temporarily lost at sea
Plan: World domination! Or something...
vishnu
Tezro, Octane2, 2 x Onyx4

Trade Count: (0)
Posts: 1,245
Threads: 41
Joined: Dec 2017
Location: Minneapolis, Minnesota USA
Find Reply
12-26-2024, 03:56 AM
#76
RE: GCC On IRIX -- a lot of stuff I'm learning about this
Well I'm no snob but it seems that the C++98 -> C++11 brought a lot of nice features that normally have to sit in boost. I'm not a huge fan of the boost library after having worked with it.

That said, as I tried and failed to build a C++98 text editor once upon a time I do not find the constructor/ shared/auto pointer aspects of C++ particularly intuitive. If anything I would say that C++ claims to make writing code easier but I would rather sit and write boilerplate for motif's UI (as I did with my own editor, SiME) versus having to learn a whole new paradigm of programming that doesn't actually save me time.

That all said, there are a lot of useful programs that are not written in C99 without TLS or C++03. My understanding and usage of languages is as such that I don't like porting C++ programs very much.

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,240
Threads: 533
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
12-26-2024, 04:42 AM
#77
RE: GCC On IRIX -- a lot of stuff I'm learning about this
(12-20-2024, 03:19 PM)Raion Wrote:  In file included from /root/build-4.8/mips-sgi-irix6.5/libstdc++-v3/include/mips-sgi-irix6.5/bits/gthr-default.h:35:0,                                                                              from /root/build-4.8/mips-sgi-irix6.5/libstdc++-v3/include/mips-sgi-irix6.5/bits/gthr.h:148
Read this file to see what the thread interface consists of. The header redirects to another header implementing the interface: the gthr-default.h is included when there is no threads API available, which is incorrect here. IRIX 6.5.20 and up conforms to Unix98 and so the correct implementation header is gthr-posix.h.
These programs should be compiled with a -D_PTHREADS parameter. The files gthr-posix.h and gthr-default.h have the same contents (they appear to be linked) so this doesn't change the following quoted lines.

Quote:error: array must be initialized with a brace-enclosed initializer
    __gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT;
                                  ^                                                      /root/build-4.8/mips-sgi-irix6.5/libstdc++-v3/include/ext/concurrence.h:255:32: error: array must be initialized with a brace-enclosed initializer
    __gthread_cond_t _M_cond = __GTHREAD_COND_INIT;
Well, you can be sure that a mutex is definitely never an array. gthr-default.h defines the type __gthread_mutex_t as the same as pthread_mutex_t, which is defined in IRIX <sys/pthread.h> as being
Code:
typedef struct { long __D[8]; } pthread_mutex_t;        /* mutex data */

so the type of _M_mutex is a struct containing an array of length 8. In a likewise manner __GTHREAD_MUTEX_INIT is defined in gthr-default.h to be the same as PTHREAD_MUTEX_INITIALIZER, which is defined n IRIX <pthread.h> as
Code:
#define PTHREAD_MUTEX_INITIALIZER       { 0 }

Now you can see where the problem is. Initializing a struct containing an array of length 8 with { 0 } is eliding some of the braces: the outer braces are required to initialize the struct, and the embedded array initializer should normally have its own pair of braces. Whether such brace elision is allowed is a little unclear.

The C89 draft:
Quote:If the aggregate contains members that are aggregates or unions, or if the first member of a union is an aggregate or union, the rules apply recursively to the subaggregates or contained unions. If the initializer of a subaggregate or contained union begins with a left brace, the initializers enclosed by that brace and its matching right brace initialize the members of the subaggregate or the first member of the contained union. Otherwise, only enough initializers from the list are taken to account for the members of the first subaggregate or the first member of the contained union; any remaining initializers are left to initialize the next member of the aggregate of which the current subaggregate or contained union is a part.
(emphasis added)
implies that { 0 } is a valid initializer here, since the "list of initializers"—0—is used to "account for" the "members of the first subaggregate"—the long ints __D[0], __D[1], etc. The next paragraph of the draft:
Quote:If there are fewer initializers in a list than there are members of an aggregate, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration.
implies that after __D[0] is explicitly initialized to 0, the rest of the array—__D[1] to __D[7]—are implicitly initialized to 0. The examples support this interpretation:

Quote: struct { int a[3], b; } w[] = { { 1 }, 2 };

is a definition with an inconsistently bracketed initialization. It defines an array with two member structures: w[0].a[0] is 1 and w[1].a[0] is 2; all the other elements are zero.

However, the same draft standard says:
Quote:A.6.2 Undefined behavior
The behavior in the following circumstances is undefined:
...
* An object with aggregate or union type with static storage duration has a non-brace-enclosed initializer, or an object with aggregate or union type with automatic storage duration has either a single expression initializer with a type other than that of the object or a non-brace-enclosed initializer (3.5.7).

The C99 Rationale says
Quote:Various implementations have parsed aggregate initializers with partially elided braces differently.
The Standard has reaffirmed the top-down parse described in K&R. Although the construct is allowed, and its parse well defined, the C89 Committee urges programmers to avoid partially elided initializers because such initializations can be quite confusing to read.

QUIET CHANGE IN C89
Code which relies on a bottom-up parse of aggregate initializers with partially elided braces will not yield the expected initialized object.

C++ apparently supports this same syntax.

The situation of the following error message is the same, with the corresponding definitions of __gthread_cond_t, pthread_cond_t, and PTHREAD_COND_INITIALIZER, which are defined the same way in the same files. In the end I'm not sure why GCC doesn't accept the code since it looks OK according to the standards. Is this using -Werror?

Personaliris O2 Indigo2 R10000/IMPACT Indigo2 R10000/IMPACT Indigo2 Indy   (past: 4D70GT)
robespierre
refector peritus

Trade Count: (0)
Posts: 640
Threads: 3
Joined: Nov 2020
Location: Massholium
Find Reply
01-02-2025, 11:28 AM
#78
RE: GCC On IRIX -- a lot of stuff I'm learning about this
I got around all those problems no problem

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,240
Threads: 533
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
01-02-2025, 04:51 PM


Forum Jump:


Users browsing this thread: 1 Guest(s)