Live data from Hacker News

Cosmopolitan Libc: build-once run-anywhere C library

justine.lol

111–120 of 171 posts

Re: Cosmopolitan Libc: build-once run-anywhere C library

#111

This is what I've been working on with RISC-V, and you have no idea how much resistance I get when I try to fix the problems relating to calling conventions, inline assembly and system calls. I don't want to have to explain what I'm doing from the beginning every time I have a complex question about how to make a function call from inline assembly. It has really turned me off from stackoverflow as a whole. Sorry for…

I reached the same conclusion about stackoverflow. Is there an incentive from the real world to answer questions because so many beginner try it?

I guess it's a ROI issue. Low effort answers to many easy questions gets you many points, while novel questions which requires thorough understanding is high effort and few points.

Re: Cosmopolitan Libc: build-once run-anywhere C library

#112

Earlier quoted context omitted.

I have the same experience. Stack Overflow is not great when you try to achive something novel or do something new from scratch.

Can you guys link to an example?

A question I asked that springs to mind is https://stackoverflow.com/questions/37554058/fast-display-of...

It was down voted to a negative score initially. People posted irrelevant/unhelpful comments that I had to hurriedly refute before the question was closed and deleted.

To be fair, I have tweaked the question since, so it probably makes more sense than it did when I initially asked it. But I feel that is something the community should help with.

Re: Cosmopolitan Libc: build-once run-anywhere C library

#114
post #76

This is one of the most interesting projects I have seen this year. Congratulations for the idea and for the execution.

It's beautiful, isn't it? Making something simultaneously compatible with multiple formats. A far more interesting use of the PE/COM “MZ” header than simply printing “This program cannot be run in DOS mode”.

Re: Cosmopolitan Libc: build-once run-anywhere C library

#115

This is what I've been working on with RISC-V, and you have no idea how much resistance I get when I try to fix the problems relating to calling conventions, inline assembly and system calls. I don't want to have to explain what I'm doing from the beginning every time I have a complex question about how to make a function call from inline assembly. It has really turned me off from stackoverflow as a whole. Sorry for…

I reached the same conclusion about stackoverflow. Is there an incentive from the real world to answer questions because so many beginner try it?

Is there an incentive from the real world to answer questions

Apparently so - if you look at the “Customer Questions and Answers” section of Amazon product pages, there is a remarkably high proportion of answers like, “I don’t know, I haven’t opened it yet” and “I’m not sure, I bought it as a gift”.

Re: Cosmopolitan Libc: build-once run-anywhere C library

#116
post #98

This looks amazing, I just gave it a try but sadly got this: /usr/bin/ld: crt.o: unable to initialize decompress status for section .debug_aranges This on a WSL2 Ubuntu 18.04 install with gcc 7.5.0. Any ideas what the problem could be?

Works fine for me on Ubuntu 20.04 (also WSL2) and binutils 2.34. Have you tried updating binutils to newer version? (>=2.32)

Re: Cosmopolitan Libc: build-once run-anywhere C library

#117
post #44

> Please note this is intended for people who don't care about desktop GUIs, and just want stdio and sockets [...] Not to diminish the achievement at all, but a significant limitation to be noted (and not a very surprising limitation). I also wonder about things like the sizeof(long). On 64-bit linux, this is 8, but on windows, it's 4. Well, "on windows"... maybe this throws all the APIs that make such assumptions, u…

Author here. That's not an inherent limitation. See https://justine.lol/apelife/index.html for an example of a GUI + TUI that's built using Cosmopolitan. The reason why I said what you quoted, is I'm simply trying to calibrate expectations. I don't view desktop GUIs as a productive area of focus, because there's such a lack of consensus surrounding the APIs that requires, and web browsers do a great job. As for sizeo…

> Cosmopolitan even takes care of the chore of translating your UTF-8 strings into UTF-16 when polyfilling functions like open() which delegates to CreateFile() on Windows.

That shortcoming of the MSVC runtime has been the bane of multiple projects I've done on Windows. Even without the portable executable trick, Cosmo might be useful as an alternative Windows CRT that can be used with GCC or clang. (Edit: Except that ARM64 Windows is now a thing, whereas Cosmo seems to assume the continued hegemony of x86-64.)

Re: Cosmopolitan Libc: build-once run-anywhere C library

#118
post #67
post #44

Earlier quoted context omitted.

Author here. That's not an inherent limitation. See https://justine.lol/apelife/index.html for an example of a GUI + TUI that's built using Cosmopolitan. The reason why I said what you quoted, is I'm simply trying to calibrate expectations. I don't view desktop GUIs as a productive area of focus, because there's such a lack of consensus surrounding the APIs that requires, and web browsers do a great job. As for sizeo…

Regarding consensus desktop APIs, maybe it's time to re-invent/-introduce Win32s ;) (Although adding that to the library would add considerable bloat, and cross-platform runtime dynamic linking or a "dynamic polyfill" might be a bit beyond the scope of this) Or raw X11 protocol, of course (WSL made X11 servers on Win10 quite common, and . If that wouldn't be so horrible, it would be interesting how small one could ge…

> it would be interesting how small one could get basic widgets starting from scratch.

Please don't do this for any application with a wide audience. Small, simple widgets are missing many important things such as accessibility and internationalization.

Re: Cosmopolitan Libc: build-once run-anywhere C library

#120
Not to be "that guy" but DevOps doesn't really relate to the tag line. It's like saying "build-once run-anywhere c without lean / agile / six sigma". What's a C library got to do with a people management strategy?

> you won't need to configure a CI system to build separate binaries for each operating system

If that's where the DevOps part comes from, CI predates DevOps. DevOps is just a general strategy for coordinating work that incorporates CI among other things. And you'd still use CI with this because CI is more about an SDLC than portable builds.

I like the idea of the project. Is there a list of apps that use it?

Post reply on HN