we've gone from "lol get rekt" to "we're most of the way through but we slipped up last second due to a bug in a generated makefile", so i might actually pull glibc out of my ass. one thing i don't understand, however, is why there's reference to so many solaris2.x files in the glibc package from 1999 to today, with the reference count going up over time, but it references an entire folder of solaris 2.x code that ISN'T PRESENT. i have a full directory listing for these files over time because they're in the translation files in every goddamn release since 1999 and the configure script even tries to search for them but WHERE ARE THEY

"sysdeps/unix/sysv/sysv4/solaris2" doesn't exist. "sysdeps/unix/sysv/sysv4" doesn't exist.
the korean translation files point to seven different header files IN THE SOLARIS2 FOLDER in 2006, and thirty-two files in 2023. THE FOLDER IS NOT HERE.

i wanted to enable nls but no, it's not happy about that at all.
WHAT SLICES, SOLARIS? WE HAVE NO SLICES, HOW CAN A SLICE BE PAST THE END OF THE DISK IF THE SLICE DOESN'T FUCKING EXIST
apparently if the partition table is corrupted, it doesn't check it at all, and you just have to blindly guess that any errant behavior is because that's the case. god i hate this operating system
oh look, the official solaris documentation even says the volume manager sucks ass

if compilation fails somewhere in gcc's includes, usually there's an issue with your code.

if compilation fails somewhere in gcc's includes in THIS mess, usually it ends up being a processor-specific nightmare.

today's bug:

`extern char *gettext(const char *);` from libintl is a syntax error near "const". no, no preceding lines have fucked up nesting or unterminated lines and there's no preprocessor statements directly before this line. it's just fucked, but ONLY on the original Pentium through the Pentium MMX. 486? Pentium 2 Xeon? Totally fine.

if sun didn't want me overwriting their includes wholesale they would not break on only a few processors in particular

we have broken the 2015 average let's fucking go

