11 ms·
Blink virtual machine now supports running GUI programs
- jenadine 4y agoBut this is not cross platform, right? It is specific to x11
- vidarh 4y agoI don't think there are any remotely mainstream platforms there isn't an x11 server for.
- jenadine 4y agoGood point. Blink could even ship with a X11 server. (Or Wayland compositor? To be more modern)
- deleted 4y ago[deleted]
- microtonal 4y agoXQuartz does not properly support HiDPI, so it's never going to be great on Macs anymore: https://github.com/XQuartz/XQuartz/issues/91 https://github.com/XQuartz/XQuartz/issues/91 Besides that, even Linux is slowly moving to Wayland.
- terhechte 4y agoWell, there is a Wayland Compositor for macOS: https://github.com/owl-compositor/owl https://github.com/owl-compositor/owl It still lacks a lot of features though (I think, I never tried it out)
- vidarh 4y agoMoving to Wayland does not prevent X11 apps. And I don't think anyone would expect this to be a good solution for crossplatform guis. More of a fun starting point.
- yjftsjthsd-h 4y agoWorst case, there's always http://www.jcraft.com/weirdx/ http://www.jcraft.com/weirdx/
- vidarh 4y agoThere's also xpra, which gets you a browser interface to X apps.
- gandalfff 4y agoCould this be ported to run on PowerPC Macs?
- jart 4y agoPowerPC is one of the 11 hardware architectures on which we regularly test Blink using Qemu https://github.com/jart/blink/blob/c8dbbc8cf553680ab48d8a3047b89ce07541630c/Makefile#L6 https://github.com/jart/blink/blob/c8dbbc8cf553680ab48d8a304... so my guess would be yes. However it depends on how old the Mac software is. Blink currently assumes modern POSIX system calls are available, e.g. fstatat(), O_CLOEXEC, etc. i.e. you currently need a host operating system published after ~2010ish. That could change in the future if we end up writing a ./configure script.
- buildbot 4y agoOne of those projects that is just so neat it engenders a desire to go do something fun with it! Maybe you build proton and have any windows game (or software?) in the browser?
- mati365 4y agoSo we invented Java again?
- deleted 4y ago[deleted]
- jart 4y agoAuthor of Blink here. Yes. Absolutely. I've always wanted to have Java's tools (e.g. "build once run anywhere" simplistic development) except I want to program in C / C++ instead of Java. The main platform I target is x86_64 desktops and servers, on which I want to run natively (rather than Java, which would force my code to always be virtualized) and Blink lets me pull out the virtual machine trick when I need it (e.g. someone wants to run the apps I've released on an esoteric platform like MIPS OpenBSD). All the x86_64 Linux executables I spent the past several years writing and releasing are suddenly able to be enjoyed by users on platforms I'd never dreamed of, like Haiku, and I didn't have to do anything to "port" and re-release those binaries on my website in order to do that. We just had to build one tiny 180kb virtual machine (unlike the JVM which is more like 100mb and might bundle a browser toolbar in the installer) and I made it open source (ISC, unlike Qemu which is GPL) so that you can enjoy these benefits too.
- actionfromafar 4y agoI still find it surreal that these operating systems share so many mechanisms that these portable EXEs are even possible. Someone should write some kind of historical explanation of how this could have happened. And how critical is it for the "APE" scheme to work? Could APE binaries work on AROS x86_64 for instance? (Without emulation.) I also find it surreal that it took this long for someone to do something like Actually Portable Executable. I mean, it's slick and easy to use, but I haven't even seem assembler demos of this. Is the same polyglot EXE possible also on 32-bit x86? If so, I find it even weirder this have not been done long ago, considering the strange hacks people have pulled over the years. I'm fascinated by the whole thing, as you can tell. Back in the day, Windows and Unix seemed so far from each other, like oil and water.
- chrismorgan 4y agoNote that this is not Blink the rendering engine that powers Chromium and related browsers, but https://github.com/jart/blink https://github.com/jart/blink, “a virtual machine that runs x86-64-linux programs on different operating systems and hardware architectures”. Where this talks of running GUI programs, I presume it means that the VM can act as an X client. You would thus still need an X server. I don’t know what may exist along those lines for the web. As for native/desktop hosts, well, I hope you weren’t ever trying to use emulation as any form of security, because the likes of Xorg really aren’t designed for that use case.
- eptcyka 4y agoIt runs the X server in the VM.
- Vogtinator 4y agoNot in this demo. It probably could though.
- csdvrx 4y agoThere's a X with sixel support: https://github.com/saitoha/xserver-sixel https://github.com/saitoha/xserver-sixel I played with this before, and I could use X11 within a mlterm terminal. I should try to recompile it with cosmopolitan to have a single X server binary both for Windows and Linux
- trenchgun 4y agoThat's amazing!
- csdvrx 4y agoAnd this is why I'm so interested in Sixel support for the Windows Terminal (https://github.com/microsoft/Terminal/issues/448 https://github.com/microsoft/Terminal/issues/448) With that and a X server using sixels, there would no longer be a need for something as complex as wslg for most apps: you could just export DISPLAY in your .bashrc, then use one Windows Terminal tab to start X apps, and the other one to display/interact with them.
- thatsadude 4y agoArt!
- dahfizz 4y agoIf this is what it takes to get developers to care about native code again, I'm all for it.
- snek_case 4y agoCould make a nice alternative to something like Electron...
- sebstefan 4y agoFrom the same author that did Cosmopolitan C and... Occupy Wall Street? Damn, I don't do enough things
- 2h 4y agohuh damn https://wikipedia.org/wiki/Occupy_Wall_Street#Origins https://wikipedia.org/wiki/Occupy_Wall_Street#Origins
- BoardsOfCanada 4y ago"In March 2014, Tunney petitioned the US government on We the People to hold a referendum asking for support to retire all government employees with full pensions, transfer administrative authority to the technology industry, and appoint the executive chairman of Google Eric Schmidt as CEO of America" So... at least you haven't done that :)
- cypherpunks01 4y agoJustine also wrote Rampage toolz 2.0, one of the early "AOL Progz" [1]. Can't quite remember which ones I used as a kid back then. She also claimed to have written hacks for Kevin Mitnick. Justine was somewhat controversial inside the Occupy movement, she was outside most circles and was criticized for extremely strongly-voiced technocratic opinions (see "Nerds Should be Segregated" [2], since deleted), but she's incredibly, incredibly talented. A good profile of Justine x Occupy post-mortem is here [3] [1] https://imgur.com/a/uSMr7 https://imgur.com/a/uSMr7 [2] https://web.archive.org/web/20141102140507/https://justinetunney.com/segregation.html https://web.archive.org/web/20141102140507/https://justinetu... [3] https://www.thenation.com/article/archive/breaking-occupy/ https://www.thenation.com/article/archive/breaking-occupy/
- deleted 4y ago[deleted]
- goerz 4y agoI always think these announcements are about https://blink.sh/ https://blink.sh/ I don’t know why it’s okay to steal product names like that.
- shadowgovt 4y agoTrademark protection is around market concerns, and in general, open source projects side-step questions of "market" by giving everything away for free. ... apart from that, it's a legit hard problem to name things. As in "One of the two recognized hardest problems in software engineering" (alongside cache management and off-by-one errors).
- Kiro 4y agoYeah, it sucks that Blink (the shell) stole it from Blink (the browser engine) that stole it from Blink (the SIP client) that stole it from...
- polyrand 4y agoI wonder if blink could be used as a lightweight sandbox. Looking at PR46[0], it seems sandboxing is not one of the current features, but it would be cool to have a way to run arbitrary code (e.g: Python) in a sandboxed environment. Even cooler if you could limit the amount of memory/CPU used. [0]: https://github.com/jart/blink/pull/46#pullrequestreview-1264664859 https://github.com/jart/blink/pull/46#pullrequestreview-1264...
- jart 4y agoAuthor of Blink here. I wrote another command called pledge.com which does sandboxing: https://justine.lol/pledge/ https://justine.lol/pledge/ Let's say for example you want to be able to run the `ls` command under Blink in a way that (1) restricts which parts of the file system it's allowed to use and (2) prevents it from talking to the Internet. You could say: ~/blink$ pledge.com -v/lib -v/bin/ls -v. -p 'stdio rpath tty prot_exec' o//blink/blink /bin/ls HTAGS LICENSE Makefile README.md TAGS blink build o test third_party tool You can now be certain that your `ls` command isn't spying on you or uploading your bitcoin wallet to the cloud. The blink command itself is currently unsecured. However that shouldn't matter, since we can compose blink with pledge.com to bolt on all the security we need separately!
- polyrand 4y agoAwesome! I was just reading about pledge. I think I need to find some time to play around with it. Right now, there's a lot of interest in using WASM as a sandbox for untrusted code, but pledge looks easier to use and more versatile (you don't need any kind of WASM compatibility, just a binary to run).
- jart 4y agoOffline WASM runtimes like Wasmtime are pretty cool, however I'd call SECCOMP BPF with Landlock LSM a shining beacon of light. The problem is that (1) coding BPF assembly has always been terrifying to the uninitiated and (2) Landlock LSM only came out in the past year. I believe pledge.com is the first tool that makes using both these Linux security tools together universally accessible for everyone. Be sure to run a bleeding edge Linux kernel if you use the `-v PATH` flag. If you're running an older kernel, then the pledge.com command will treat unveiling as a no-op in the interest of compatibility. I use Landlock LSM on my desktop, which runs Alpine Linux 5.15.74-0-lts. I also use Landlock in production on GCE, but I needed to `apt install linux-image-5.18.0-0.deb11.4-cloud-amd64` in order for it to work.
- hebash 4y agoI'm interested in using this for running x86 games on aarch64 Linux using Wine, do you think this would be useful as part of something like box64?
- septune 4y agoAre there any limitations in the linux binaries that can run in the VM ? (statically linked only ?)
- jart 4y agoBlink can run both static and dynamic binaries. There are of course caveats. See this section in the README: https://github.com/jart/blink#compiling-and-running-programs-under-blink https://github.com/jart/blink#compiling-and-running-programs...
- DarmokJalad1701 4y agoIs it possible to run Python on it? I guess network I/O is a limitation due to the browser environment?
- snek_case 4y agoFor dynamic libraries, does it mean a program running inside of blink can make calls to dynamic libraries installed on the host system? If so, cool!
- jart 4y agoIt depends what you mean. For example, I can run `blink curl ...` on Alpine Linux and blink will run the the dynamically linked curl binary that Alpine provides in /usr/bin/curl. So blink programs can leverage system libraries on x86_64 systems. What Blink does not do is translate dynamic ABIs. Here's what I mean by that. Let's say I write an x86_64-linux binary that calls dlopen(). It'll work on Linux. But if I scp that Linux program over to an Apple system, then it's not going to be able to dynamically open MachO .dylib files, because Blink only translates man(2) SYSCALL APIs. It would be able to dynamically load any Linux .so files I copied over though. Some of our users have experimented with this in cool ways. One contributor created a chroot'd folder in a Cygwin environment that contains an rsync'd Alpine Linux userspace (binaries, libraries, configs, and all) and then used blink to launch its /bin/bash shell. This astoundingly produced a mostly working Linux system inside Cygwin!
- deleted 4y ago[deleted]
- smcameron 4y agoIf someone is looking for some low hanging fruit in the way of contributing to cosmopolitan, they could teach its scanf()[1] family about floats[2]. (May not be as low-hanging as it first appears though, as converting floats correctly is trickier than it might first appear to be. The comments in the code say it can do floats, but the comments are mistaken.) [1] https://github.com/jart/cosmopolitan/blob/master/libc/fmt/vcscanf.c#L48 https://github.com/jart/cosmopolitan/blob/master/libc/fmt/vc... [2] https://github.com/jart/cosmopolitan/issues/456 https://github.com/jart/cosmopolitan/issues/456
- jart 4y agoIt'd be really nice to have a good scanf() function. Worth noting that we do have Google's outstanding double-conversion library in the cosmo codebase https://github.com/jart/cosmopolitan/tree/master/third_party/double-conversion https://github.com/jart/cosmopolitan/tree/master/third_party... as well as gdtoa (which is what we use for printf's floating point support) https://github.com/jart/cosmopolitan/tree/master/third_party/gdtoa https://github.com/jart/cosmopolitan/tree/master/third_party... but we simply haven't found the time yet to incorporate this stuff into scanf() so contributions are very much welcome.
- dang 4y agoRecent and related: A 116kb WASM of Blink that lets you run x86_64 Linux binaries in the browser - https://news.ycombinator.com/item?id=34367767 https://news.ycombinator.com/item?id=34367767 - Jan 2023 (69 comments) Emulating an emulator inside itself. Meet Blink - https://news.ycombinator.com/item?id=34250352 https://news.ycombinator.com/item?id=34250352 - Jan 2023 (107 comments)
- asicsp 4y agoFrom https://twitter.com/StriderMyshkin/status/1621418431575896064 https://twitter.com/StriderMyshkin/status/162141843157589606... >A pathway to a blazingly fast WSL?
- rcarmo 4y agoWSL2 is already “blazingly fast”, and WSL was no slouch either. They are both impacted by storage overhead, which makes that tweet look kind of misguided.
- olivermuty 4y agoAlso WASM is fast compared to javascript, slow compared to most other things.
- ohgodplsno 4y agoDepending on your benchmarks, WASM can be 5 times slower than C, or equally as fast (sometimes faster). https://programming-language-benchmarks.vercel.app/cpp-vs-wasm https://programming-language-benchmarks.vercel.app/cpp-vs-wa...
- thesz 4y agoWSL2 is not blazingly fast. I use Haskell for my ever continuing self-education and compiling and linking times with ghc under WSL2 is at least twice as slow as the same operations under native Linux on a much less capable machine. It is not just me, it is acknowledged WSL2 is very slow in I/O: https://www.phoronix.com/review/windows10-okt-wsl/2 https://www.phoronix.com/review/windows10-okt-wsl/2 I use WSL2 for reasons but I think I will be much better off with Linux.
- cercatrova 4y agoWSL2 with code inside the Linux file system? Because if you're doing Linux work on the Windows file system, it will be bad. It is at native speeds inside the Linux file system though.