<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Nov 3, 2024, 16:29 Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 11/3/24 13:24, Brian Mayer wrote:<br>
> This time I sent it correctly to the list!<br>
<br>
And my first reply went just to you, because _I_ forgot to manually add <br>
the list to my reply window. Sigh...<br>
<br>
And cutting and pasting the previous reply into a new reply so the <br>
threading is right (copy outbox copy into drafts folder and double click <br>
to open editor still works, but I did not find "add reply msgid" in the <br>
menu pulldowns), thunderbird completely screwed up the wordwrapping. No <br>
"disable wordwrap" in the pulldown without a plugin, and its "rewrap" <br>
option does as much harm as good. Oh well, that's software "upgrades" <br>
for you. I'd learned how/when to work around the old quirks, now they <br>
force me to use a different UI where they've given the quirks a big stir...<br>
<br>
Oh well.<br>
<br>
On 10/31/24 20:28, Brian Mayer wrote:<br>
> Hi Rob, thank you for taking the time to answer this.<br>
> <br>
> Sorry my previous email was a bit obtuse, let me give you more<br>
> context.<br>
> <br>
> I am trying to create an ultra simple meta-distro. The idea is to <br>
> provide the minimum working system that the user can use to build <br>
> their things on.<br>
<br>
The phrase I've been using is "minimal native development environment":<br>
<br>
<a href="https://landley.net/aboriginal/about.html" rel="noreferrer noreferrer" target="_blank">https://landley.net/aboriginal/about.html</a><br>
<br>
<a href="https://landley.net/toybox/about.html" rel="noreferrer noreferrer" target="_blank">https://landley.net/toybox/about.html</a><br>
<br>
<a href="http://lists.landley.net/pipermail/toybox-landley.net/2020-July/011898.html" rel="noreferrer noreferrer" target="_blank">http://lists.landley.net/pipermail/toybox-landley.net/2020-July/011898.html</a><br>
<br>
2013:<br>
<a href="http://landley.net/talks/celf-2013.txt" rel="noreferrer noreferrer" target="_blank">http://landley.net/talks/celf-2013.txt</a><br>
<a href="http://www.youtube.com/watch?v=SGmtP5Lg_t0" rel="noreferrer noreferrer" target="_blank">http://www.youtube.com/watch?v=SGmtP5Lg_t0</a><br>
<br>
2017:<br>
<a href="https://www.youtube.com/watch?v=Sk9TatW9ino" rel="noreferrer noreferrer" target="_blank">https://www.youtube.com/watch?v=Sk9TatW9ino</a><br>
<br>
2019:<br>
<a href="https://www.youtube.com/watch?v=MkJkyMuBm3g#t=1m18s" rel="noreferrer noreferrer" target="_blank">https://www.youtube.com/watch?v=MkJkyMuBm3g#t=1m18s</a><br>
<br>
> So I want toybox, a libc, a shell and a c compiler in it, make is a <br>
> good addition because most software depends on it. The url for the<br>
> project is:<br>
> <br>
> <a href="https://terminal.pink/lin0/tree/index.html" rel="noreferrer noreferrer" target="_blank">https://terminal.pink/lin0/tree/index.html</a><br>
<br>
Good luck. I've tried to do exactly this before and share the roadblocks<br>
I hit if you'd like. Back in 2008 I made a presentation on it:<br>
<br>
<a href="https://landley.net/aboriginal/downloads/presentation.pdf" rel="noreferrer noreferrer" target="_blank">https://landley.net/aboriginal/downloads/presentation.pdf</a><br>
<br>
Bit stale in places, but...<br>
<br>
> Sorry about the certificate, I'm working on it.<br>
> <br>
> In order to do this I started with musl. Compiled it, musl ships a <br>
> musl-gcc wrapper that simply uses a spec file to tell gcc to use the <br>
> musl libraries and all, which is basically doing what is described<br>
> here:<br>
<br>
I've been very tangentially involved in musl-libc development since<br>
before Rich even named it or made it public (he was on the busybox list<br>
and #busybox irc channel back on Freenode back when I was maintaining<br>
that). I'm the one who convinced him to switch it to a BSD license back<br>
in 2012:<br>
<br>
<a href="https://landley.net/notes-2012.html#18-01-2012" rel="noreferrer noreferrer" target="_blank">https://landley.net/notes-2012.html#18-01-2012</a><br>
<br>
Last I checked it works fine. It's the libc in Alpine Linux which is a<br>
pretty full distro.<br>
<br>
>> Modulo glibc's dependencies (perl!) are sad enough that this time<br>
>> around a musl-libc gcc toolchain was my first pass to establish a<br>
>> baseline, but<br>
>> <br>
<a href="http://lists.landley.net/pipermail/toybox-landley.net/2024-September/030526.html" rel="noreferrer noreferrer" target="_blank">http://lists.landley.net/pipermail/toybox-landley.net/2024-September/030526.html</a><br>
>> strongly implies that it's working fine. Plus, you know, alpine<br>
>> existing. :)<br>
> <br>
> So for the rest of the project I'm using this compiler, next I build <br>
> tcc, linux, toybox and mksh. All are ok and work fine, I booted to <br>
> this system after all this.<br>
<br>
So what you built _with_ and the resulting environment you provide<br>
aren't the same thing.<br>
<br>
I have an "airlock step" where the first thing I did was built host<br>
versions of the compiler and command line tools I intended to put in the<br>
target, and built everything with them.<br>
<br>
I've explained this a number of times over the years, it's probably in<br>
<a href="https://github.com/landley/aboriginal/blob/master/www/README" rel="noreferrer noreferrer" target="_blank">https://github.com/landley/aboriginal/blob/master/www/README</a><br>
<br>
>>> I tested the c compiler and it works,<br>
>> <br>
>> Define "works". It took years for people to build linux-kernel<br>
>> with llvm, there was a whole PROJECT for it, which has mostly gone<br>
>> the way of <a href="http://uclinux.org" rel="noreferrer noreferrer" target="_blank">uclinux.org</a> (declared victory and disbanded). And I<br>
>> specifically mean "the kernel",<br>
>> <br>
<br>
<a href="https://www.cnx-software.com/2012/07/16/ellcc-multi-target-cross-compiler-based-on-clang-and-llvm-compiler-infrastructure/" rel="noreferrer noreferrer" target="_blank">https://www.cnx-software.com/2012/07/16/ellcc-multi-target-cross-compiler-based-on-clang-and-llvm-compiler-infrastructure/</a><br>
<br>
>> was about trying to get userspace to work...<br>
> <br>
> Works means it is able to generate valid elf programs and shared<br>
> libs that the musl's ld loader can run.<br>
<br>
I got tinycc to do that back in the day too. Building hello world and<br>
building a bootable system have a bit of distance between them.<br>
<br>
> I didn't test compiling the kernel with it, but now I'm curious, I'm <br>
> gonna use the compiled tcc to compile the rest of the system in my <br>
> following versions.<br>
<br>
My old fork taught tinycc basic constant propagation (which I believe<br>
Grischka merged into his version), but it didn't have dead code<br>
elimination, was missing c99 vararrays, didn't even try c11 features<br>
(These days toybox uses struct blah){x=y;} style complex inline<br>
constants and __has_include(), the latter of which is really a<br>
preprocessor feature not a language feature.)<br>
<br>
One thing I definitely wanted to do that I have yet to hear of tinycc<br>
implementing is a multiplexer so you can symlink cc/ld/as/strip/cpp to<br>
tinycc and it'll behave as the appropriate binary. Heck, just being able<br>
to use tcc's (much faster) preprocessor in distcc would be a big win,<br>
but alas there's a LOT of implicit architecture knowledge baked into<br>
that. Try running: gcc -E -dM - </dev/null<br>
<br>
I remember trying to get just tinycc's linker to work circa<br>
<a href="https://landley.net/notes-2008.html#09-04-2008" rel="noreferrer noreferrer" target="_blank">https://landley.net/notes-2008.html#09-04-2008</a> but it didn't have the<br>
concept of --gc-sections. That day's blog entry also mentions trying to<br>
get it to work on an arm host but it couldn't build a libtcc.a for that<br>
target so I had to use libgcc...<br>
<br>
Grishka wasn't _interested_ in fixing any of these issues, because they<br>
didn't affect Windows.<br>
<br>
>> Don't ask me why gnu/they don't gnu/emit the gnu/failures to<br>
>> stderr. That would make too much sense, they need gnu/hazing<br>
>> rituals to keep out the unwashed masses I guess.<br>
> <br>
> And a ton of extensions to make things non compliant...<br>
<br>
So? Compliant with what, Turbo C's "near" and "far" keywords? Microsoft<br>
Visual C? Half the posix-2008 features like openat() started as glibc<br>
extensions, the C committee is just a bit slower on the uptake than<br>
posix. (Which is sad because there was a SIXTEEN YEAR GAP between<br>
posix-2008 and posix-2024, and we're arguing about "make -j" on the list<br>
because of COURSE they didn't standardize "nproc". Linux 2.0 added SMP<br>
support in 28 years ago, Intel shipped its first SMP laptop processor 18<br>
years ago, the first SMP smartphonephone came out 13 years ago... And<br>
posix came out with a uniprocessor standard earlier this year. Of course.)<br>
<br>
Intel's icc was the second compiler to build Linux in something like<br>
2005, because they implemented all the gcc extensions Linux used.<br>
Fabrice Bellard's tccboot work also involved either implementing or<br>
stripping out stuff like "a ? : b" as a synonym for "a ? a : b" (which<br>
does not recalculate A), which I think got picked up by one of the newer<br>
C standards? (C11 was it? I forget, I only moved from C99 to C11 </blockquote></div></div><div dir="auto"><br></div><div dir="auto">no, i just checked C23 6.5.15 in case i'd missed this (because a lot of common extensions _are_ newly standardized in C23), but this isn't there.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">because<br>
I wanted __has_include() and the ability to typecast up an inline array<br>
instance, I think there's at least one more C standard released since<br>
but I glance at the change list when they come out and generally go "oh<br>
hey, a different syntax for atomics, they're still ignoring LP64 I<br>
see..." and continue with what I was doing.)<br>
<br>
>> Doing toybox _and_ tcc at the same time seems a bit extreme, in<br>
>> general changing multiple variables at once makes experimental<br>
>> results WAY >><br>
<br>
harder to parse. Hence the invention of laboratory conditions. :)<br>
<br>
> <br>
> nahh<br>
<br>
I got my project to work. Aboriginal Linux rebuilt itself under itself<br>
and built Linux From Scratch under the result. Alpine Linux built on<br>
that work to do a full distro.<br>
<br>
I only shut it down in 2017 because I was starting over with mkroot,<br>
which is A) way simpler, C) uses toybox instead of busybox and musl-libc<br>
instead of uClibc, D) outsources the toolchain build(s) to a separate<br>
script, E) isn't finished yet. :)<br>
<br>
>> You might also want to coordinate with<br>
>> <br>
<a href="http://lists.landley.net/pipermail/toybox-landley.net/2024-September/030526.html" rel="noreferrer noreferrer" target="_blank">http://lists.landley.net/pipermail/toybox-landley.net/2024-September/030526.html</a><br>
>> (which is another reply window I have open but haven't managed to<br>
>> scrape up the spoons for yet).<br>
> Cool, thanks.<br>
> <br>
>> (I have "writing a new make" on my toybox todo list,<br>
> <br>
> That would be awesome, I also tried building bmake (BSD Make) but it <br>
> also needs me to run ./configure, so I ended up in the same place.<br>
<br>
<a href="https://landley.net/toybox/faq.html#hermetic" rel="noreferrer noreferrer" target="_blank">https://landley.net/toybox/faq.html#hermetic</a><br>
<br>
<a href="https://github.com/landley/toybox/blob/master/scripts/prereq/build.sh" rel="noreferrer noreferrer" target="_blank">https://github.com/landley/toybox/blob/master/scripts/prereq/build.sh</a><br>
<br>
>> but hit burnout this year. Sometime between moving from TX to MN<br>
>> this spring, getting flooded here on the list by a well-meaning<br>
>> developer who just took the fun out of everything, getting covid<br>
>> YET AGAIN (still sucks), having yet to find a proper coffee shop<br>
>> setup here in minneapolis (workspace is important), and the looming<br>
>> return out outright fascism, I've spent the past few months kinda<br>
>> spinning my wheels...)<br>
> <br>
> I am so sorry about this, hope you get back on track soon.<br>
<br>
Me too. :(<br>
<br>
>>> so it may be something related to how GNU autotools interact with<br>
>>> toybox or the compiler.<br>
>> <br>
>> Do you mean you built gmake with tinycc, and the rest of the $PATH<br>
>> being debian or similar?<br>
> <br>
> I'm trying to build make on the resulting system (toybox, mksh &<br>
> tcc).<br>
<br>
You've changed multiple variables at once.<br>
<br>
>>> The errors are hard to follow, but it seems to be related with<br>
>>> the confdefs.h and .c files, after a lot of sed and cat<br>
>>> commands. The idea is to bootstrap the build tools, i.e. compile<br>
>>> make without make or other tools that depend on make.<br>
>> <br>
>> Ok, I'll bite. How do you compile make without make? (Do they<br>
>> provide a shell script, like toybox's<br>
>> <a href="https://landley.net/toybox/faq.html#hermetic" rel="noreferrer noreferrer" target="_blank">https://landley.net/toybox/faq.html#hermetic</a> or what?)<br>
> <br>
> Fortunately, the make tarball comes with a bootstrap script that, <br>
> supposedly, builds make without make.<br>
<br>
Cool. Like mine, above. :)<br>
<br>
> I guess the gnu tools must start somewhere... But it runs ./configure<br>
> as a first step, which is where I'm stuck.<br>
<br>
Yeah, that's silly. Mine does NOT run configure, it's a packaged up<br>
single compiler invocation with known behavior and no dependencies<br>
except libc and the compiler. (The point is your compiler should know<br>
how to produce binaries for your system.)<br>
<br>
It wants a shell, but it's just doing simple variable assignment and<br>
substitution, even lash could presumably handle that.<br>
<br>
>> That "can't create temporary file" looks like the first error.<br>
>> Which is not a string that exists in toybox (where we'd almost<br>
>> certainly say "temp" to save 5 bytes :) but presumably is configure<br>
>> responding to a command failure? Again, check config.log.<br>
> <br>
> The contents of config.log:<br>
> <br>
> This file contains any messages produced by compilers while running<br>
> configure, to aid debugging if configure makes a mistake....<br>
> configure:982: checking for cc<br>
> configure:1065: checking whether the C compiler (cc ) works <br>
> configure:1081: cc -o conftest conftest.c 1>&5 tcc: error:<br>
> undefined symbol 'main'<br>
<br>
That could be a tcc bug, but I dunno what was in "conftest.c". (The test<br>
didn't say -c to create a .o file so I assume there SHOULD be a main()...)<br>
<br>
> configure: failed program was:<br>
> <br>
> This tcc error I was able to reproduce by trying to compile an empty<br>
> file.<br>
<br>
Yeah but why was it empty? That compiler invocation doesn't seem like it<br>
expected an empty file. What generated that conftest.c?<br>
<br>
Rob<br>
_______________________________________________<br>
Toybox mailing list<br>
<a href="mailto:Toybox@lists.landley.net" target="_blank" rel="noreferrer">Toybox@lists.landley.net</a><br>
<a href="http://lists.landley.net/listinfo.cgi/toybox-landley.net" rel="noreferrer noreferrer" target="_blank">http://lists.landley.net/listinfo.cgi/toybox-landley.net</a><br>
</blockquote></div></div></div>