{"id":13685794,"url":"https://github.com/tweag/clodl","last_synced_at":"2026-02-03T10:35:59.871Z","repository":{"id":48393744,"uuid":"80284606","full_name":"tweag/clodl","owner":"tweag","description":"Turn dynamically linked ELF binaries and libraries into self-contained closures.","archived":false,"fork":false,"pushed_at":"2024-06-19T08:26:19.000Z","size":230,"stargazers_count":174,"open_issues_count":13,"forks_count":6,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-04-25T14:59:47.936Z","etag":null,"topics":["elf","jar","jvm","native-binaries"],"latest_commit_sha":null,"homepage":"","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tweag.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-28T13:01:27.000Z","updated_at":"2025-04-11T02:37:57.000Z","dependencies_parsed_at":"2024-01-05T10:46:54.028Z","dependency_job_id":"472b9e84-3206-43b2-8f64-f8d807740f89","html_url":"https://github.com/tweag/clodl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tweag/clodl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweag%2Fclodl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweag%2Fclodl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweag%2Fclodl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweag%2Fclodl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tweag","download_url":"https://codeload.github.com/tweag/clodl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweag%2Fclodl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29041680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T10:09:22.136Z","status":"ssl_error","status_checked_at":"2026-02-03T10:09:16.814Z","response_time":96,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["elf","jar","jvm","native-binaries"],"created_at":"2024-08-02T14:00:57.428Z","updated_at":"2026-02-03T10:35:59.819Z","avatar_url":"https://github.com/tweag.png","language":"Starlark","funding_links":[],"categories":["Awesome Repositories","Starlark"],"sub_categories":["ELF binary format"],"readme":"# clodl: self-contained dynamic libraries\n\n[![Build](https://github.com/tweag/clodl/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/tweag/clodl/actions/workflows/build.yml)\n\n`clodl` computes the *closure* of a shared object. That is, given\nan executable or shared library, it returns a single self-contained\nfile packing all dependencies. Think of the result as a poor man's\ncontainer image. Compared to containers:\n\n* closures **do not** provide isolation (e.g. separate process,\n  network, filesystem namespaces),\n* but closures **do** allow for deploying to other machines without\n  concerns about missing dependencies.\n\nClodl can be used to build binary closures or library closures.\n\nA binary closure is made from an executable or a shared library\ndefining symbol `main` and can be executed. In practice, the binary\nclosure is a zip file appended to a script that uncompresses the file\nto a temporary folder and has `main` invoked.\n\nA library closure is a zip file containing the shared libraries in\nthe closure, and provides one or more top-level libraries which depends on all of\nthe others. When the closure is uncompressed, these top-level libraries\ncan be loaded into the address space of an existing process.\n\nExecuting a closure in the address space of an existing process\nenables lightweight high-speed interop between the closure and the\nrest of the process. The closure can natively invoke any function in\nthe process without marshalling/unmarshalling any arguments, and vice\nversa.\n\n## Example of binary closure\n\n`clodl` is implemented as a set\nof [Bazel][bazel] [build rules][bazel-rules]. It integrates with your\nBazel build system, e.g. as follows:\n\n```\ncc_binary(\n  name = \"hello-cc\",\n  srcs = [\"main.c\"],\n  deps = ...\n)\n\nbinary_closure(\n  name = \"hello-closure-bin\",\n  src = \"hello-cc\",\n)\n```\n\nWith Haskell:\n\n```\nhaskell_binary(\n    name = \"hello-hs\",\n    srcs = [\"src/test/haskell/hello/Main.hs\"],\n\t...\n)\n\nbinary_closure(\n  name = \"hello-closure-bin\",\n  src = \"hello-hs\",\n)\n```\n\nThe [test BUILD file](tests/BUILD) has complete examples.\n\n[bazel]: https://bazel.build\n[bazel-rules]: https://docs.bazel.build/versions/master/skylark/rules.html\n\n## Example of library closure\n\n`clodl` is useful for \"jarifying\" native binaries. Provided shim Java\ncode, closures can be packed inside a JAR and then loaded at runtime\ninto the JVM. This makes JAR's an alternative packaging format to\npublish and deploy native binaries.\n\n```\ncc_binary(\n  name = \"libhello.so\",\n  srcs = [\"main.c\"],\n  linkshared = 1,\n  deps = ...\n)\n\nlibrary_closure(\n  name = \"hello-closure\",\n  srcs = [\"libhello.so\"],\n)\n\njava_binary(\n  name = \"hello-jar\",\n  classpath_resources = [\":hello-closure\"],\n  main_class = ...,\n  srcs = ...,\n  runtime_deps = ...,\n)\n```\n\n## Importing clodl\n\nIn the `WORKSPACE` file:\n```\nhttp_archive(\n    name = \"io_tweag_clodl\",\n    sha256 = \"1181131b0fc111a1f16f0532605e9835e308ac5bc278b62f825adb0844ff7590\",\n    strip_prefix = \"clodl-0a7a2f93f4043a2db623f7d820578e3baea228d1\",\n    urls = [\"https://github.com/tweag/clodl/archive/0a7a2f93f4043a2db623f7d820578e3baea228d1.tar.gz\"],\n)\n\n...\n```\n\nIn `BUILD` files:\n```\nload(\n    \"@io_tweag_clodl//clodl:clodl.bzl\",\n    \"binary_closure\",\n    \"library_closure\",\n)\n\n...\n```\n\n## Building it\n\n**Requirements:**\n* The [Bazel][bazel] build tool;\n* the [Nix][nix] package manager;\n* in Linux, the `scanelf` tool from the `pax-utils` package and the `patchelf` tool;\n* in OSX, `otool` and `install_name_tool`.\n\nTo build and test:\n\n```\n$ bazel build //...\n$ (cd tests; bazel run hello-java)\n```\n\n[nix]: https://nixos.org/nix\n\n## License\n\nCopyright (c) 2015-2018 EURL Tweag.\n\nAll rights reserved.\n\nclodl is free software, and may be redistributed under the terms\nspecified in the [LICENSE](LICENSE) file.\n\n## About\n\nclodl is maintained by [Tweag I/O](http://tweag.io/).\n\nHave questions? Need help? Tweet at\n[@tweagio](http://twitter.com/tweagio).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftweag%2Fclodl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftweag%2Fclodl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftweag%2Fclodl/lists"}