Giter Site home page Giter Site logo

artagnon / rhine-ml Goto Github PK

View Code? Open in Web Editor NEW
630.0 53.0 25.0 2.1 MB

๐Ÿž an OCaml compiler for an untyped lisp

License: Other

OCaml 82.05% C 7.44% Shell 0.03% C++ 1.19% Python 5.85% Makefile 3.43%
programming-language ocaml llvm compiler

rhine-ml's Introduction

Rhine

Rhine is a Clojure-inspired Lisp on LLVM JIT featuring variable-length untyped arrays, first-class functions, closures, and macros. While Clojure hides the lower-level details by running atop the JVM, Rhine aims to expose how common Lisp constructs map to hardware.

Building

First, opam switch 4.02.1 to make sure that you're running a custom-built ocaml (for camlp4). First, run brew install libffi. Then, run opam install ocamlfind menhir core textutils ctypes, open a new shell to refresh env, and invoke make.

Troubleshooting the build

There are a number of reasons for the build failing:

  1. Silly things like git submdoule --init failing can be fixed easily; just anchor the submodule to a valid commit and send a PR.

  2. opam problems. If you run into one of these after following the instructions presented above, open an issue. An upstream update probably screwed something up.

  3. Silly build issues usually arise from the build not being perfectly parallel: due to races, the -j8 picks the dependee too earlier. Either go into llvm-build/ and keep hitting make -j8 until it succeeds, or drop the -j8 together, waiting for a longer time for a predictable result.

  4. Running into more serious build issues usually means that llvm upstream has changed in a trivial way; you can attempt to fix this yourself, or open an issue.

How it works

An untyped system means that all values are boxed/unboxed from a value_t structure at runtime:

%value_t = type {
	 i32,                                ; type of data
	 i64,                                ; integer
	 i1,                                 ; bool
	 i8*,                                ; string
	 %value_t**,                         ; array/fenv
	 i64,                                ; array/string length
	 double,                             ; double
	 %value_t* (i32, %value_t**, ...)*,  ; function
	 i8                                  ; char
}

The overhead of boxing/unboxing is paid by all dynamic languages, although multiple optimizations (including speculative optimization) can reduce the overhead. Rhine currently only implements the basic optimizations bundled with LLVM.

Rhine does automatic type conversions, so (+ 3 4.2) will do the right thing. To implement this, IR is generated to inspect the types of the operands (zeroth member of value_t), and a br (branch) is used to take the right codepath. A possible optimization is to generate a branchless codepath for all-integer arguments.

LLVM provides the array type and vector type. They cannot be used since they are fixed-length; i.e. the length must be known at compile-time. The problem is that a construct like (cons 8 coll) generates a runtime length which is equal to the (length coll) + 1. So, we malloc, getelementptr, and store by hand. It has the type specified by the fourth member of value_t.

To implement first-class functions, note that all functions must have the same type; i.e. the type of the function pointer (the seventh member of value_t). How else would you implement:

(defn map
  [f coll]
  (if coll
    (cons (f (first coll))
          (map f (rest coll)))
    []))

(defn map2
  [f c1 c2]
  (if (and c1 c2)
    (cons (f (first c1) (first c2))
          (map2 f (rest c1) (rest c2)))
    []))

Here, f takes one argument in map, but takes two arguments in map2. A function pointer type embracing variable arguments is implemented using the varargs framework of LLVM. Note that va_arg doesn't work on x86, so Rhine extracts the values by hand. The first argument gives the number of arguments, and is used to implement varargs in the Rhine language. The second argument is the closure environment (which has the same type as an array).

Closures are simple to implement with this framework in place. First, when a function is declared, parse out all the unbound variable names (not present in arguments or let), sort the names, put it in a hashtable for later reference, and codegen the code required to bind the names from the env argument in order. At the callsite, look up this hashtable, and pack all the corresponding environment variables into the env argument. So, stuff like this will work:

(defn quux [] (let [a aenv] (println a) (println env)))
(let [env 12 aenv 17] (quux))

