{"id":27606889,"url":"https://github.com/extendr/hellorustc","last_synced_at":"2026-03-07T11:04:27.341Z","repository":{"id":263467339,"uuid":"890471403","full_name":"extendr/hellorustc","owner":"extendr","description":"Integration of `rustc` with R's package building system","archived":false,"fork":false,"pushed_at":"2025-11-25T19:53:19.000Z","size":2756,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-11T11:45:58.549Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/extendr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-18T16:15:42.000Z","updated_at":"2025-11-25T19:53:23.000Z","dependencies_parsed_at":"2025-03-03T03:45:12.637Z","dependency_job_id":"f39537ed-0833-47ff-949d-935b4be0c3f3","html_url":"https://github.com/extendr/hellorustc","commit_stats":null,"previous_names":["cgmossa/hellorustc","extendr/hellorustc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/extendr/hellorustc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extendr%2Fhellorustc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extendr%2Fhellorustc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extendr%2Fhellorustc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extendr%2Fhellorustc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/extendr","download_url":"https://codeload.github.com/extendr/hellorustc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extendr%2Fhellorustc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30212103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T09:02:10.694Z","status":"ssl_error","status_checked_at":"2026-03-07T09:02:08.429Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-04-22T21:46:38.678Z","updated_at":"2026-03-07T11:04:27.291Z","avatar_url":"https://github.com/extendr.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `hellorustc`\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/CGMossa/hellorustc/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/CGMossa/hellorustc/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\nThis repository is a prototype for using `rustc` as a friendly compiler with R packages.\n\nEssentially, there is an R build-system, which mainly consists of `make`, `clang`/`gcc`, and occasionally someone speaks of `autoconf`. On the other hand, Rust's build system is `cargo`. For now, people have tried to unify `cargo` with R's build system. This repository aims to join `rustc` and R's build system, instead.\n\nUltimately, the aim is to find a better way to work with R, Rust, `cargo`, and how to properly customize R-packages, such that they may build multiple native languages, not just single ones.\n\nOne goal here is to not use any C-files at all in this project, and simply lean on `rustc` for generating necessary C-ABI boilerplate. This is a contrived restriction, and may be abandoned later.\n\nCurrently, the [`src/Makevars`](./src/Makevars) currently builds *any* single Rust source file `.rs` as its own individual file, and links that to the R-package.\n\n- [ ] One has to add the rust-file to the list of files in `OBJECTS` in `Makevars`. If there is a ~~kewl~~ makefile way to glob select files to do that, please let me know. For now, one also has to link the object `.o` together with the `.rs` file in the `Makevars` file. But invoking `rustc` is done for you.\n\nThis R package generates bindings for R's C-API on its own and stores it in the package itself. How to include these files is shown in [`src/hello.rs`](./src/hello.rs) and [`src/rust_add.rs`](./src/rust_add.rs).\n\nA major pre-requisite is to have `bindgen` installed, i.e.\n\n```sh\ncargo install bindgen-cli --force\n```\n\nAnd to use `bindgen`, one needs to install and configure `clang`. On a Mac, this is already setup.\n\n## Learnings\n\nThis was done as a means to learn more about _what_ variables are available for us\nin `Makevars`, and how they could be used to accomplish various things.\n\nAnother is to learn about the inner workings of `cargo`, through investigating what it\ntakes to make `rustc` produce the right artefact. I would not recommend this experience in \"production\".\n\nAlso, note that the way rust crates are linked here is not the usual `staticlib` way that is seen in extendr, savvy, roxido, etc.\n\n`_rust_eh_personality` is missing. This is a sentence that comes up often. The issue is\nthat Rust has a `std`, with which _exception handling (`eh`)_ is implemented. This\nmeans if you use elaborate unwinding in your `rustc`, you'd somehow have to link or\nbuild `std`.\n\n- [ ] Find a way to link to Rust's exception handling / unwinding. For now `-Cpanic=abort`, i.e. the C-way. This means that `extern \"C\"` is the only supported ABI, and that `C-unwind` cannot be supported by only calling `rustc`.\n\n## Acknowledgements\n\nThe name `hellorustc` is inspired by the [`hellorust`](https://github.com/r-rust/hellorust).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextendr%2Fhellorustc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fextendr%2Fhellorustc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextendr%2Fhellorustc/lists"}