(for those wondering what the 1997 package is, it's mc, then next oldest is 2001 wget

build one package, six more break. libiconv has been REBUILT FROM SCRATCH but no, no it's not sufficient, fuck you the symbols are RIGHT THERE in /usr/lib/libiconv.so FUCK YOU tar i swear to god

even if i manually declare the library AND redeclare /usr/lib as a library folder it still does this. i'm building with both shared and static libs, both are present for libiconv. but no, fuck me i guess

bash 4.4 found those symbols just fine with no guidance at all. this is horseshit i swear to god solaris
really?
fun fact: this is due to /bin/sh not being 100% POSIX-compatible (but /usr/xpg4/bin/sh is???) which might be where some of my other configure issues came from. why is solaris this fucked

so i'm now compiling gcc 4.4.7 twice (once to get gcc 4.x itself, a second time after getting high enough with binutils for visibility support) and now i'm on to glibc.

predictably, it's a nightmare of non-standard include issues and "oh i need a semicolon or something in the middle of this typedef" in the middle of gcc extension black magic and dense preprocessor logic. i'm using glibc 2.14.1, which is the last version before they started stripping out non-Linux support entirely over the next couple versions. i might have to start fucking mixing files from other versions to get something resembling normal operation.

also, if you require inline support and optimizations to be enabled, glibc, MAYBE DON'T OVERWRITE THE USER'S CFLAGS

some of these hardcode ksh commands but aren't ksh compatible, which is fucking ffffffffFFFFFFFFFUN

of course my first thought is to try zsh because it's supposed to have stemmed from ksh, and be generally compatible, but NO. newest version of zsh CAN'T BE USED FOR MAKE

how does anyone take this shell seriously

- fdlibm (written by sun): needs stdint.h, completely broken (tries to build m68k libm on x86 machine)
- openlibm: needs stdint.h, IEEE float support fucked in all versions
- freebsd msun: based on fdlibm, might work?
- musl: requires Linux-style usage, might not be compatible?
- CRlibm/MetaLibm: fucking dead, can't find tarballs

we're at the point in the project where one merely considers writing completely custom C98 headers for the system. will they work? probably not, but we're gonna fucking try!

imagine adding bz2 decompression to stage0 of a project only to have that decision make it impossible to compile stage2 because it makes python segfault.
for those wondering how it's going:
you know what, gcc, i needed to hear that. that's quite a confidence boost, i might actually pull this project off.
not much left to do now. a lot of this is gonna be ass-pull, but if it gets this going long enough to replace the libc it stops being an issue
"we don't know if these are defined so just define them as empty lmao fuck you" -sun
if i were smart i'd lock these changes to the stdlib behind a define just so it retains 100% compatibility with the stock libc but I can't use the usual `__STDC__` date flag because GCC won't emit it because i'm not supposed to have C99 support. I'm gonna have to make shit up as I go, but that's par for the course at this point.
the fuck?
mfw there's seven copies of the same define block to declare size_t and ONE copy differs, and obviously that's the one that has highest priority! no goddamn wonder i'm having type issues.
no, it just keeps going. the type errors never fucking stop, baybeeeeeeeeeeeee
i think this is no longer compliant with Sun Studio because i'm using a GCC extension but WE GOT IT
ah yes, "ifdef __typeof__" is a no-op for GCC 3 specifically, but not for GCC 2 or GCC 4. sweet!

ok so if <newroot>/lib isn't symlinked to /usr/lib, gcc's first build immediately dies due to not being able to find __builtin_va_alist. HOW? IT'S FUCKING BUILTIN, GCC

it's not even like it's due to the prebuilt GCC needing it, because /usr/lib contains ZERO includable files, so it wouldn't be affected by /usr/lib not being linked, right?

but it is.

why and how

somehow, in trying to fix the type mismatch between SIZE_MAX and size_t, i forgot you can use typedef'd types... as types you can cast to!

i'm fucking stupid i swear

`__typeof__((size_t)ULONG_MAX)` != `__typeof__(size_t)`, apparently. never mind, nothing is fixed here.
I accidentally built multiple programs, including a whole ass copy of GCC 3.2, using GCC 2.95.3 as a C compiler and Sun's custom C++ compiler at the same time. i don't know how i got that far with that fuckup
this whole "if /usr/lib isn't symlinked then gcc can't find a builtin even after successfully building gcc from source" thing is really fucking me over, because i can't be repeatable in testing without reinstalling the whole ass OS. currently, you can't build GCC 2.95.3 with suncc if you've done so and reset the prefix because stage1/gcc.o has a lot of mangled symbols from suncc only after you get gcc 2.95.3 libs in /usr/lib, and stage2/gcc.o for some reason does not have this issue. i do not feel like disassembling suncc to figure that shit out, either.
i've gotten like 60% of glibc 2.1 to build correctly on solaris 2.7, but it dies in the middle of some ELF section handler (the ELF section name is undefined, and i don't see a single spot where it's defined when grepping the entire source dir for 2.1 or 2.13 or 2.30, so...?)
turns out glibc 2.2 might work. maybe. i don't want to jinx it but after fixing some jank typedef parsing error issues and working around a make bug or two, we're at least dying in the test suite builder instead of a random time library that hasn't been buildable literally ever, from what I can tell.
i think the power failure earlier broke something in gcc, either the built copy or the source. fuck.
so it turns out when building gcc 4.4.7 the first time, whether or not just using "make" still tries to bootstrap, DESPITE PASSING "--disable-bootstrap" TO GCC'S CONFIGURE SCRIPT, seems random. lovely.

nope! this is even dumber. it turns out gcc in general is just stupidly sensitive to any tweaks in the system's headers, even adding whitespace can cause all of libiberty (as packed with gcc 4.4.7) to be invalid. almost every single line, starting halfway in. it looks like a missed semicolon or bracket, but the 120-some lines directly above are fine, the three header files it processed are OK, no one's to blame but a random macro that worked for 40 other lines but suddenly not here.

god i hate gcc

the modded header files even built binutils, xz, gzip, tar, m4, bison, gmp, and more just fucking fine, they all work, autoconf test suites are actually reporting fewer issues with the modded system headers than stock, almost all of it is now C99 compliant with very limited exception.

but if you add just whitespace to the headers, gcc 2.95.x loses track of all its builtins, 3.2.x can build just fine, and 4.4.7 can't bootstrap itself because it loses the ability to read in stage1, even when bootstrapping is disabled (because it does a one-stage bootstrap for its support libraries regardless.)

can't switch to a more sane language either because rust requires llvm and cmake, and those need like gcc 6.x and glibc, which are a ways off.

"how did you make solaris 7 C99 compliant without rebuilding the entire OS from source?" Sun was following the draft versions incredibly closely, so all that was really missing were a couple minor tweaks to #define statements here and there and fabricating stdint.h, which is mostly just importing other headers anyway. The hardest part were values like WCHAR_MIN, but the _t counterpart usually existed somewhere already, and as such you can extrapolate those just fine.
i've just realized that i don't think xz actually needs 64MB of RAM to decompress. post-Tan xz still works in Solaris 7 to decompress -9evv tarballs with 16MB of memory.

i've been laboring for WEEKS under the assumption that gcc-4.4.7 actually checks for --disable-bootstrap because it's in the docs and it SAYS it checks for it in the ./configure script, but i've just checked and they only actually check for --enable-bootstrap and if it's not present they just default to "yeah probably bootstrap". They never... actually... check.

Do you think they'd take patches for this old of GCC? This is some real dumb shit right here.

ok no ACTUALLY what they did is instead of being --enable-bootstrap or --disable bootstrap, SOME MOTHERFUCKER banged out enough shell script to require someone to PASS IT AS --enable-bootstrap=no

that is NOT how that shit works, please cease to be

ok we're back to just... throwing GCC versions at it to see which ones we can build from 3.2 so the bootstrap works again, since 4.4.7-stage2 can't build 4.4.7-stage3 and i DO NOT KNOW WHY.

4.2.4 suddenly works fine, but cannot bootstrap 4.4.7, because 4.4.7-stage2 goes from "libiberty is just trashed" to "gmp went missing" and i'm not sure why it doesn't check the fucking system includes directory because it's literally already there, it strips off $CFLAGS before stage3 which breaks shit, once again.

goddammit.

Fuck it. Tcl/Tk works, even in 16 color mode.

ok so bootstrapping 4.3.6 or 4.4.7 with 4.2.4 leads to stage2 losing gmp.h, it suddenly can't find it because it alters the include folder list. not bootstrapping 4.3.6 works fine initially, but then it can't handle define statements at all. not bootstrapping 4.4.7 isn't even possible, it ignores all possible switches related to bootstrapping.

fuck right off, gcc.

"for example, you should be able to get any supported version running by slowly building every minor version, or just bootstrap instead!" - the docs of the only program where bootstrapping it takes weeks to debug

"gcc keeps losing track of includes by stage2 because it tosses out all cflags for stage2 onward of the mandatory bootstrap procedure"

at this point, fuck it, copy the entire system includes folder into the gcc folder. i don't care anymore. at this point i consider gcc an enemy combatant.

ok maybe installing to an NFS share causes issues when it's a modern Linux box that... cares about permissions.
it's been a while, but this shitass Solaris project is not dead. at all. i've managed to get TLS and SSL going on sol7, through gnutls, now that I have a box that can actually connect to the internet. next up, an attempt at SDL, for pygame purposes.
no, nvm, if you use mini-gmp for nettle it doesn't build SHIT and it spits out one of two libraries... and it's 8KB. nettle is a cryptographic library and it's gotta be a hell of a lot bigger than that.

I finally got GnuTLS running, and it was segfaulting instantly upon load. Why?

Solaris this old does not have a /dev/random equivalent. Anywhere. At all. There's a patch to add it for 2.5 and 2.6, but not for 2.7. Why they didn't include it in 2.7 as well, I don't know, but the 2.6 packages work on 2.7. Speed isn't great, but fuck it, it works. Now to figure out how the fuck to get certificates without needing recent python3 or openssl (this excludes every single update-ca-certificates type package. Yes, for every distro.)

Also, I got X11R6 running, and the drivers even give me 2D acceleration on this T43. It's nice to have more than 16 colors again.

what are the odds i'll get assistance with what appears to be busted configure flags on SDL2? https://github.com/libsdl-org/SDL/issues/13971
[SDL2] configure --disable-atomic ignored? · Issue #13971 · libsdl-org/SDL

(SDL2 2.32.8 attempting build on i386-pc-solaris2.7, GCC 4.3.6) Per the configure script, --enable-atomic is assumed by default, but "default=yes" implies it can be disabled. However, passing --dis...

GitHub
fuck it, after a patch to fix some problematic memcpy redefs we have SDL1. that'll do.
gcc's libstdc++.so is requiring several math functions for libm version "SUNW_1.1" but no libm packed with sol7 or SUNWspro fulfills that version number? A couple X11 libraries also need it, but they load fine. I don't know where the fuck it found these to start with, but I can't seem to turn off symbol versioning to fix it. What the FUCK do I do now?
what I do now is patch SDL2. They're detecting old Solaris versions as Solaris properly, but only newer versions of Solaris have the non-standard atomic.h header. sol7 doesn't have it... at all, so I have to manually comment out huge code blocks to get it to use the emulated atomic operations properly.

a couple complete asspulls to synthesize unsetenv and a few other things later, and we have SDL2 2.30.0. I can't test it, because everything that needs it requires cmake which is still busted because libstdc++ is still busted... but it compiled!

Speaking of, if you're gonna leave a check for setenv in your configure.ac because you can work around it, but you DON'T check for unsetenv, don't try to fucking use unsetenv!

The fun part about this is that this version of SDL2 has support for the PS5, so we can now consider Solaris 7 knowledgeable on the PS5. This almost-30 year old OS now shares code with the PS5. wonderful.
It turns out, C++ usually has separate headers for a reason. We have CMake.
cmake docs are lies. "LIBLZMA_FOUND added in 3.3" it's used to build 3.1, which requires 2.8.4 minimum.
i've been toying with the idea of pulling in something like gnulib as a large "libfixmyshit" since full-fat glibc is a nightmare of gcc macros and it's actually slick as shit once you figure out what's going on, in comparison to manually editing an entire fucking project...

ugh, the versioned symbols DO exist... in a custom table, and Solaris' linker gives up and returns the first file it sees when linking, so at COMPILE time libstdc++ is linked to /usr/lib/libm.so.1, but at RUNTIME it's pulling `$__OUTDIR/lib/libm.so.1`! (in this case `$__OUTDIR` is `/opt/newroot`)

# ldd -s /opt/newroot/lib/libstdc++.so

find library=libm.so.1; required by /opt/newroot/lib/libstdc++.so
search path=/usr/local/lib:/opt/newroot/lib:/usr/lib:/lib:/sbin/lib:/opt/SUNWspro/lib (LD_LIBRARY_PATH)
trying path=/usr/local/lib/libm.so.1
trying path=/opt/newroot/lib/libm.so.1
libm.so.1 => /opt/newroot/lib/libm.so.1
libm.so.1 (SUNW_1.1) => (version not found)
# mv /opt/newroot/lib/libm.so.1 /tmp
# sync
# LD_LIBRARY_PATH=/opt/newroot/lib:/usr/lib:/lib:/sbin/lib:/opt/SUNWspro/lib ldd -s /opt/newroot/lib/libstdc++.so

find library=libm.so.1; required by /opt/newroot/lib/libstdc++.so
search path=/opt/newroot/lib:/usr/lib:/lib:/sbin/lib:/opt/SUNWspro/lib (LD_LIBRARY_PATH)
trying path=/opt/newroot/lib/libm.so.1
trying path=/usr/lib/libm.so.1
libm.so.1 => /usr/lib/libm.so.1