2 ms·
Author here. The Apple and Microsoft linkers make that difficult. The GNU and LLVM compilers usually choose to conform to those difficult conventions when compi
by jart 5y ago
Author here. The Apple and Microsoft linkers make that difficult. The GNU and LLVM compilers usually choose to conform to those difficult conventions when compiled for those platforms. You can help us fix that, because we're working on chibicc, which is like TCC but 10x better. https://github.com/jart/cosmopolitan/blob/master/third_party/chibicc/README.cosmo https://github.com/jart/cosmopolitan/blob/master/third_party... It's not there yet. It can be built as an actually portable executable. I already wrote an assembler for it. Soon we'll have a C linker for it too, and thus a whole toolchain in one file. The tradeoff is it doesn't optimize. But it supports C11 and most GNU extensions. So when we're OK having velocity in development anywhere with code that only goes half as fast, but compiles 5x as fast, this will be the way to go.
- 1vuio0pswjnm7 5y agoIs there an option for BSD users to use their own toolchain instead of chibicc or the included version of GCC. TCC, as impressive as it was, was never made to be portable. Portability was apparently not a goal. After all these years, it is still a WIP in pkgsrc. Correct me if I am wrong but with a chibicc solution cosmopolitan will still be "Linux-centric" because anyone compiling on Linux will have the option to use an optimising compiler instead of chibicc.
- jart 5y agoIt's build-once run-anywhere. I build my software on Linux. I'm the primary contributor so that just happens to be what's best supported. Cosmopolitan is a labor of love that I made to make developers happy. I'm sure over time it'll evolve into build-anywhere run-anywhere. You can help me will that future into existence. You yourself said that something like redbean should become the new normal. When I studied the old code, I saw its merits, and I've used my popularity to help change what popular means.
- 1vuio0pswjnm7 5y agoI support what you're trying to do 100%. (Except all the ANSI escape code and Unicode stuff. I disable UTF-8 wherever I can.) IMO, "popular" is overrrated. What actually works the best, e.g., fastest, smallest, most portable, lowest resource usage, is more interesting. I want to compile the modified runtime crt.S and ape.S on NetBSD. Maybe with /emul/linux it's possible. I've been using shell scripts without shebang lines for decades (because NetBSD's default shell is my preferred interactive shell and I hate typing). It was funny to see that described as "forgotten".
- jart 5y agoI'm pretty sure you can just use the cosmopolitan binaries. Right before the v0.2 release I verified that the release binaries worked with the LLVM that came with FreeBSD 12 on the stock system, without any Linux emulation. (Sadly a regression in ape.lds got introduced at some point since then, that broke LLVM support). So if you use the v0.2 release ape.o release binaries, you should probably be OK. If you're a fan of NetBSD's shell, you'll be pleased to hear that it's now more bug free thanks to Cosmopolitan. I found a bug with it and reported it to the dev team months ago. In many ways I'm proud of the fact that the work I'm doing is helping to support the BSD communities. It's not perfect yet. But I think a project like this is going to attract further interest to the platform. Particularly for production use cases.
- 1vuio0pswjnm7 5y agoNot really a fan of using binaries I cannot myself compile on NetBSD (i.e., non-portable code that only compiles on Windows/MacOS/Linux). No doubt the provided binaries will work, but I want to compile crt.S and ape.S myself on a NetBSD host. Have not looked at it closely but is the "unbourne" shell more or less a copy of NetBSD's Almquist shell. Would be neat to use an Almquist-derived shell with command history on Linux. From what I have seen of other OS, attracting "further interest" is not always a good thing. Depends on whose interest it attracts. The negative side effects of popularity, to me, are not always worth it. The Linux kernel is said to get an additional 1.5 million LOC per year. Of course it can be trimmed down (even smaller than NetBSD's), but still. The fewer cooks in the kitchen the better, IMO.