Erlang 构建错误:未找到本机 ethread 实现

Posted

技术标签:

【中文标题】Erlang 构建错误:未找到本机 ethread 实现【英文标题】:Erlang build error: No native ethread implementation found 【发布时间】:2018-10-23 10:52:20 【问题描述】:

我已经安装了 VS Community 2013 x86 + Cygwin,并且我一直在按照说明构建 32 位版本的 erlang。

当我执行./opt_build boot -a 时,出现以下错误:

./include/internal/ethread.h:381:2: error: #error "未找到本机 ethread 实现。如果您想使用回退,您必须使用 configure 禁用本机 ethread 支持。" #error "未找到本机 ethread 实现。如果您想使用回退,您必须使用 configure 禁用本机 ethread 支持。"

有人见过这个错误吗?禁用 ethread 有什么影响?

更多日志:

Microsoft (R) Windows (R) Resource Compiler Version 6.3.9600.17336
Copyright (C) Microsoft Corporation.  All rights reserved.

 EMU_CC obj/win32/opt/smp/beam_emu.o
In file included from beam/erl_threads.h:265:0,
                 from beam/erl_smp.h:28,
                 from beam/sys.h:491,
                 from beam/beam_emu.c:26:
../include/internal/ethread.h:381:2: error: #error "No native ethread implementation found. If you want to use fallbacks you have to disable native ethread support with configure."
 #error "No native ethread implementation found. If you want to use fallbacks you have to disable native ethread support with configure."
  ^~~~~
In file included from beam/beam_load.h:25:0,
                 from beam/export.h:81,
                 from beam/global.h:33,
                 from beam/beam_emu.c:28:
beam/erl_process.h: In function 'erts_get_runq_proc':
beam/erl_process.h:2159:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return (ErtsRunQueue *) erts_atomic_read_nob(&p->run_queue);
            ^
In file included from beam/erl_process.h:2347:0,
                 from beam/beam_load.h:25,
                 from beam/export.h:81,
                 from beam/global.h:33,
                 from beam/beam_emu.c:28:
beam/erl_process_lock.h: In function 'erts_pix2proc':
beam/erl_process_lock.h:939:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     proc = (Process *) erts_ptab_pix2intptr_nob(&erts_proc, ix);
            ^
