Hacker News new | ask | show | jobs
by holsta 803 days ago

  if [ "$os" = "Darwin" ]; then
    arch="universal"
    os="macos"
  elif [ "$os" = "Linux" ]; then
    os="linux"
  else
    echo "Unsupported OS."
   exit 1
  fi
This is nothing to emulate.
2 comments

Why not? Does everything really need to be built in a cross platform way? I feel like that’s how we got into this mess.
Yes, bugs are often found by running the same code on similar but not identical platforms. We've had this conversation multiple times.

https://news.ycombinator.com/item?id=28978086

What mess are we in because of POSIX?

I’m talking about the mess of electron and friends. I’ve spoken to engineers who work on it. From their point of view, it’s the only sane way to build software that works across multiple operating systems.

The nice thing about windows and macOS back in the day was that the programs we ran were all written with the same native UI toolkit. All the controls matched between applications. Applications were small and efficient - binary sizes and memory usage were in the megabyte range. Any program written like that today starts up instantly, and is incredibly responsive.

But last I checked, Hello world in electron is ginormous. It uses about 100mb of memory. It takes time to start up. Vscode and Spotify are great but they don’t look or feel native. It is legitimately great that people now ship apps for Linux. But we’ve lost platform cohesion in the trade.

So, so what if tigerbeetle is written for Linux? I’m ok with the developers choosing not to pay the cross platform tax.

That's just the codepath from bootstrap.sh that downloads the binaries. I don't know if it will compile and run on, say, FreeBSD. It's quite possible no one tried.
I did, but there are literal compile-time checks for various platforms.

    pub fn monotonic(self: *Self) u64 {
        const m = blk: {
            if (is_windows) break :blk monotonic_windows();
            if (is_darwin) break :blk monotonic_darwin();
            if (is_linux) break :blk monotonic_linux();
            @compileError("unsupported OS");
        };
That genuinely seems platform-specific. Should be easy enough to write a patch to add support for $other_system.
According to the talk I watched, tigerbeetle makes heavy use of io_uring on linux - which isn't part of POSIX.

Adding freebsd support should be pretty easy. If it supports darwin, it'll probably already have an implementation built on top of freebsd's kqueue. Its probably just a case of wiring it up to use kqueue when built for freebsd.

Yes, that was my impression as well when I looked at it yesterday. The monotonic_linux() bit that's quoted is platform-specific because it uses CLOCK_BOOTTIME with clock_gettime(), but that seems supported on BSD systems as well. It's probably just that no one tried to run it, and no one spent any effort on it. I can't find a single mention of "BSD" in the issue tracker.
> I can't find a single mention of "BSD" in the issue tracker.

Sounds like this is something you can help with. If you care, open an issue.