sometimes you can't figure out why things don't compile properly, and you need to just fuck everything up for a while trying to debug it.

THERE WE FUCKING GO

this has taken so long to figure out, but apparently, bootstrapping can break shit. the docs sell it as a "do this if anything breaks" but apparently that in itself caused all sorts of issues.

also disabling multilib.

"lol you need a libm"
libm:

i'm under the impression that these macros are Just Not Present in GCC 4 but the only place I can find GCC 4-specific macro docs 503's AND i'm first to archive it. well... fuck.

https://web.archive.org/web/20240000000000*/https://www.typeerror.org/docs/gcc~4_cpp/common-predefined-macros

Wayback Machine

okay so i found out that those macros MAY require multilib to be enabled in gcc, and i found this out from red hat's newlib download page. interesting, but also GODDAMMIT, now i have to get gcc 4.x working with multilib, which contributed to it snapping in half earlier.

multilib disabled: totally fine.
multilib enabled: SIGILL when compiling the "return 0" hundred-byte test ELF.

why are you like this

something has gone terribly wrong
ok so GCC 4.5.4 is just completely fucked, got it
gcc 4.4.7, totally fine. the issue is that now things require stdint.h, and Solaris up to like 10 used draft versions of C99 to make their headers, so they have inttypes.h BUT NOT stdint.h, so i'm gonna copy that shit in from modern glibc and hope for the best

i need to port all of glibc. goddammit.

foreseen problems looking at the standard listing alone, not even glibc yet:

- fenv.h (this seems like it'll be heavily system-dependent, and since Solaris 7 doesn't always have float support at all... this one's gonna suck.)
- tgmath.h (might be liftable from other systems with minimal work, since it seems to only be type-agnostic macros?)
- any stdlib.h changes needed (am i gonna need to search for leaked kernel source or some shit for this one? iirc this one is heavily system-dependent...)

i'd imagine this gets worse the higher i go, so C11 may be off the table without assistance of someone more knowledgeable than my stupid ass.

great fucking sign that the docs on how to port your large library project don't make any sense. i can't figure out how to actually add system-dependent file overrides. supposedly, you put a folder somewhere in `sysdeps/` and it Just Works but I have no idea how to declare "yes, this target is supported" and just having the folder and basic file structure where it says to put it is not fucking cutting it.

https://web.archive.org/web/20160506165616/http://www.gnu.org/software/libc/manual/html_node/Porting.html#Porting

The GNU C Library: Porting

The GNU C Library: Porting

actually, there is significant work already done to port glibc to solaris 2.x in the unmodified source package, though that would mean a lot of large kernel changes over time, so this is a bit of a strange finding. this is just here, and it's not shown to be compatible in the readme, along with like five other unix flavors. am I missing a configure flag or something? this is incredibly strange.
Yes, yes I'm missing a compile flag, because it's DELIBERATELY UNDOCUMENTED. goddammit.

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?
so apparently tar-1.35 builds a small subset of glibc if it's not present, and this does work (shit, i didn't even notice for forever, it works so well) so... in theory, those parts of glibc at minimum should work, right? it's not a lot, mostly stdlib functions it needs (who names a standard function "snprintf" how am i supposed to know what this does on first encounter?) that are present in the system's includes but it just fuckin' builds them anyway
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.