<div dir="ltr">ok; so it seems because I have the ERL_LIBS pointing to a large directory of erlang libs that was taking precedence; if I run with `ERL_LIBS=./lib:$ERL_LIBS erl ...` then it works; thanks<div><br></div><div>then here is a question about ERL_LIBS by the way:</div><div>I am reading docs and code about current implementation, through #L85 "<span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(248,238,199)">[</span><span class="inbox-inbox-pl-s" style="box-sizing:border-box;color:rgb(24,54,145);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre"><span class="inbox-inbox-pl-pds" style="box-sizing:border-box">"</span>.<span class="inbox-inbox-pl-pds" style="box-sizing:border-box">"</span></span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(248,238,199)">] </span><span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">++</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(248,238,199)"> </span><span class="inbox-inbox-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">UserLibPaths</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(248,238,199)"> </span><span class="inbox-inbox-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">++</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(248,238,199)"> </span><span class="inbox-inbox-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">Paths</span><span style="color:rgb(36,41,46);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(248,238,199)">;</span>" it seems the code loading precedence is</div><div>current dir "." >> all "*/ebin" from ERL_LIBS >> the "lib/*/ebin" from current ERL installation dir;</div><div>1. <a href="http://erlang.org/doc/man/code.html">http://erlang.org/doc/man/code.html</a><br></div><div>2. <a href="https://github.com/erlang/otp/blob/master/lib/kernel/src/code_server.erl#L85-L86">https://github.com/erlang/otp/blob/master/lib/kernel/src/code_server.erl#L85-L86</a></div><div>I wonder should this be revised? to take ERL installation dir's "lib/*/ebin" precedence before extra ERL_LIBS ? or can we bring in another EXTRA_ERL_LIBS environment variable to be lookup after the "lib/*/ebin" from current ERL installation dir?</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, May 5, 2017 at 11:38 PM Björn Gustavsson <<a href="mailto:bjorn@erlang.org">bjorn@erlang.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The line numbers in the stacktrace don't make any sense.<br>
For example, line 213 is a comment, not executable code<br>
in commit 9ac8bdb.<br>
<br>
Therefore I suspect that you somewhere have an older<br>
version of beam_asm.beam that is somehow found<br>
instead of the correct one.<br>
<br>
You can use beam_asm:module_info(md5) to compute<br>
the MD5 and compare it with my output below.<br>
You could also try code:which(beam_asm) and make<br>
sure that the path is correct.<br>
<br>
$ bin/erl +pc unicode<br>
Erlang/OTP 20 [RELEASE CANDIDATE 1] [erts-9.0] [source-9ac8bdb19f]<br>
[64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe]<br>
[kernel-poll:false]<br>
<br>
Eshell V9.0  (abort with ^G)<br>
1> c(hello).<br>
{ok,hello}<br>
2> hello:main([]).<br>
{'hello_юникод',<<"Hello, 世界; юникод"/utf8>>,"Hello, 世界; юникод"}<br>
{"Hello, 世界, юникод"}<br>
ok<br>
3> beam_asm:module_info(md5).<br>
<<159,89,125,255,14,214,31,228,207,196,247,228,180,227,92,<br>
  181>><br>
