Earlier quoted context omitted.
I think the Zig community/BDFL might appreciate adding an APE target "os" to their buildchain (LLVM-based); that could be a match made in heaven!
Author here. I've been chatting with the Zig BDFL on Twitter recently about contributing APE support and he's been super supportive so far. It's going to be a nontrivial undertaking but would certainly be rewarding for everyone if we can make it happen.
Show HN: Redbean – Single-file distributable web server
181–190 of 264 posts
Re: Show HN: Redbean – Single-file distributable web server
#182Re: Show HN: Redbean – Single-file distributable web server
#183Am I the only one having issues trying to get this working? The webserver starts just fine, but once I add the index.html with zip as in the example, it stops working. This is on Mac 10.15, CentOS 8 and Ubuntu 18.04 LTS. Centos: [centos@test ~]$ ./redbean.com -vv error: Uncaught SIGSEGV on test.novalocal ./redbean.com EINVAL/err=22/errno:2/GetLastError:0 Linux test.novalocal 4.18.0-240.10.1.el8_3.x86_64 #1 SMP Mon Ja…
sudo spctl --master-disableRe: Show HN: Redbean – Single-file distributable web server
#184Earlier quoted context omitted.
Everything she does has this level of jaw-dropping amazingness. Between her and Fabrice Bellard i don't know many people who consistently get my chin to hit the table. I hope that Cosmopolitan becomes mainstream, so much more software could have that It Just Works quality.
"Jaw-dropping" is definitely a term I'd use to describe some of her more infamous tweets and blog posts, too.
Re: Show HN: Redbean – Single-file distributable web server
#185Earlier quoted context omitted.
Can someone explain this to me like I'm a 31 year old?
I've been programming since before you were born... and this is the most impressive hacking feat I've ever seen. A single executable, that doubles as a valid ZIP file, that you can put a complete website into, also doubles as a valid executable on Windows, Mac, Linux. The build infrastructure is a complete reworking of C to make it far more portable than even K&R thought possible. I probably wouldn't have believed it…
Re: Show HN: Redbean – Single-file distributable web server
#186Why does the magic numbers list have a XENIX column?
Author here. The name was chosen mostly out of playfulness to describe Windows since I seem to recall XENIX being the earliest example of Microsoft dipping their toes in the water with UNIX support.
Re: Show HN: Redbean – Single-file distributable web server
#187Am I the only one having issues trying to get this working? The webserver starts just fine, but once I add the index.html with zip as in the example, it stops working. This is on Mac 10.15, CentOS 8 and Ubuntu 18.04 LTS. Centos: [centos@test ~]$ ./redbean.com -vv error: Uncaught SIGSEGV on test.novalocal ./redbean.com EINVAL/err=22/errno:2/GetLastError:0 Linux test.novalocal 4.18.0-240.10.1.el8_3.x86_64 #1 SMP Mon Ja…
IIRC, from vague memories of things flying past, Big Sur won't let a modified binary run once it's been checked by Gatekeeper. Which means the first run gets checked and notarised but when you add the `index.html`, the on-disk binary has changed and Gatekeeper won't allow it to run - I guess it's to prevent malicious code modifications, etc.
This will also prevent distribution from outside of their appstore giving it will prevent updates.
So as anything Apple, the world security here is being used as code for personal machines remotely controlled by the mothership.
You trade privacy and freedoms for a little convenience.
Re: Show HN: Redbean – Single-file distributable web server
#188I just spent 30 minutes reading about this. I'm so shocked that I'm logging in to comment after 5 years of lurking. Justine has built a c library that allows you compile a binary once and have it run it on any os or baremetal. The SAME binary. Quite frankly, that sentence doesn't even make sense to me. Check out https://storage.googleapis.com/justine/cosmopolitan/index.ht... As far as I'm concerned, this is literal m…
I wonder how it handles system calls. Let me check the source...
https://github.com/jart/cosmopolitan/blob/master/tool/build/...
https://github.com/jart/cosmopolitan/blob/master/tool/build/...
> void OpSyscall(struct Machine *, uint32_t);
Pretty interesting... Need some time to figure out how it works.
The system call entry points:
https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s...
https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s...
It uses a jump slot technique which is interesting:
https://github.com/jart/cosmopolitan/blob/master/libc/sysv/m...
System call numbers:
https://github.com/jart/cosmopolitan/blob/master/libc/sysv/c...
https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s...
Looks like it packs the system call numbers of all operating systems into a single constant.
For some reason there are some dedicated implementations of Linux system calls using inline assembly rather than the entry point:
https://github.com/jart/cosmopolitan/tree/master/libc/linux
More related files:
https://github.com/jart/cosmopolitan/blob/master/libc/calls/...
https://github.com/jart/cosmopolitan/blob/master/libc/calls/...
Also funny how it calls Linux "GNU/Systemd"!
Re: Show HN: Redbean – Single-file distributable web server
#189You have a real talent for distilling the complex into something simple. It’s apparent in the purpose of your programs, in your writing, and in your source code. Thank you so much!
Basics of computing architecture that I didn’t especially think were too complex for me to learn, but we’re too abstracted for me to become interested in, are laid bare in each one of these programs and their source. This is all incredibly exciting.
Re: Show HN: Redbean – Single-file distributable web server
#190I looked into building SBCL using chibicc last weekend in the hope that one could build a truly portable lisp runtime using the ape toolchain (Yes, yes, I know you couldn't possibly pick two more different approaches to software portability). Turns out the GNUC extensions for __asm__ are the primary stumbling block (though I'm sure there are others). tcc supports the GNUC extensions needed, and chibicc supports the t…
I would highly recommend using chibicc. Bellard's work on tcc was fantastic when it came out. However it didn't age well. Its GNU extension support is roughly equivalent to GCC 2.x. The x86_64 support that got bolted on later isn't very good. It was much more elegant back when it was only doing i386. Hackability was also laid low by merging a lot of external contributions. The TCC design, while amazingly fast, also carries the tradeoff of making things like inline assembly hacks really hard because it generates the x86 binary content directly, rather than going through the intermediate step of generating an assembly file and running it through a proper assembler -- which chibicc now has!