tweag/clodl

Name: clodl

Owner: Tweag I/O

Description: Turn dynamically linked ELF binaries and libs into self-contained closures.

Created: 2017-01-28 13:01:27.0

Updated: 2018-05-22 15:27:56.0

Pushed: 2018-05-22 15:27:55.0

Homepage:

Size: 83

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

clodl: self-contained dynamic libraries

clodl computes the closure of a shared object. That is, given a shared library or a position independent executable (PIE), it returns a single, self-contained file packing all dependencies. Think of the result as a poor man's container image. Compared to containers:

Executing a closure in the address space of an existing process enables lightweight high-speed interop between the closure and the rest of the process. The closure can natively invoke any function in the process without marshalling/unmarshalling any arguments, and vice versa.

clodl is useful for “jarifying” native binaries. Provided shim Java code, closures can be packed inside a JAR and then loaded at runtime into the JVM. This makes JAR's an alternative packaging format to publish and deploy native binaries.

Example

clodl is implemented as a set of Bazel build rules. It integrates with your Bazel build system, e.g. as follows:

inary(
me = "hello.so",
cs = ["*.c"],
nkedshared = 1,


ary_closure(
me = "hello-closure",
cs = ["hello.so"],
stonly = True,


_binary(
me = "hello-jar",
sources = [":hello-closure"],
in_class = ...,
cs = ...,
ntime_deps = ...,

Building it

Requirements:

To build and test:

zel test //...
Usage

Any shared library (.so file) or position independent (dynamically linked) executable (PIE) can be “closed” using clodl.

On OS X, all executables are PIE.

To create a PIE on Linux and other platforms, pass the -pie flag to the compiler. For example with GCC,

c -pie ...

Some distributions create position independent executables by default (Ubuntu and Debian on some architectures).

License

Copyright (c) 2015-2018 EURL Tweag.

All rights reserved.

clodl is free software, and may be redistributed under the terms specified in the LICENSE file.

About

clodl is maintained by Tweag I/O.

Have questions? Need help? Tweet at @tweagio.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.