beam/erl_process_lock.h: In function 'erts_proc_lookup_raw':
beam/erl_process_lock.h:952:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     proc = (Process *) erts_ptab_pix2intptr_ddrb(&erts_proc,
            ^
In file included from beam/erl_port.h:30:0,
                 from beam/global.h:44,
                 from beam/beam_emu.c:28:
beam/erl_port_task.h: In function 'erts_port_task_handle_init':
beam/erl_port_task.h:154:36: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     erts_smp_atomic_init_nob(pthp, (erts_aint_t) NULL);
                                    ^
beam/erl_port_task.h: In function 'erts_port_task_is_scheduled':
beam/erl_port_task.h:160:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return ((void *) erts_smp_atomic_read_acqb(pthp)) != NULL;
             ^
In file included from beam/global.h:44:0,
                 from beam/beam_emu.c:28:
beam/erl_port.h: In function 'erts_port_runq':
beam/erl_port.h:221:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     rq1 = (ErtsRunQueue *) erts_smp_atomic_read_nob(&prt->run_queue);
           ^
beam/erl_port.h:226:8: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  rq2 = (ErtsRunQueue *) erts_smp_atomic_read_nob(&prt->run_queue);
        ^
beam/erl_port.h: In function 'erts_pix2port':
beam/erl_port.h:475:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     prt = (Port *) erts_ptab_pix2intptr_nob(&erts_port, ix);
           ^
beam/erl_port.h: In function 'erts_port_lookup_raw':
beam/erl_port.h:489:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     prt = (Port *) erts_ptab_pix2intptr_ddrb(&erts_port,
           ^
beam/erl_port.h: In function 'erts_id2port':
beam/erl_port.h:518:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     prt = (Port *) erts_ptab_pix2intptr_ddrb(&erts_port,
           ^
beam/erl_port.h: In function 'erts_id2port_sflgs':
beam/erl_port.h:552:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     prt = (Port *) erts_ptab_pix2intptr_ddrb(&erts_port,
           ^
beam/erl_port.h: In function 'erts_thr_id2port_sflgs':
beam/erl_port.h:611:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     prt = (Port *) erts_ptab_pix2intptr_ddrb(&erts_port,
           ^
beam/beam_emu.c: In function 'process_main':
beam/beam_emu.c:768:17: warning: right shift count >= width of type [-Wshift-count-overflow]
       if ((_res >> (8*sizeof(Uint))) != 0)  Fail;  \
                 ^
beam/beam_emu.c:4068:7: note: in expansion of macro 'BsSafeMul'
       BsSafeMul(Arg2, Unit, goto system_limit, tmp_arg1);
       ^~~~~~~~~
beam/beam_emu.c:768:17: warning: right shift count >= width of type [-Wshift-count-overflow]
       if ((_res >> (8*sizeof(Uint))) != 0)  Fail;  \
                 ^
beam/beam_emu.c:4129:3: note: in expansion of macro 'BsSafeMul'
   BsSafeMul(b, Unit, goto system_limit, c);
   ^~~~~~~~~
beam/beam_emu.c:768:17: warning: right shift count >= width of type [-Wshift-count-overflow]
       if ((_res >> (8*sizeof(Uint))) != 0)  Fail;  \
                 ^
beam/beam_emu.c:784:7: note: in expansion of macro 'BsSafeMul'
       BsSafeMul(_uint_size, Unit, Fail, Target); \
       ^~~~~~~~~
beam/beam_emu.c:4649:6: note: in expansion of macro 'BsGetFieldSize'
      BsGetFieldSize(tmp_arg2, (flags >> 3), ClauseFail(), size);
      ^~~~~~~~~~~~~~
beam/beam_emu.c:768:17: warning: right shift count >= width of type [-Wshift-count-overflow]
       if ((_res >> (8*sizeof(Uint))) != 0)  Fail;  \
                 ^
beam/beam_emu.c:784:7: note: in expansion of macro 'BsSafeMul'
       BsSafeMul(_uint_size, Unit, Fail, Target); \
       ^~~~~~~~~
beam/beam_emu.c:835:5: note: in expansion of macro 'BsGetFieldSize'
     BsGetFieldSize(Sz, ((Flags) >> 3), Fail, _size);  \
     ^~~~~~~~~~~~~~
win32/opt/smp/beam_cold.h:12:5: note: in expansion of macro 'BsGetBinary_2'
     BsGetBinary_2(r(0), Arg(1), targ1, Arg(3), dst, StoreResult, ClauseFail());
     ^~~~~~~~~~~~~
beam/beam_emu.c:768:17: warning: right shift count >= width of type [-Wshift-count-overflow]
       if ((_res >> (8*sizeof(Uint))) != 0)  Fail;  \
                 ^
beam/beam_emu.c:784:7: note: in expansion of macro 'BsSafeMul'
       BsSafeMul(_uint_size, Unit, Fail, Target); \
       ^~~~~~~~~
beam/beam_emu.c:835:5: note: in expansion of macro 'BsGetFieldSize'
     BsGetFieldSize(Sz, ((Flags) >> 3), Fail, _size);  \
     ^~~~~~~~~~~~~~
win32/opt/smp/beam_cold.h:22:5: note: in expansion of macro 'BsGetBinary_2'
     BsGetBinary_2(xb(Arg(1)), Arg(2), targ1, Arg(4), dst, StoreResult, ClauseFail());
     ^~~~~~~~~~~~~
beam/beam_emu.c:768:17: warning: right shift count >= width of type [-Wshift-count-overflow]
       if ((_res >> (8*sizeof(Uint))) != 0)  Fail;  \
                 ^
beam/beam_emu.c:784:7: note: in expansion of macro 'BsSafeMul'
       BsSafeMul(_uint_size, Unit, Fail, Target); \
       ^~~~~~~~~
beam/beam_emu.c:870:4: note: in expansion of macro 'BsGetFieldSize'
    BsGetFieldSize(Bits, Unit, Fail, _size);   \
    ^~~~~~~~~~~~~~
win32/opt/smp/beam_cold.h:86:5: note: in expansion of macro 'BsSkipBits2'
     BsSkipBits2(r(0), xb(Arg(1)), Arg(2), ClauseFail());
     ^~~~~~~~~~~
beam/beam_emu.c:768:17: warning: right shift count >= width of type [-Wshift-count-overflow]
       if ((_res >> (8*sizeof(Uint))) != 0)  Fail;  \
                 ^
beam/beam_emu.c:784:7: note: in expansion of macro 'BsSafeMul'
       BsSafeMul(_uint_size, Unit, Fail, Target); \
       ^~~~~~~~~
beam/beam_emu.c:870:4: note: in expansion of macro 'BsGetFieldSize'
    BsGetFieldSize(Bits, Unit, Fail, _size);   \
    ^~~~~~~~~~~~~~
win32/opt/smp/beam_cold.h:94:5: note: in expansion of macro 'BsSkipBits2'
     BsSkipBits2(r(0), yb(Arg(1)), Arg(2), ClauseFail());
     ^~~~~~~~~~~
beam/beam_emu.c:768:17: warning: right shift count >= width of type [-Wshift-count-overflow]
       if ((_res >> (8*sizeof(Uint))) != 0)  Fail;  \
                 ^
beam/beam_emu.c:784:7: note: in expansion of macro 'BsSafeMul'
       BsSafeMul(_uint_size, Unit, Fail, Target); \
       ^~~~~~~~~
beam/beam_emu.c:870:4: note: in expansion of macro 'BsGetFieldSize'
    BsGetFieldSize(Bits, Unit, Fail, _size);   \
    ^~~~~~~~~~~~~~
win32/opt/smp/beam_cold.h:102:5: note: in expansion of macro 'BsSkipBits2'
     BsSkipBits2(xb(Arg(1)), r(0), Arg(2), ClauseFail());
     ^~~~~~~~~~~
beam/beam_emu.c:768:17: warning: right shift count >= width of type [-Wshift-count-overflow]
       if ((_res >> (8*sizeof(Uint))) != 0)  Fail;  \
                 ^
beam/beam_emu.c:784:7: note: in expansion of macro 'BsSafeMul'
       BsSafeMul(_uint_size, Unit, Fail, Target); \
       ^~~~~~~~~
beam/beam_emu.c:870:4: note: in expansion of macro 'BsGetFieldSize'
    BsGetFieldSize(Bits, Unit, Fail, _size);   \
    ^~~~~~~~~~~~~~
win32/opt/smp/beam_cold.h:110:5: note: in expansion of macro 'BsSkipBits2'
     BsSkipBits2(xb(Arg(1)), xb(Arg(2)), Arg(3), ClauseFail());
     ^~~~~~~~~~~
beam/beam_emu.c:768:17: warning: right shift count >= width of type [-Wshift-count-overflow]
       if ((_res >> (8*sizeof(Uint))) != 0)  Fail;  \
                 ^
beam/beam_emu.c:784:7: note: in expansion of macro 'BsSafeMul'
       BsSafeMul(_uint_size, Unit, Fail, Target); \
       ^~~~~~~~~
beam/beam_emu.c:870:4: note: in expansion of macro 'BsGetFieldSize'
    BsGetFieldSize(Bits, Unit, Fail, _size);   \
    ^~~~~~~~~~~~~~
win32/opt/smp/beam_cold.h:118:5: note: in expansion of macro 'BsSkipBits2'
     BsSkipBits2(xb(Arg(1)), yb(Arg(2)), Arg(3), ClauseFail());
     ^~~~~~~~~~~
make[3]: *** [win32/Makefile:672: obj/win32/opt/smp/beam_emu.o] Error 1
make[3]: Leaving directory '/cygdrive/c/werl/otp_src_18.3/erts/emulator'
make[2]: *** [/cygdrive/c/werl/otp_src_18.3/make/run_make.mk:35: opt] Error 2
make[2]: Leaving directory '/cygdrive/c/werl/otp_src_18.3/erts/emulator'
make[1]: *** [Makefile:61: smp] Error 2
make[1]: Leaving directory '/cygdrive/c/werl/otp_src_18.3/erts'
make: *** [Makefile:444: emulator] Error 2

【问题讨论】:

要在 cygwin 上构建,您需要使用 cygwin 编译器。否则最好使用mingw工具。 根据official installation guide,我可以使用cygwin或mingw工具。尽管如此,这些工具只会编译一个文件。其他都是用Visual Studio编译的 【参考方案1】:

看起来我缺少一些 Cygwin 依赖项。我检查了来自 Devel 的所有内容,并删除了与 C 编译无关的所有内容。

【讨论】:

【参考方案2】:

您是否按照official installation guide 中的说明进行操作?

我想你已经安装了所有的 deps(我对 MinGW/MSYS 更熟悉,但它应该可以用 Cygwin 构建)。

请注意,您应该运行以下命令:

./otp_build env_win32 # x64 <- add this for 64bit build

【讨论】:

是的,我做了以下事情。我正在尝试以 32 位而不是 64 位构建 CouchDB。我在这里修改了他们的说明:github.com/popojargo/couchdb-glazier/blob/win32/INSTALL_32.md 从code,发生这种情况的唯一途径是如果变量ETHR_WIN32_THREADS 未定义。它应该在aclocal 的配置中定义 在配置步骤中,我看到了这个日志:checking for native win32 threads... yes 在我看来,它是构建过程中的一个错误。您可能应该填写错误报告。对不起,我不能帮助你更多:) 对于 Cygwin,您应该更喜欢使用 pthread。这是 Erlang 的配置过程应该检测到的。

以上是关于Erlang 构建错误:未找到本机 ethread 实现的主要内容,如果未能解决你的问题,请参考以下文章

什么是 API 19 中 OpenCV 的“未找到本机方法”错误?

未找到本机的实现

如何编译 Erlang 驱动程序?

erlang build OK 后,yaws 没有在 CentOS 上构建

“资源 android:attr/fontVariationSettings 未找到。”在本机反应

构建 riak:“rebar_core 中未捕获的错误”