But there's a problem because we have first-class functions. What happens to this?

(defn t [y] (+ x y))
(defn f [x] t)
(let [g (f 3)] (println (g 4)))

Here, the callsite for t is not in f, but in the anonymous function at the end. But the anonymous function doesn't have the environment variable x that t requires, f does. So, we have to augment function pointers with the environment (resuing the fourth argument of value_t).

It's important to realize that macros require that we go back-and-forth between LLVM values and the OCaml codegen engine. How else would you evaluate something like:

(defmacro baz [x]
  `[1 2 ~x])
(baz (+ 2 2))

Note that macro arguments must be passed unevaluated at the callsite. The maco-expand stage now needs to codegen [1 2 <something>], where that <something> itself needs to be codegen'ed by evaluating the argument: the result from the compiler must be returned as an AST object to OCaml. This requires some involved construction of OCaml objects from C.

Another subtle point to note is that macros must be lifted out of the program and macro-expanded at the beginning of the program. This is because we can't suddenly codegen segments required for macroexpansion in the middle of codegen'ing another function.

Todo

  • Lambdas. Requires lifting them out and codegen'ing them first.

  • Garbage collection. LLVM provides several garbage collection intrinsincs, but the main challenge is to make sure that the C bindings don't leak memory.

  • Custom optimizations.

  • Copy-on-write for persistent data structures, and persistent variables with setq. How do you access a variable's history?

  • FFI to C. It's simply a question of defining a good interface, because we already use malloc and memcpy internally in LLVM IR.

  • Self-hosting compiler. Necessary to co-develop the language and compiler.

  • Optional typesystem. Use the :- syntax to provide type safety and optimizations!

  • Concurrency primitives. See Clojure's core.async.

  • Support for programs spanning multiple files.

  • Polished error reporting with file:line annotations.

Notes

  • LLVM codegen statements all have side-effects. In most places, order in which variables are codegen'ed are unimportant, and lets can be moved around; but in conditionals, statements must be codegen'ed exactly in order: this means let statements can't be permuted, leading to imperative-style OCaml code.

  • Since LLVM IR is strongly typed, it is possible to inspect the types of llvales from OCaml at generation-time. However, there is no way for the codegen-stage to inspect the values of variables while the program is running. This has the consequence that a loop hinged upon an llvalue must be implemented in LLVM IR; hence, for functions that require iterating on variable-length arrays, we end up writing tedious LLVM IR generation code instead of an equivalent OCaml code.

  • Debugging errors from LLVM bindings is hard. Using ocamldebug does not work, since the callstack leading up to an LLVM call in C++ is not owned by OCaml. The alternative is to use lldb, but matching up the C++ call with a line in the OCaml code is non-trivial.

  • Implementing complex functions as builtins (by directly generating IR) is perhaps more efficient than implementing them in Rhine, but the gap is very small due to optimization passes applied on the Rhine-generated IR. The marginal benefit outweighs the cost of correctly weaving complex IR.

rhine-ml's People

Contributors

ahoy196 avatar artagnon avatar brennonyork avatar gudber avatar toroidal-code avatar utkarshkukreti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rhine-ml's Issues

Basic documentation for compiling a program to machine code

I have a file main.clj:

(defn main []
  (println "hello"))

I compiled it with

$ cat main.clj | ./rhine.native

And moved the output to main. Then I tried to compile that to .bc to with

$ llvm-as main -o main.bc

But I get

/usr/local/opt/llvm/bin/llvm-as: main:7:53: error: invalid indices for getelementptr
  %value = call i8* @malloc(i64 ptrtoint (%value_t* getelementptr (%value_t* null, i32 1) to i64))

How do you usually compile your code?

build error on ubuntu 14.04

I am not sure if this is a related issue. But I get the follow when I try to build rhine on ubuntu 14.04. I am only writing here since I could find no other better place to report.
.opam/system/lib/llvm/./dllllvm.so: undefined symbol: LLVMGetFirstUse
make: *** [rhine] Error 2

C bindings not working on Linux

Running tests yields LLVM Error: Program used external function '...' which could not be resolved.
Where the functions are things like println, cequ, print, etc.

Link errors on Linux

Different link errors have been reported on Linux:

Error: Error on dynamically loaded library: ~/.opam/system/lib/llvm/./dllllvm.so:
undefined symbol: LLVMGetFirstUse.
~/.opam/system/lib/llvm/./libLLVMScalarOpts.a(ScalarReplAggregates.o): In function
`tryToMakeAllocaBePromotable(llvm::AllocaInst*, llvm::DataLayout const*)':
ScalarReplAggregates.cpp:(.text+0xc67): undefined reference to `operator delete(void*)'

gh does not resolve to a valid hostname? possibly your .ssh/config has an entry for gh but not everybody does.. :)

sunil@Vostro-2520:~/clojure-projects/rhine$ make
git submodule update --init
Cloning into 'llvm'...
ssh: Could not resolve hostname gh: No address associated with hostname
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Clone of 'gh:llvm-mirror/llvm' into submodule path 'llvm' failed
make: *** [llvm/configure] Error 1

Better error reporting

This issue corresponds to an item on the current To-Do list in README.md.

From my experiences, there's going to be quite a bit going into this:

  • A location type, that contains information including, but not limited to:
    1. Current file
    2. Beginning of the location
    3. End of the location
  • An error type. The OCaml compiler uses exception, but this has the problem that only one error can be raised per parse. Keeping track of multiple errors and discarding malformed expressions (or even adding a node to the AST that notes an error) is more ideal.
  • Error recovery (some way of sanely handling errors, and continuing to lex/parse). In Kiln, I'm doing this via a Queue that contain errors in the Lexer/Parser modules , and ensuring that they are empty before proceeding to the next stage of compilation.
  • A way to pretty print errors. A suggested way to do this is with an open sum type in an Errors module. This leads to being able to handle both specific errors and more generic errors in same match statement

The OCaml compiler is a fantastic example for some of these things.
The work I'm doing in Kiln is also relevant.

Is there any design documentation/memory layout etc?

Specifically, do you envisage your stack as a fixed-size vector as Clojure, or as a linked list in heap space as in most other Lisp implementations? Do you intend to separate heapspace from cons space, and if so will vectors of cons-space float in the heap? Do you envisage a reference counting or a mark-and-sweep garbage collector?

Cheers!

Link warnings on OS X

On OS X, it produces a bunch of warnings while linking due to the inclusion of -rdynamic for Linux builds. While the warnings are harmless, it would be nice to squelch them.

+ /Users/artagnon/.opam/system/bin/ocamlfind ocamlc -ccopt -rdynamic -c bindings.c
clang: warning: argument unused during compilation: '-rdynamic'
+ /Users/artagnon/.opam/system/bin/ocamlfind ocamlopt -g -cc clang++ -ccopt -rdynamic -linkpkg -package llvm -package llvm.analysis -package llvm.executionengine -package llvm.scalar_opts -package llvm.target pretty.cmx codegen.cmx cookast.cmx parser.cmx lexer.cmx mlunbox.cmx toplevel.cmx rhine.cmx librhine_stubs.a -o rhine.native
ld: warning: could not create compact unwind for _camlCodegen__codegen_cmp_op_1368: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlCodegen__codegen_logical_op_1367: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlCodegen__codegen_arith_op_1366: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlCodegen__to_bool_1365: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlCodegen__to_int_1364: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlCodegen__to_dbl_1363: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlCodegen__codegen_atom_op_1 instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3233: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3235: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3237: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3239: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3241: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3243: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3245: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3247: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3249: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3251: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3253: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3255: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3257: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3259: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3261: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3263: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3265: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3267: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3269: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3271: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3273: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3275: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3277: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3279: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3281: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3283: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3285: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3287: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3289: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3291: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3293: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3295: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3297: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3299: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3301: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3303: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3305: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3307: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3309: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3311: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3313: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3315: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3317: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3319: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3321: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3323: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3325: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3327: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3329: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3331: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3333: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3335: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3337: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3339: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3341: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3343: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3345: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3347: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3349: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3351: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3353: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3355: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3357: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3359: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3361: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3363: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3365: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3367: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3369: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3371: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3373: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3375: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__iter_uses_1321: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_left_uses_1326: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_right_uses_1334: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__iter_global_range_1468: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__iter_globals_1473: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_left_global_range_1476: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_left_globals_1482: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__rev_iter_global_range_1486: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__rev_iter_globals_1491: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_right_global_range_1494: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_right_globals_1500: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__iter_function_range_1518: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__iter_functions_1523: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_left_function_range_1526: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_left_functions_1532: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__rev_iter_function_range_1536: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__rev_iter_functions_1541: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_right_function_range_1544: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_right_functions_1550: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__pack_attr_1557: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__unpack_attr_1561: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__add_function_attr_1570: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__remove_function_attr_1574: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__function_attr_1577: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__param_attr_1582: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__iter_param_range_1589: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__iter_params_1594: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_left_param_range_1597: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_left_params_1603: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__rev_iter_param_range_1607: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__rev_iter_params_1612: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_right_param_range_1615: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_right_params_1621: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__add_param_attr_1627: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__remove_param_attr_1630: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__iter_block_range_1651: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__iter_blocks_1656: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_left_block_range_1659: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_left_blocks_1665: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__rev_iter_block_range_1669: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__rev_iter_blocks_1674: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_right_block_range_1677: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_right_blocks_1683: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__iter_instrs_range_1694: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__iter_instrs_1699: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_left_instrs_range_1702: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_left_instrs_1708: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__rev_iter_instrs_range_1712: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__rev_iter_instrs_1717: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_right_instr_range_1720: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fold_right_instrs_1726: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__add_instruction_param_attr_1734: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__remove_instruction_param_attr_1738: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__builder_at_1753: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__builder_before_1757: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__builder_at_end_1760: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__position_before_1763: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__position_at_end_1765: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3504: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3502: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3500: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3498: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3496: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3518: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3516: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3514: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3512: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3510: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3508: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__fun_3506: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlLlvm__entry: stack subq instruction is too different from dwarf stack size
Finished, 32 targets (0 cached) in 00:00:01.

compilation issue

clang++ llvm-config --cxxflags -c -o rgc_printer.o rgc_printer.cc
ocamlfind ocamlc -g -w @5@8@10@11@12@14@23@24@26@29@40 -package llvm -package llvm.executionengine
-package llvm.analysis -package llvm.target -package llvm.scalar_opts
-package core -thread -package textutils -package bytes
-linkpkg location.cmo ast_helper.cmo parser.cmo lexer.cmo pretty.cmo cookast.cmo codegen.cmo mlunbox.cmo toplevel.cmo main.cmo bindings.o rgc.o rgc_printer.o -o rhine
rgc.o:(.data.rel.ro._ZTIN12_GLOBAL__N_13RgcE+0x10): undefined reference to typeinfo for llvm::GCStrategy' rgc_printer.o: In functionRgcPrinter':
/home/sunil/clojure-projects/rhine/rgc_printer.cc:12: undefined reference to llvm::GCMetadataPrinter::GCMetadataPrinter()' rgc_printer.o: In function~RgcPrinter':
/home/sunil/clojure-projects/rhine/rgc_printer.cc:12: undefined reference to llvm::GCMetadataPrinter::~GCMetadataPrinter()' rgc_printer.o:(.data.rel.ro._ZTVN12_GLOBAL__N_110RgcPrinterE+0x20): undefined reference tollvm::GCMetadataPrinter::~GCMetadataPrinter()'
rgc_printer.o:(.data.rel.ro._ZTIN12_GLOBAL__N_110RgcPrinterE+0x10): undefined reference to `typeinfo for llvm::GCMetadataPrinter'
collect2: error: ld returned 1 exit status
File "none", line 1:
Error: Error while building custom runtime system
make: *** [rhine] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.