Newbie - possible bug


#1

Hi,

I tried the example on here “https://reasonml.github.io/docs/en/installation” for compiling javascript and receive an error when running the ‘esy’ command. It appears to be a problem with linking OCaml with GCC.

/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: libcamlrund.a(backtrace_bd.o):/home/user/.esy/3/b/ocaml-4.8.1000-e74c5c0d/runtime/backtrace.c:31: multiple definition of `caml_debug_info'; libcamlruni.a(backtrace_bi.o):/home/user/.esy/3/b/ocaml-4.8.1000-e74c5c0d/runtime/backtrace.c:31: multiple definition of `caml_debug_info'; libcamlrund.a(backtrace_byt_bd.o):/home/user/.esy/3/b/ocaml-4.8.1000-e74c5c0d/runtime/backtrace_byt.c:47: first defined here
libcamlruni.a(backtrace_byt_bi.o):/home/user/.esy/3/b/ocaml-4.8.1000-e74c5c0d/runtime/backtrace_byt.c:47: first defined here
collect2: error: ld returned 1 exit status

I’ve had a search for the issue and thought it might be something to do with this “https://discuss.ocaml.org/t/cannot-install-ocaml-4-07-1-multiple-definition-of-caml-debug-info/5996”, but the discussion therein suggests it was fixed by 4.09.

I am using gcc (Gentoo 10.3.0 p1) 10.3.0

Please advise if I can usefully provide more information or if I have missed anything obvious.

For the hello world example it compiles and works fine and seems to use ocaml@4.10.0@d41d8cd9 rather than ocaml@4.8.1000, which might be the issue?

It sounds like it might be an OCaml bug rather than a Reason bug, but in any event, I thought worth flagging given it appears to affect the examples.


#2

It seems that ReasonML has been killed off by ReScript (https://rescript-lang.org/).

My understanding of Rescript is that compilation to OCaml and native has been sacrificed for compilation to JavaScript. In so doing the native target has been removed and the OCaml transient target has also been removed. I get this, as people need JavaScript and they want to use a better language to make it.

My target was always JavaScript rather than native, so on the one hand I’m happy with this change.

However, having watched videos of how ReasonML expressively deals with errors, I see that ReScripts’ errors are really opaque, unhelpful or wrong. (<–This moves this from a bug to an opinion piece)


#3

I think that’s a little vague. Maybe if you give a concrete example the ReScript folks can help or respond to that. In any case, long story short, @theveryreason to compile to JavaScript, use ReScript.


#4

Reason has not been killed off by Rescript in any way. People are using Reason syntax on the frontend still or coding in Reason and the converting to Rescript because Reason has all the tricks of OCaml 4.12.0 available to it. So you can do things like use (let.opt), compile it with melange-re/melange(https://github.com/melange-re/melange) and use it in your rescript files.

You might even want to use a ppx in rescript which you can do with ppx-install.

I threw is let.opt in rescript demo for you to checkout. letop-rescript.