<br>
/Björn<br>
<br>
<br>
On Sat, May 6, 2017 at 3:47 AM, derek <<a href="mailto:denc716@gmail.com" target="_blank">denc716@gmail.com</a>> wrote:<br>
> No; I built this from current `master@9ac8bdb`, it seems nothing changed,<br>
> either erlc or c() from erlang shell still doesn't compile<br>
> it prompts error in line 213 of beam_asm.erl, but line 213 of this file<br>
> doesn't have call to list_to_binary; as I read, it seems on #L245, the<br>
> list_to_binary doesn't work with this list string<br>
> `[16,104,101,108,108,111,95,1102,1085,1080,1082,1086,1076,95,19990,30028,44],`<br>
> because this string has chars (>255), it needs unicode:characters_to_binary<br>
> can work<br>
> <a href="https://github.com/erlang/otp/blob/master/lib/compiler/src/beam_asm.erl#L245" rel="noreferrer" target="_blank">https://github.com/erlang/otp/blob/master/lib/compiler/src/beam_asm.erl#L245</a><br>
><br>
> Erlang/OTP 20 [RELEASE CANDIDATE 1] [erts-9.0] [source-9ac8bdb] [64-bit]<br>
> [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]<br>
><br>
> Eshell V9.0  (abort with ^G)<br>
> 1> c(hello).<br>
> hello.erl: internal error in beam_asm;<br>
> crash reason: badarg<br>
><br>
>   in function  list_to_binary/1<br>
>      called as list_to_binary([[5,104,101,108,108,111],<br>
>   [4,109,97,105,110],<br>
>   [2,105,111],<br>
>   [7,115,101,116,111,112,116,115],<br>
>   [6,102,111,114,109,97,116],<br>
><br>
> [16,104,101,108,108,111,95,1102,1085,1080,1082,1086,1076,95,19990,30028,44],<br>
>   "\vmodule_info",<br>
>   [6,101,114,108,97,110,103],<br>
>   [15,103,101,116,95,109,111,100,117,108,101,95,105,110,102,111]])<br>
>   in call from beam_asm:chunk/3 (beam_asm.erl, line 213)<br>
>   in call from beam_asm:build_file/8 (beam_asm.erl, line 97)<br>
>   in call from beam_asm:module/4 (beam_asm.erl, line 31)<br>
>   in call from compile:beam_asm/1 (compile.erl, line 1370)<br>
>   in call from compile:'-internal_comp/4-anonymous-1-'/2 (compile.erl, line<br>
> 329)<br>
>   in call from compile:fold_comp/3 (compile.erl, line 355)<br>
>   in call from compile:internal_comp/4 (compile.erl, line 339)<br>
> error<br>
> 2><br>
> list_to_binary([16,104,101,108,108,111,95,1102,1085,1080,1082,1086,1076,95,19990,30028,44]).<br>
> ** exception error: bad argument<br>
>      in function  list_to_binary/1<br>
>         called as<br>
> list_to_binary([16,104,101,108,108,111,95,1102,1085,1080,1082,1086,1076,<br>
>                                   95,19990,30028,44])<br>
> 3><br>
> unicode:characters_to_binary([16,104,101,108,108,111,95,1102,1085,1080,1082,1086,1076,95,19990,30028,44]).<br>
> <<16,104,101,108,108,111,95,209,142,208,189,208,184,208,<br>
>   186,208,190,208,180,95,228,184,150,231,149,140,44>><br>
><br>
><br>
><br>
> On Fri, May 5, 2017 at 5:35 AM José Valim <<a href="mailto:jose.valim@plataformatec.com.br" target="_blank">jose.valim@plataformatec.com.br</a>><br>
> wrote:<br>
>><br>
>> I have ran the following on Erlang master, commit ffa80a4137:<br>
>><br>
>> $ curl<br>
>> <a href="https://gist.githubusercontent.com/anonymous/2e8babd349167a49eb6f6d55ec0505c9/raw/cee893bbcd1e9ade6e145c7f66b8599ab9dd6959/hello.erl" rel="noreferrer" target="_blank">https://gist.githubusercontent.com/anonymous/2e8babd349167a49eb6f6d55ec0505c9/raw/cee893bbcd1e9ade6e145c7f66b8599ab9dd6959/hello.erl</a><br>
>> | tail -n +2 > hello.erl<br>
>> $ erlc hello.erl<br>
>><br>
>> And everything compiles just fine. Hopefully someone else can give it a<br>
>> try and let us know if they can reproduce the issue or not.<br>
>><br>
>><br>
>><br>
>><br>
>> José Valim<br>
>> <a href="http://www.plataformatec.com.br" rel="noreferrer" target="_blank">www.plataformatec.com.br</a><br>
>> Skype: jv.ptec<br>
>> Founder and Director of R&D<br>
>><br>
>> On Thu, May 4, 2017 at 11:23 PM, derek <<a href="mailto:denc716@gmail.com" target="_blank">denc716@gmail.com</a>> wrote:<br>
>>><br>
>>> like this gist?<br>
>>> <a href="https://gist.github.com/anonymous/2e8babd349167a49eb6f6d55ec0505c9" rel="noreferrer" target="_blank">https://gist.github.com/anonymous/2e8babd349167a49eb6f6d55ec0505c9</a><br>
>>><br>
>>> On Thu, May 4, 2017 at 3:36 AM José Valim<br>
>>> <<a href="mailto:jose.valim@plataformatec.com.br" target="_blank">jose.valim@plataformatec.com.br</a>> wrote:<br>
>>>><br>
>>>> I have rebuilt Erlang from master and both the test and the code snippet<br>
>>>> you sent by e-mail works. In order to discard any encoding issue in the<br>
>>>> process, can you please push your code snippets to a repository?<br>
>>>><br>
>>>><br>
>>>><br>
>>>> José Valim<br>
>>>> <a href="http://www.plataformatec.com.br" rel="noreferrer" target="_blank">www.plataformatec.com.br</a><br>
>>>> Skype: jv.ptec<br>
>>>> Founder and Director of R&D<br>
>>>><br>
>>>> On Thu, May 4, 2017 at 8:04 AM, José Valim<br>
>>>> <<a href="mailto:jose.valim@plataformatec.com.br" target="_blank">jose.valim@plataformatec.com.br</a>> wrote:<br>
>>>>><br>
>>>>> Hi derek,<br>
>>>>><br>
>>>>> I have sent a PR that improves the coverage around this feature:<br>
>>>>> <a href="https://github.com/erlang/otp/pull/1439" rel="noreferrer" target="_blank">https://github.com/erlang/otp/pull/1439</a><br>
>>>>><br>
>>>>> The test currently passes on an old master reference. I will rebuild my<br>
>>>>> development VM from master and follow up.<br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>> José Valim<br>
>>>>> <a href="http://www.plataformatec.com.br" rel="noreferrer" target="_blank">www.plataformatec.com.br</a><br>
>>>>> Skype: jv.ptec<br>
>>>>> Founder and Director of R&D<br>
>>>>><br>
>>>>> On Thu, May 4, 2017 at 1:11 AM, derek <<a href="mailto:denc716@gmail.com" target="_blank">denc716@gmail.com</a>> wrote:<br>
>>>>>><br>
>>>>>><br>
>>>>>> I found this feature from some of the merged PRs of Erlang/OTP 20<br>
>>>>>><br>
>>>>>><br>
>>>>>> <a href="https://github.com/erlang/otp/blob/master/lib/stdlib/doc/src/unicode_usage.xml#L66-L71" rel="noreferrer" target="_blank">https://github.com/erlang/otp/blob/master/lib/stdlib/doc/src/unicode_usage.xml#L66-L71</a><br>
>>>>>> <a href="https://github.com/erlang/otp/pulls?q=unicode" rel="noreferrer" target="_blank">https://github.com/erlang/otp/pulls?q=unicode</a><br>
>>>>>><br>
>>>>>> > Erlang/OTP 20.0, atoms and function can contain Unicode characters<br>
>>>>>><br>
>>>>>> so I built the binary from git checked out source code (from revision<br>
>>>>>> efcb91bce) and play with it: it seems in escript interpreting mode it works,<br>
>>>>>> but compiling mode still has errors:<br>
>>>>>><br>
>>>>>> ➸ cat ./hello.erl<br>
>>>>>> #!/usr/bin/env escript<br>
>>>>>> %% -*- coding: utf-8 -*-<br>
>>>>>> %%! +pc unicode<br>
>>>>>><br>
>>>>>> -module(hello).<br>
>>>>>> %-mode(compile).<br>
>>>>>> -export([main/1, 'hello_юникод_世界'/0]).<br>
>>>>>><br>
>>>>>> main(_) -><br>
>>>>>>   % io:format("~p~n", [{io:printable_range(), io:getopts()}]),<br>
>>>>>>   % 'hello_'(),<br>
>>>>>>   io:setopts([{encoding,unicode}]),<br>
>>>>>>   % io:format("~p~n", [{io:printable_range(), io:getopts()}]),<br>
>>>>>>   'hello_юникод_世界'(),<br>
>>>>>>   io:format("~tp~n", [{"Hello, 世界, юникод"}]).<br>
>>>>>><br>
>>>>>> 'hello_юникод_世界'() -><br>
>>>>>>   io:format("~tp~n", [{'hello_юникод', <<"Hello, 世界; юникод"/utf8>>,<br>
>>>>>> "Hello, 世界; юникод"}]).<br>
>>>>>><br>
>>>>>> ➸ erlang20 ./hello.erl<br>
>>>>>> {'hello_юникод',<<"Hello, 世界; юникод"/utf8>>,"Hello, 世界; юникод"}<br>
>>>>>> {"Hello, 世界, юникод"}<br>
>>>>>><br>
>>>>>> If I uncomment the "-mode(compile)." line, it just runs into<br>
>>>>>> compilation error (same as below shell compilation errors)<br>
>>>>>><br>
>>>>>> Or in the Erlang shell, trying to compile it just failed: (I have to<br>
>>>>>> remove (or comment out) the first "#!/usr/bin/env escript" line)<br>
>>>>>><br>
>>>>>> ➸ erlang20<br>
>>>>>> Erlang/OTP 20 [DEVELOPMENT] [erts-9.0] [source-efcb91bce] [64-bit]<br>
>>>>>> [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]<br>
>>>>>><br>
>>>>>> Eshell V9.0  (abort with ^G)<br>
>>>>>> 1> c(hello).<br>
>>>>>> hello.erl: internal error in beam_asm;<br>
>>>>>> crash reason: badarg<br>
>>>>>><br>
>>>>>>   in function  list_to_binary/1<br>
>>>>>>      called as list_to_binary([[5,104,101,108,108,111],<br>
>>>>>>   [4,109,97,105,110],<br>
>>>>>>   [2,105,111],<br>
>>>>>>   [7,115,101,116,111,112,116,115],<br>
>>>>>>   [6,102,111,114,109,97,116],<br>
>>>>>><br>
>>>>>> [15,104,101,108,108,111,95,1102,1085,1080,1082,1086,1076,95,19990,30028],<br>
>>>>>>   "\vmodule_info",<br>
>>>>>>   [6,101,114,108,97,110,103],<br>
>>>>>>   [15,103,101,116,95,109,111,100,117,108,101,95,105,110,102,111]])<br>
>>>>>>   in call from beam_asm:chunk/3 (beam_asm.erl, line 213)<br>
>>>>>>   in call from beam_asm:build_file/8 (beam_asm.erl, line 97)<br>
>>>>>>   in call from beam_asm:module/4 (beam_asm.erl, line 31)<br>
>>>>>>   in call from compile:beam_asm/1 (compile.erl, line 1370)<br>
>>>>>>   in call from compile:'-internal_comp/4-anonymous-1-'/2 (compile.erl,<br>
>>>>>> line 329)<br>
>>>>>>   in call from compile:fold_comp/3 (compile.erl, line 355)<br>
>>>>>>   in call from compile:internal_comp/4 (compile.erl, line 339)<br>
>>>>>> error<br>
>>>>>> 2><br>
>>>>>><br>
>>>>>> I have looked up in many of the commit messages, still not seeing a<br>
>>>>>> good example of how to use unicode in function names? Could some developer<br>
>>>>>> behind this feature give more examples?<br>
>>>>>><br>
>>>>>> <a href="https://github.com/erlang/otp/blame/master/lib/stdlib/doc/src/unicode_usage.xml#L66-L71" rel="noreferrer" target="_blank">https://github.com/erlang/otp/blame/master/lib/stdlib/doc/src/unicode_usage.xml#L66-L71</a><br>
>>>>>><br>
>>>>>> _______________________________________________<br>
>>>>>> erlang-questions mailing list<br>
>>>>>> <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
>>>>>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
>>>>>><br>
>>>>><br>
>>>><br>
>><br>
><br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
<br>
<br>
<br>
--<br>
Björn Gustavsson, Erlang/OTP, Ericsson AB<br>
</blockquote></div>