trifork / erjang

A JVM-based Erlang VM
http://www.erjang.org
Apache License 2.0
726 stars 62 forks source link

Undefined: prim_file:internal_name2native/1 #45

Closed sivieri closed 13 years ago

sivieri commented 13 years ago

Hi,

I have just compiled Erjang, against Sun Java 1.6.0 and Erlang R14B01, on Ubuntu 10.10 64bit, but when I launch ej, it crashes with the following stack [1]. Any idea?

[1] http://pastebin.com/mmLSLMYb

krestenkrab commented 13 years ago

Yep, the issue is simply that the named built-in function is missing.

If you want to help, figure out what it is supposed to do, and go implement something like this: (I only have web-access right now, so this is a rough guess at the details... you can find inspiration for how to code it in other erjang.m.*.Native classes)

file: src/main/java/erjang/m/prim_file/Native.java


public class Native extends erjang.ENative {

@BIF public static EObject internal_name2native(EObject arg) { ... }

}

sivieri commented 13 years ago

I'm trying to do, but I'm still trying to find out where is located that function (which is called from prim_file.erl, but its definition is not in that file)...

sivieri commented 13 years ago

Hi,

I have implemented a basic version of the two functions (which you can find in my branch), and they seem to behave as their C counterparts do, at least they seem to return the same values as them. But the erjang shell still does not boot, and after some prints in the original erlang code, I have found out that name2native, when invoked from the erlang shell, receives as input different paths, while when invoked from the erjang one, it receives the same path appended to the preceeding invocation.

Any thoughts about this?

sivieri commented 13 years ago

By the way: sorry if I am writing on a closed issue, but I have closed it by accident and I don't know how to reopen it...

eriksoe commented 13 years ago

I tried booting with R14B01, and there appears to be a different wrt. how the efile driver communicates with prim_file (cf. translate_response/2: what used to be an OK-with-data is now given a separate tag ?FILE_RESP_ALL_DATA).

krestenkrab commented 13 years ago

It looks like this may be the commit that broke our efile driver: https://github.com/erlang/otp/commit/63eeba2f6829aac2644eaf212ebef9cdf4b59e8d

Should be simple enough to fix in EFile then, but we need a strategy for handling different versions of erts in a driver so Erjang works for both 5.7.x and 5.8.x versions of erts; for now, maybe we can just do erjang.Main.erts_version.startsWith("5.7.") // or "5.8."

jetztgradnet commented 13 years ago

I got Erjang to work with R14B01. See pull request 56.

krestenkrab commented 13 years ago

Super, thanks.