{"id":13831045,"url":"https://github.com/mirage/ocaml-solo5","last_synced_at":"2025-04-05T05:07:32.126Z","repository":{"id":37927403,"uuid":"59661051","full_name":"mirage/ocaml-solo5","owner":"mirage","description":"Freestanding OCaml runtime","archived":false,"fork":false,"pushed_at":"2025-03-13T11:44:10.000Z","size":881,"stargazers_count":103,"open_issues_count":1,"forks_count":31,"subscribers_count":25,"default_branch":"main","last_synced_at":"2025-04-03T03:46:21.346Z","etag":null,"topics":["mirageos","ocaml"],"latest_commit_sha":null,"homepage":null,"language":"C","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/mirage.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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}},"created_at":"2016-05-25T12:23:44.000Z","updated_at":"2025-03-13T11:44:13.000Z","dependencies_parsed_at":"2024-04-23T12:08:28.936Z","dependency_job_id":"e7d965d9-2451-41e8-9e41-3b506adf6a8b","html_url":"https://github.com/mirage/ocaml-solo5","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirage%2Focaml-solo5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirage%2Focaml-solo5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirage%2Focaml-solo5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirage%2Focaml-solo5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mirage","download_url":"https://codeload.github.com/mirage/ocaml-solo5/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289428,"owners_count":20914464,"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":["mirageos","ocaml"],"created_at":"2024-08-04T10:01:16.260Z","updated_at":"2025-04-05T05:07:32.109Z","avatar_url":"https://github.com/mirage.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# ocaml-solo5 -- OCaml compiler with Solo5 backend\n\nThis package provides a OCaml compiler suitable for linking with a\nSolo5 base layer:\n\n- package versions ≥ 1.0 and the `main` branch are compatible with OCaml 5+\n  compilers, see the “[Supported compiler versions]” section for details,\n- package versions 0.8.x and the `4.14` branch are compatible with OCaml 4.14\n  compilers.\n\n[Supported compiler versions]: #supported-compiler-versions\n\n## License and contributions\n\nAll original contributions to this package are licensed under the standard MIT\nlicense.\n\nThis package incorporates components derived or copied from musl libc, OpenBSD,\nOpenLibm and other third parties. For full details of the licenses of these\nthird party components refer to the included LICENSE file.\n\nThe OCaml runtime (\"OCaml Core System\") built by this package is distributed\nunder the terms of the GNU LGPL version 2.1 with a special exception for static\nor dynamic linking to produce an executable file. For details refer to the\nLICENSE file included in the version of the `ocaml-src` OPAM package installed\non your system as a dependency when you build this package.\n\n## Components\n\nThe following components are built and installed, where `$prefix` and `$sysroot`\nare the values given to the corresponding `configure` arguments (ie the value of\n`opam var prefix` and `opam var \u003cpkg\u003e:lib` when installed via OPAM).\n\nIn `$prefix/bin`:\n\n- the toolchain to build binaries, using the `\u003carch\u003e-solo5-ocaml-` prefix.\n\n`$sysroot` will contain the installation of the OCaml compiler and the `nolibc`\nand OpenLibm support libraries.\n\nIn `$sysroot/bin`:\n- `ocamlopt.{opt,byte}`: a native OCaml compiler configured for the chosen\n  target.\n- Some other standard tools such as the `ocaml` interpreter and\n  `ocamlc.{byte,opt}` a bytecode OCaml compiler configured for the chosen\n  target. Please note that the bytecode runtime is not supported.\n\nIn `$sysroot/lib/ocaml`:\n- `libasmrun.a`: the OCaml native code runtime for the Solo5 target.\n- The standard library.\n- In `caml/`: Header files for the OCaml runtime.\n\nIn `$prefix/lib`:\n\n- `libnolibc.a`: libc interfaces required by the OCaml runtime.\n- `libopenlibm.a`: libm required by the OCaml runtime.\n\nIn `$sysroot/include`:\n\n- Header files for `nolibc` and OpenLibm.\n\nIn `$prefix/lib/findlib.conf.d`:\n\n- `solo5.conf`: ocamlfind definition of the cross-compilation toolchain.\n\n### Usage\n\nThe installed compiler is able to build Solo5 executables. The Solo5 bindings\n(xen, hvt, spt, ...) are chosen at link time, using the Solo5-specific\n`-z solo5-abi=XXX` compiler/linker option. Linking an executable with no\nbindings results in a _dummy_ executable.\n\nTo build with the Solo5 compiler toolchain, it has to be selected using\nocamlfind or dune:\n- ocamlfind: `ocamlfind -toolchain solo5 ...`\n- dune: `dune build -x solo5`, or add the toolchain in a build context\n  in the dune workspace file.\n\n#### Example\n\nThe `example` describes the minimal structure needed to build an ocaml-solo5\nexecutable with dune, linked with the hvt bindings by default. It requires an\napplication manifest and a startup file to initialize the libc.\n\n- Build: `dune build -x solo5`\n- Run: `solo5-hvt _build/solo5/main.exe`\n\n## Supported compiler versions\n\nTested against OCaml 5.3.0. Other versions would require specific patches (see\nthe `patches` directory).\n\n## Porting to a different (uni)kernel base layer\n\nAssuming your unikernel base layer is packaged for OPAM in a similar\nfashion to Solo5 this should be as simple as:\n\n1. Adding the appropriate clauses to determine the OPAM packages required\n   and `MAKECONF_CFLAGS` for compilation to `configure.sh`.\n2. Implementing a `nolibc/sysdeps_yourkernel.c`.\n\nNote that the nolibc code is intentionally strict about namespacing of APIs\nand header files. If your base layer exports symbols or defines types which\nconflict with nolibc then the recommended course of action is to fix your\nbase layer to not export anything defined by \"POSIX\" or \"standard C\".\n\n## Updating the vendored copy of OpenLibm\n\nOpenLibm is \"vendored\" into this repository using `git subtree`:\n\n    git subtree add --prefix openlibm https://github.com/JuliaLang/openlibm.git v0.5.4 --squash\n\nTo update the vendored copy of OpenLibm to the newer upstream version `TAG`,\nuse the following command _on a branch_ and then file a PR:\n\n    git subtree pull --prefix openlibm https://github.com/JuliaLang/openlibm.git TAG --squash\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirage%2Focaml-solo5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirage%2Focaml-solo5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirage%2Focaml-solo5/lists"}