Live data from Hacker News

Cosmopolitan Libc: build-once run-anywhere C library

justine.lol

121–130 of 171 posts

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

#121
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?

I have the same problem also in 18.04 with gcc 7.5 - it's a bug in binutils:

https://wiki.gentoo.org/wiki/Binutils_2.32_upgrade_notes/elf...

I have been unable to find a backported package for 2.32 or better as a deb or ppa and there's no ways I'm installing binutils from source in case I clobber my build system. Any ideas?

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

#122
post #67

Earlier quoted context omitted.

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.

Sure, as do most TUIs and a lot of web apps. I'm merely suggesting a hack that goes along with this hack, not the foundation technology for a mono-binary Office clone.

Re-inventing the UI wheel seems somewhat common within the Go and Rust communities (as is re-inventing everything else), this would just have raw X11 protocol messages via socket as the foundation layer, not Vulkan/GL/SDL. And there just enough to be useful, e.g. text, input, buttons, canvas…

For something more serious, I suggest re-inventing PostScript/NeWs as a service, of course.

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

#123
post #122

Earlier quoted context omitted.

> 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.

Sure, as do most TUIs and a lot of web apps. I'm merely suggesting a hack that goes along with this hack, not the foundation technology for a mono-binary Office clone. Re-inventing the UI wheel seems somewhat common within the Go and Rust communities (as is re-inventing everything else), this would just have raw X11 protocol messages via socket as the foundation layer, not Vulkan/GL/SDL. And there just enough to be u…

> I'm merely suggesting a hack that goes along with this hack, not the foundation technology for a mono-binary Office clone.

Sure. I just worry that one person's clever hack will then become another person's indispensable tool, which they'll then impose on their colleagues, employees, or contractors, blocking a third person from doing their job. I know a blind person who temporarily lost his job because his employer's largest client required an application that didn't work with screen readers. So I just want to make sure developers are aware of accessibility, and in general, the risks of reinventing things that are necessarily complex.

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

#124
post #34

Earlier quoted context omitted.

Author here. WebAssembly has played an important role protecting CI on the Internet and it's cool that it enables us to run LLVM in the browser. I was very surprised when I learned that some people were using it offline outside of browsers, since doing so requires a JVM-like runtime such as wasmtime. Cosmopolitan proves that it's possible to just fix C instead, which might fix all the stuff that's built on top of C t…

> doing so requires a JVM-like runtime such as wasmtime. Cosmopolitan proves that it's possible to just fix C instead This doesn't sound like a fair comparison. WASM isn't just providing portability, it's also providing security and runtime safety. Cosmopolitan doesn't, it presumably requires you to trust the codebase, and doesn't protect you from C's undefined behaviour. Of course, WASM also imposes a considerable p…

WASM only provides sandboxing. That is not the same as security nor it means runtime safety nor protection from undefined behavior.

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

#125

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 have the same experience. Stack Overflow is not great when you try to achive something novel or do something new from scratch.

It's also a crap shoot when you try to solve a routine task. You might read through 1500 lines of people arguing before you get to the right answer, get an almost right answer, or no answer.

If you are working in a language which has good documentation (say Python or Java) you are best off learning how to look up the right answers in the official manual quickly and let your competitors waste time with stack overflow.

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

#126
post #122

Earlier quoted context omitted.

Sure, as do most TUIs and a lot of web apps. I'm merely suggesting a hack that goes along with this hack, not the foundation technology for a mono-binary Office clone. Re-inventing the UI wheel seems somewhat common within the Go and Rust communities (as is re-inventing everything else), this would just have raw X11 protocol messages via socket as the foundation layer, not Vulkan/GL/SDL. And there just enough to be u…

> I'm merely suggesting a hack that goes along with this hack, not the foundation technology for a mono-binary Office clone. Sure. I just worry that one person's clever hack will then become another person's indispensable tool, which they'll then impose on their colleagues, employees, or contractors, blocking a third person from doing their job. I know a blind person who temporarily lost his job because his employer'…

That's one of the biggest issues some developers have: We pride ourselves in the wisdom to see "bloat", but as you say, a lot of complexity arose out of necessity, even if the developer themselves doesn't need it. Privileged minimalism.

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

#127
post #82

Run anywhere? On Dreamcast? On some exotic Toshiba microcontroller?

Bare metal amd64 with BIOS, amd64 Windows, amd64 platforms that understand shell scripts and ELF or Mach-O, and any platform that understands shell scripts and has QEMU installed.

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

#128

Earlier quoted context omitted.

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”.

Occasionally AMZN will send out questions others have asked about products to you in the form of an email if you have previously purchased the same product. Some people mistake those for questions directly asked to them instead of realizing where their answer will be posted. StackOverflow doesn't do that AFAIK.

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

#129

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 have the same experience. Stack Overflow is not great when you try to achive something novel or do something new from scratch.

What is a way to fix this? Is this some part of an endless long-cycle of adoption for social networks over some kind of crossing-the-chasm style adoption curve? Or is there a structural way to fix it? Stackoverflow is better than its predecessors, but clearly is much less valuable now than for its first few 5 years or so.

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

#130
post #124

Earlier quoted context omitted.

> doing so requires a JVM-like runtime such as wasmtime. Cosmopolitan proves that it's possible to just fix C instead This doesn't sound like a fair comparison. WASM isn't just providing portability, it's also providing security and runtime safety. Cosmopolitan doesn't, it presumably requires you to trust the codebase, and doesn't protect you from C's undefined behaviour. Of course, WASM also imposes a considerable p…

WASM only provides sandboxing. That is not the same as security nor it means runtime safety nor protection from undefined behavior.

> WASM only provides sandboxing. That is not the same as security

The relevant Wikipedia article is named Sandbox (computer security).

> nor it means runtime safety nor protection from undefined behavior

It puts stronger constraints on what mischief undefined behaviour can lead to, and guarantees that various runtime errors are handled with traps. [0] This isn't the same as a hard guarantee that execution will terminate whenever undefined behaviour is invoked, but it's still a step up.

[0] https://webassembly.org/docs/security/

Post reply on HN