{"id":15401112,"url":"https://github.com/sunfishcode/origin-studio","last_synced_at":"2025-06-13T16:31:34.501Z","repository":{"id":190833458,"uuid":"683439325","full_name":"sunfishcode/origin-studio","owner":"sunfishcode","description":"An alternative `std`-like implementation built on origin","archived":false,"fork":false,"pushed_at":"2025-03-07T04:21:59.000Z","size":76,"stargazers_count":28,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-04T06:07:19.361Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunfishcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-26T15:24:25.000Z","updated_at":"2025-03-30T22:46:28.000Z","dependencies_parsed_at":"2025-01-17T11:09:55.703Z","dependency_job_id":"d2ae7360-3b67-48a6-969a-2c59c05a01c0","html_url":"https://github.com/sunfishcode/origin-studio","commit_stats":{"total_commits":72,"total_committers":1,"mean_commits":72.0,"dds":0.0,"last_synced_commit":"ba4bb789da8c765fbdcf6b852181aba464802f87"},"previous_names":["sunfishcode/origin-studio"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Forigin-studio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Forigin-studio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Forigin-studio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Forigin-studio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunfishcode","download_url":"https://codeload.github.com/sunfishcode/origin-studio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247773721,"owners_count":20993639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T15:56:30.934Z","updated_at":"2025-04-08T04:18:13.906Z","avatar_url":"https://github.com/sunfishcode.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eOrigin Studio\u003c/h1\u003e\n\n  \u003cp\u003e\n    \u003cstrong\u003eAn alternative `std`-like implementation built on Origin\u003c/strong\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/sunfishcode/origin-studio/actions?query=workflow%3ACI\"\u003e\u003cimg src=\"https://github.com/sunfishcode/origin-studio/workflows/CI/badge.svg\" alt=\"Github Actions CI Status\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://bytecodealliance.zulipchat.com/#narrow/stream/206238-general\"\u003e\u003cimg src=\"https://img.shields.io/badge/zulip-join_chat-brightgreen.svg\" alt=\"zulip chat\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/origin-studio\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/origin-studio.svg\" alt=\"crates.io page\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://docs.rs/origin-studio\"\u003e\u003cimg src=\"https://docs.rs/origin-studio/badge.svg\" alt=\"docs.rs docs\" /\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\nOrigin Stdio is an alternative [`std`]-like implementation built on [`origin`].\n\nAt this time, it only works on Linux (x86-64, aarch64, riscv64, 32-bit x86),\nrequires Rust nightly, lacks full `std` compatibility, and is overall\nexperimental. But it supports threads and stuff.\n\n## Quick start\n\nIn an empty directory, on Linux, with Rust nightly, run these commands:\n```sh\ncargo init\ncargo add origin_studio\necho 'fn main() { println!(\"cargo:rustc-link-arg=-nostartfiles\"); }' \u003e build.rs\nsed -i '1s/^/#![no_std]\\n#![no_main]\\norigin_studio::no_problem!();\\n\\n/' src/main.rs\ncargo run --quiet\n```\n\nThis will produce a crate and print \"Hello, world!\".\n\nYes, you might say, I could have already done that, with just the first and\nlast commands. But this version uses `origin` to start and stop the program,\nand [`rustix`] to do the printing.\n\nAnd beyond that, Origin Studio uses `origin` to start and stop threads,\n[`rustix-futex-sync`] and [`lock_api`] to do locking for threads,\n[`rustix-dlmalloc`] to do memory allocation, and [`unwinding`] to do stack\nunwinding, so it doesn't use libc at all.\n\n## What are those commands doing?\n\n\u003e cargo init\n\nThis creates a new Rust project containing a \"Hello, world!\" program.\n\n\u003e cargo add origin_studio\n\nThis adds a dependency on `origin_studio`, which is this crate.\n\n\u003e echo 'fn main() { println!(\"cargo:rustc-link-arg=-nostartfiles\"); }' \u003e build.rs\n\nThis creates a build.rs file that arranges for [`-nostartfiles`] to be passed\nto the link command, which disables the use of libc's `crt1.o` and other startup\nobject files. This allows origin to define its own symbol named `_start` which\nserves as the program entrypoint, and handle the entire process of starting the\nprogram itself.\n\n[`-nostartfiles`]: https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-nostartfiles\n\n\u003e sed -i '1s/^/#![no_std]\\n#![no_main]\\norigin_studio::no_problem!();\\n\\n/' src/main.rs\n\nThis inserts three lines to the top of src/main.rs:\n - `#![no_std]`, which disables the use of Rust's standard library\n   implementation, since Origin Studio provides its own implementation that\n   using rustix and origin.\n - `#![no_main]`, which tells Rust to disable its code that calls the user's\n   `main` function, since Origin Studio will be handling that.\n - `origin_studio::no_problem!()` inserts code to set up a Rust panic handler,\n   and optionally a global allocator (with the \"alloc\" feature).\n\n\u003e cargo run --quiet\n\nThis runs the program, which will be started by origin, prints \"Hello, world!\"\nusing Origin Studio's `println!` macro, which uses Origin Studio's\n`std::io::stdout()` and `std::io::Write` and `rustix-futex-sync`'s `Mutex` to\ndo the locking, and `rustix` to do the actual I/O system call, and ends the\nprogram, using origin.\n\n[rustix-futex-sync]: https://github.com/sunfishcode/rustix-futex-sync#readme\n\n## Similar crates\n\nOther alternative implementations of std include [steed], [tiny-std] and\n[veneer].\n\n[Mustang] and [Eyra] are crates that use origin to build a libc implementation\nthat can slide underneath existing std builds, rather than having their own std\nimplementations.\n\n[relibc] also includes a Rust implementation of program and thread startup and\nshutdown.\n\n## Why?\n\nRight now, this is a demo of how to use `origin`. If you're interested in\nseeing this grow into something specific, or interested in seeing projects\nwhich might be inspired by this, please reach out!\n\n[`std`]: https://doc.rust-lang.org/stable/std/\n[`origin`]: https://github.com/sunfishcode/origin#readme\n[`rustix`]: https://github.com/bytecodealliance/rustix#readme\n[`rustix-futex-sync`]: https://docs.rs/rustix-futex-sync/latest/rustix_futex_sync/\n[`rustix-dlmalloc`]: https://docs.rs/rustix-dlmalloc/latest/rustix_dlmalloc/\n[`lock_api`]: https://docs.rs/lock_api/latest/lock_api/\n[`unwinding`]: https://docs.rs/unwinding/latest/unwinding/\n[steed]: https://github.com/japaric/steed\n[tiny-std]: https://github.com/MarcusGrass/tiny-std\n[veneer]: https://crates.io/crates/veneer\n[Mustang]: https://github.com/sunfishcode/mustang#readme\n[Eyra]: https://github.com/sunfishcode/eyra#readme\n[relibc]: https://gitlab.redox-os.org/redox-os/relibc/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Forigin-studio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunfishcode%2Forigin-studio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Forigin-studio/lists"}