无法在Windows问题上编译FAST_TL

发布于 2025-02-13 20:10:17 字数 18247 浏览 0 评论 0原文

我不确定上一篇文章是否已经涵盖了这一点。我正在关注一个博客,以构建用于凤凰的眩晕服务器,并引用了openssl标头引起的问题。

https:///github.com/github.com/processone/ejabberd/ejabberd/ejabberd/esuececomment/1107#issuecomment/1107#issuecomment- 217828211

我相信这个解决方案Mac OS X操作系统。我试图重现Windows 10机器上的安装,但是我遇到了问题。 This was working on a downloaded package:

https://github.com/processone/fast_tls

I unzipped and运行bash仿真器(通过右键单击快速TLS-Master文件夹并单击GIT,请使用git bash在这里,我还从巧克力中下载了一个

制作

程序

$ export LDFLAGS="-LC:/msys64/mingw64/lib"
$ export CFLAGS="-IC:/msys64/mingw64/include/"
$ export CPPFLAGS="-IC:/msys64/mingw64/include/"

$ ./configure && make

checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether make sets $(MAKE)... yes
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for ANSI C header files... (cached) yes
checking for erl... /c/Program Files/erl-24.3.4.2/bin/
erl
checking for erlc... /c/Program Files/erl-24.3.4.2/bin/erlc
checking for SSL_free in -lssl... yes
checking for SHA1_Init in -lcrypto... yes
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... yes
checking for openssl/ssl.h... yes
checking openssl/err.h usability... yes
checking openssl/err.h presence... yes
checking for openssl/err.h... yes
checking openssl/sha.h usability... yes
checking openssl/sha.h presence... yes
checking for openssl/sha.h... yes
checking openssl/opensslv.h usability... yes
checking openssl/opensslv.h presence... yes
checking for openssl/opensslv.h... yes
configure: creating ./config.status
config.status: creating vars.config
rebar get-deps compile
process_begin: CreateProcess(NULL, rebar 
get-deps compile, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:6: src] Error 2

。 〜/下载/fast_tls-master/fast_tls-master

我还指出,在config.log文件中产生了

conftest.c:9:10: fatal error: ac_nonexistent.h: 
No such file or directory
    9 | #include <ac_nonexistent.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
configure:2991: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "tls"
| #define PACKAGE_TARNAME "tls"
| #define PACKAGE_VERSION "1.0.10"
| #define PACKAGE_STRING "tls 1.0.10"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| #include <ac_nonexistent.h>

错误 安装不起作用。

{cflags, "-IC:/msys64/mingw64/include/ -Wall"}.
{ldflags, "-LC:/msys64/mingw64/lib"}.
{with_gcov, "false"}.

%% Local Variables:
%% mode: erlang
%% End:
%% vim: set filetype=erlang tabstop=8:

不知道这有多相关,但是很明显, 可能无法做到吗

我想知道

在Windows机器上

? .MIX目录。过去,我在构建Phoenix Elixir Web应用程序时遇到了它,并在不关注它的情况下进行即时安装它 - 在进一步搜索时,我看到它是Erlang应用程序所需的构建工具。我更新了我的env vars和re -ran,但是可惜它使我回到了我试图避免的东西 - 以前我在称为fast_tls的依赖项上运行了elixir mix compile命令 - 当时,混合钢筋命令然后开始了Microsoft Visual Studio构建工具,称为Cl.exe,反过来又运行了MSVC C ++编译器,并且在那里我已经遇到了一个完整的块。本质上是告诉我:“您的fast_tls.c程序或您的mingw64包括文件(例如stdio.h,stdlib.h)有错误(引用各种MSVC代码错误,例如C2143,C2059,C2059,C2085,C4668,C4668,C4820)。纠正然后重新提交您的程序。”在Futher Google上,我可以看到以前的编译器问题的事件 - 由于MSVC编译器严格遵守各种类型/宏观/类调用惯例和签名的性质。我绝不是C ++专家,现在对如何继续前进感到非常迷失。因此,我询问其他人是否有经验,以及他们如何继续前进。也许有一种方法可以避免使用cl.exe作为Windows?

要重新盖帽,这是我尝试编译fast_tls的两种方法:

方法1)混合编译

contents of mix.exs:

defp deps do
  [
    ...
    {:fast_tls, "~> 1.1.15"},
    # {:stun, "~> 1.0"}
  ]

C:\Users\Paul\Desktop\phoenix\els_umbrella>set LDFLAGS="-LC:/msys64/mingw64/lib"
C:\Users\Paul\Desktop\phoenix\els_umbrella>set CPPFLAGS="-IC:\msys64\mingw64\include"
C:\Users\Paul\Desktop\phoenix\els_umbrella>set CFLAGS="-IC:\msys64\mingw64\include"

C:\Users\Paul\Desktop\phoenix\els_umbrella>mix compile
===> Compiling c:/Users/Paul/Desktop/phoenix/els_umbrella/deps/fast_tls/c_src/fast_tls.c
===> Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31332 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9002 : ignoring unknown option '-g'
fast_tls.c
C:\msys64\mingw64\include\_mingw_mac.h(215): warning C4668: '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\msys64\mingw64\include\_mingw_mac.h(306): warning C4668: '_FORTIFY_SOURCE' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\msys64\mingw64\include\stdio.h(39): warning C4820: '_iobuf': '4' bytes padding added after data member '_cnt'
C:\msys64\mingw64\include\stdio.h(577): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(584): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(590): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(851): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(881): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1235): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1242): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1248): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1364): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1374): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\swprintf.inl(27): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\swprintf.inl(34): error C2059: syntax error: 'type'
c:\Program Files\erl-24.3.4.2\erts-12.3.2.2\include\erl_drv_nif.h(40): warning C4820: '<unnamed-tag>': '4' bytes padding added after data member 'dirty_scheduler_support'
c:\Program Files\erl-24.3.4.2\erts-12.3.2.2\include\erl_drv_nif.h(156): warning C4820: '_SysIOVec': '4' bytes padding added after data member 'iov_len'
C:\msys64\mingw64\include\stdlib.h(389): error C2085: '_exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(389): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(396): error C2085: '_Exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(396): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(399): error C2085: '_Exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(399): error C2143: syntax error: missing ';' before '{'
C:\msys64\mingw64\include\stdlib.h(399): warning C4013: '_exit' undefined; assuming extern returning int
C:\msys64\mingw64\include\stdlib.h(399): error C2065: 'status': undeclared identifier
C:\msys64\mingw64\include\stdlib.h(405): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdlib.h(683): error C2491: '_beep': definition of dllimport function not allowed
C:\msys64\mingw64\include\stdlib.h(685): error C2085: '_seterrormode': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(685): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(686): error C2085: '_sleep': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(686): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(707): error C2085: 'ecvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(708): error C2085: 'fcvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(709): error C2085: 'gcvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(710): error C2085: 'itoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(711): error C2085: 'ltoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(712): error C2085: 'putenv': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(716): error C2085: 'swab': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(719): error C2085: 'ultoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(720): error C2085: 'onexit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(726): error C2085: 'lldiv_t': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(728): error C2061: syntax error: identifier 'lldiv_t'
C:\msys64\mingw64\include\stdlib.h(732): error C2169: 'llabs': intrinsic function, cannot be defined
C:\msys64\mingw64\include\malloc.h(50): warning C4820: '_heapinfo': '4' bytes padding added after data member '_useflag'
C:\msys64\mingw64\include\malloc.h(82): fatal error C1083: Cannot open include file: 'mm_malloc.h': No such file or directory

** (Mix) Could not compile dependency :fast_tls, "escript.exe "c:/Users/Paul/.mix/rebar3" bare compile --paths c:/Users/Paul/Desktop/phoenix/els_umbrella/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile fast_tls", update it with "mix deps.update fast_tls" or clean it with "mix deps.clean fast_tls"

方法2)在fast_tls_master上运行bash仿真器:

Paul@paul-pc03 MINGW64 ~/Downloads/fast_tls-master/fast_tls-master
$ export LDFLAGS="-LC:/msys64/mingw64/lib"

$ export CFLAGS="-IC:/msys64/mingw64/include/"

$ export CPPFLAGS="-IC:/msys64/mingw64/include/"

Paul@paul-pc03 MINGW64 ~/Downloads/fast_tls-master/fast_tls-master
$ ./configure && make
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether make sets $(MAKE)... yes
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for ANSI C header files... (cached) yes
checking for erl... /c/Program Files/erl-24.3.4.2/bin/erl
checking for erlc... /c/Program Files/erl-24.3.4.2/bin/erlc
checking for SSL_free in -lssl... yes
checking for SHA1_Init in -lcrypto... yes
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... yes
checking for openssl/ssl.h... yes
checking openssl/err.h usability... yes
checking openssl/err.h presence... yes
checking for openssl/err.h... yes
checking openssl/sha.h usability... yes
checking openssl/sha.h presence... yes
checking for openssl/sha.h... yes
checking openssl/opensslv.h usability... yes
checking openssl/opensslv.h presence... yes
checking for openssl/opensslv.h... yes
configure: creating ./config.status
config.status: creating vars.config
C:\Users\Paul\.mix\rebar get-deps compile
==> p1_utils (get-deps)
==> fast_tls-master (get-deps)
==> p1_utils (compile)
==> fast_tls-master (compile)
Compiling c_src/fast_tls.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31332 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

fast_tls.c
C:\msys64\mingw64\include\_mingw_mac.h(215): warning C4668: '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\msys64\mingw64\include\_mingw_mac.h(306): warning C4668: '_FORTIFY_SOURCE' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\msys64\mingw64\include\stdio.h(39): warning C4820: '_iobuf': '4' bytes padding added after data member '_cnt'
C:\msys64\mingw64\include\stdio.h(577): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(584): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(590): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(851): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(881): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1235): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1242): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1248): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1364): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1374): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\swprintf.inl(27): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\swprintf.inl(34): error C2059: syntax error: 'type'
c:\Program Files\erl-24.3.4.2\erts-12.3.2.2\include\erl_drv_nif.h(40): warning C4820: '<unnamed-tag>': '4' bytes padding added after data member 'dirty_scheduler_support'
c:\Program Files\erl-24.3.4.2\erts-12.3.2.2\include\erl_drv_nif.h(156): warning C4820: '_SysIOVec': '4' bytes padding added after data member 'iov_len'
C:\msys64\mingw64\include\stdlib.h(389): error C2085: '_exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(389): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(396): error C2085: '_Exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(396): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(399): error C2085: '_Exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(399): error C2143: syntax error: missing ';' before '{'
C:\msys64\mingw64\include\stdlib.h(399): warning C4013: '_exit' undefined; assuming extern returning int
C:\msys64\mingw64\include\stdlib.h(399): error C2065: 'status': undeclared identifier
C:\msys64\mingw64\include\stdlib.h(405): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdlib.h(683): error C2491: '_beep': definition of dllimport function not allowed
C:\msys64\mingw64\include\stdlib.h(685): error C2085: '_seterrormode': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(685): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(686): error C2085: '_sleep': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(686): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(707): error C2085: 'ecvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(708): error C2085: 'fcvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(709): error C2085: 'gcvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(710): error C2085: 'itoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(711): error C2085: 'ltoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(712): error C2085: 'putenv': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(716): error C2085: 'swab': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(719): error C2085: 'ultoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(720): error C2085: 'onexit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(726): error C2085: 'lldiv_t': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(728): error C2061: syntax error: identifier 'lldiv_t'
C:\msys64\mingw64\include\malloc.h(50): warning C4820: '_heapinfo': '4' bytes padding added after data member '_useflag'
C:\msys64\mingw64\include\malloc.h(82): fatal error C1083: Cannot open include file: 'mm_malloc.h': No such file or directory
ERROR: compile failed while processing c:/Users/Paul/Downloads/fast_tls-master/fast_tls-master: rebar_abort
make: *** [Makefile:6: src] Error 1

Paul@paul-pc03 MINGW64 ~/Downloads/fast_tls-master/fast_tls-master

我已经安装了Microsoft Visual Studio Community Edition 2020,以及CL.EXE的System Env路径程序是:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x64;

经过一些对话后:ProcessOne/ejabberd,我们尝试在Fast_TLS上运行Windows 10 Mix。

Windows 10 Mix Compile中的问题似乎是在获取某个“ PC v1.14.0” - 由P1_UTILS和FAST_TLS调用 - 我们被告知PC是POR_COMPILER,用于编译C代码,用于编译C代码,包括几个Ejabberd依赖性,包括C代码,所有快速_*。

当我们编译fast_tls时,我们将使用默认的Visual Studio CL.EXE批量脚本倾倒,该脚本显然不了解参数中传递的任何一个,而是写下“ vc140.pdb(程序调试文件)。我们也看到了这一点。没有文件写入fast_tl中的C_SRC子目录(通常在编译阶段中写出的对象文件等)。 OUT - 假设一个尝试产生Erlang Beam文件和配置

。确实,文件写入C_SRC子目录(.o和.D文件),并且_EBIN文件夹已更新,似乎已正确配置了ERLANG BEAM文件和配置

。 而不是针对fast_tls的WSL,该命令也取得了成功,没有采取进一步的行动。我们可以看到,保留了FAST_TLS文件夹中的所有文件,并且没有时间戳更新。 _ebin文件夹不是 更新并保持完整。我们无法确认它们是否实际上是可用的 - 因为它们是由WSL Linux而不是Windows编写的,但是我们可以使用Mix deps.get和依赖关系在Windows中安装眩晕依赖关系(需要Fast_tls)似乎没有错误安装。

但是,对于如何使Windows版本像Linux版本一样,我们完全迷失了方向。

我们已经检查了钢筋配置 - 这些似乎是无法编辑的文件 - 以及所有环境变量 - 但是我们无法看到如何告诉Windows版本像Linux One这样的fast_tls-大概是调用PC端口编译器我们没有运行默认的MSCV编译器...我们没有管理Erlang配置的经验,而是可以在Elixir Mix中处理它,但这是我们知识的限制。也许有一些示例有关如何在Microsoft Windows上使用port_compiler。随着我们现在处于终结状态,任何想法都将受到极大的欢迎!

现在可以关闭此问题。已提供了修复程序: https://github.com/processone/stun/stun/stun/stun/stun/sissues/37 < /a> 非常感谢ProcessOne的所有人!

I'm not sure if this has already been covered in a previous post. I was following along to a blog on building a stun server for Phoenix and reference was made to an issue due to openssl headers.

https://github.com/processone/ejabberd/issues/1107#issuecomment-217828211

This covered I believe solutions for Mac OS x operating system. I tried to reproduce the installation on a Windows 10 machine, however I have run into problems. This was working on a downloaded package:

https://github.com/processone/fast_tls

I unzipped and ran a bash emulator (git bash by right-clicking the fast-tls-master folder and clicking on Git Bash Here. I also downloaded a make program from Chocolatety.

This is the output when I followed along to the instructions in the README:

Paul@paul-pc03 MINGW64 ~/Downloads/fast_tls-master/fast_tls-master

$ export LDFLAGS="-LC:/msys64/mingw64/lib"
$ export CFLAGS="-IC:/msys64/mingw64/include/"
$ export CPPFLAGS="-IC:/msys64/mingw64/include/"

$ ./configure && make

checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether make sets $(MAKE)... yes
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for ANSI C header files... (cached) yes
checking for erl... /c/Program Files/erl-24.3.4.2/bin/
erl
checking for erlc... /c/Program Files/erl-24.3.4.2/bin/erlc
checking for SSL_free in -lssl... yes
checking for SHA1_Init in -lcrypto... yes
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... yes
checking for openssl/ssl.h... yes
checking openssl/err.h usability... yes
checking openssl/err.h presence... yes
checking for openssl/err.h... yes
checking openssl/sha.h usability... yes
checking openssl/sha.h presence... yes
checking for openssl/sha.h... yes
checking openssl/opensslv.h usability... yes
checking openssl/opensslv.h presence... yes
checking for openssl/opensslv.h... yes
configure: creating ./config.status
config.status: creating vars.config
rebar get-deps compile
process_begin: CreateProcess(NULL, rebar 
get-deps compile, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:6: src] Error 2

Paul@paul-pc03 MINGW64 ~/Downloads/fast_tls-master/fast_tls-master

I also noted that errors were produced in a config.log file.

conftest.c:9:10: fatal error: ac_nonexistent.h: 
No such file or directory
    9 | #include <ac_nonexistent.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
configure:2991: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "tls"
| #define PACKAGE_TARNAME "tls"
| #define PACKAGE_VERSION "1.0.10"
| #define PACKAGE_STRING "tls 1.0.10"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| #include <ac_nonexistent.h>

I've no idea how relevant this is, but it is clear that the install didn't work. There was some sparse output in a vars.config file:

{cflags, "-IC:/msys64/mingw64/include/ -Wall"}.
{ldflags, "-LC:/msys64/mingw64/lib"}.
{with_gcov, "false"}.

%% Local Variables:
%% mode: erlang
%% End:
%% vim: set filetype=erlang tabstop=8:

Well, if anyone has any ideas on how to proceed, it would be very much welcomed. I'm wondering whether this may not be possible on a Windows machine?

Best regards,

Paul.

MadScientist: You are quite correct!! Thank you. Yes, after looking at my system I can see that it is indeed installed in my Windows user .mix directory. I have come across it in the past while building Phoenix Elixir web apps, installing it on-the-fly without paying much attention to it - on googling it further I see that it is a build tool necessary for Erlang apps. I updated my env vars and re-ran, but alas it brought me back to the very thing I was trying to avoid - previously I ran an Elixir mix compile command on a dependency called fast_tls - on that occasion the mix rebar commands then kicked off a Microsoft Visual Studio build tool called cl.exe that in turn ran a MSVC c++ compiler, and it is there that I have run into a complete block. Essentially it's telling me: "your fast_tls.c program or your mingw64 include files (eg stdio.h, stdlib.h) have errors (referencing various MSVC code errors, for example C2143, C2059, C2085, C4668, C4820). Correct them and then re-submit your program." On futher googling I can see previous occurrences of exactly the same compiler issues - due to the nature of the MSVC compiler's strict adherence to various type/macro/class calling conventions and signatures. I am by no means a C++ expert and now feel quite lost on how to move on with this. For this reason I am asking if anyone else has had experience of this, and how they managed to move on. Maybe there is a way to avoid using cl.exe for Windows?

To re-cap, here are the 2 ways I tried to compile fast_tls:

Method 1) mix compile

contents of mix.exs:

defp deps do
  [
    ...
    {:fast_tls, "~> 1.1.15"},
    # {:stun, "~> 1.0"}
  ]

C:\Users\Paul\Desktop\phoenix\els_umbrella>set LDFLAGS="-LC:/msys64/mingw64/lib"
C:\Users\Paul\Desktop\phoenix\els_umbrella>set CPPFLAGS="-IC:\msys64\mingw64\include"
C:\Users\Paul\Desktop\phoenix\els_umbrella>set CFLAGS="-IC:\msys64\mingw64\include"

C:\Users\Paul\Desktop\phoenix\els_umbrella>mix compile
===> Compiling c:/Users/Paul/Desktop/phoenix/els_umbrella/deps/fast_tls/c_src/fast_tls.c
===> Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31332 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9002 : ignoring unknown option '-g'
fast_tls.c
C:\msys64\mingw64\include\_mingw_mac.h(215): warning C4668: '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\msys64\mingw64\include\_mingw_mac.h(306): warning C4668: '_FORTIFY_SOURCE' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\msys64\mingw64\include\stdio.h(39): warning C4820: '_iobuf': '4' bytes padding added after data member '_cnt'
C:\msys64\mingw64\include\stdio.h(577): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(584): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(590): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(851): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(881): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1235): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1242): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1248): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1364): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1374): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\swprintf.inl(27): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\swprintf.inl(34): error C2059: syntax error: 'type'
c:\Program Files\erl-24.3.4.2\erts-12.3.2.2\include\erl_drv_nif.h(40): warning C4820: '<unnamed-tag>': '4' bytes padding added after data member 'dirty_scheduler_support'
c:\Program Files\erl-24.3.4.2\erts-12.3.2.2\include\erl_drv_nif.h(156): warning C4820: '_SysIOVec': '4' bytes padding added after data member 'iov_len'
C:\msys64\mingw64\include\stdlib.h(389): error C2085: '_exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(389): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(396): error C2085: '_Exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(396): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(399): error C2085: '_Exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(399): error C2143: syntax error: missing ';' before '{'
C:\msys64\mingw64\include\stdlib.h(399): warning C4013: '_exit' undefined; assuming extern returning int
C:\msys64\mingw64\include\stdlib.h(399): error C2065: 'status': undeclared identifier
C:\msys64\mingw64\include\stdlib.h(405): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdlib.h(683): error C2491: '_beep': definition of dllimport function not allowed
C:\msys64\mingw64\include\stdlib.h(685): error C2085: '_seterrormode': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(685): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(686): error C2085: '_sleep': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(686): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(707): error C2085: 'ecvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(708): error C2085: 'fcvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(709): error C2085: 'gcvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(710): error C2085: 'itoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(711): error C2085: 'ltoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(712): error C2085: 'putenv': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(716): error C2085: 'swab': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(719): error C2085: 'ultoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(720): error C2085: 'onexit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(726): error C2085: 'lldiv_t': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(728): error C2061: syntax error: identifier 'lldiv_t'
C:\msys64\mingw64\include\stdlib.h(732): error C2169: 'llabs': intrinsic function, cannot be defined
C:\msys64\mingw64\include\malloc.h(50): warning C4820: '_heapinfo': '4' bytes padding added after data member '_useflag'
C:\msys64\mingw64\include\malloc.h(82): fatal error C1083: Cannot open include file: 'mm_malloc.h': No such file or directory

** (Mix) Could not compile dependency :fast_tls, "escript.exe "c:/Users/Paul/.mix/rebar3" bare compile --paths c:/Users/Paul/Desktop/phoenix/els_umbrella/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile fast_tls", update it with "mix deps.update fast_tls" or clean it with "mix deps.clean fast_tls"

Method 2) Run bash emulator on fast_tls_master:

Paul@paul-pc03 MINGW64 ~/Downloads/fast_tls-master/fast_tls-master
$ export LDFLAGS="-LC:/msys64/mingw64/lib"

$ export CFLAGS="-IC:/msys64/mingw64/include/"

$ export CPPFLAGS="-IC:/msys64/mingw64/include/"

Paul@paul-pc03 MINGW64 ~/Downloads/fast_tls-master/fast_tls-master
$ ./configure && make
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether make sets $(MAKE)... yes
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for ANSI C header files... (cached) yes
checking for erl... /c/Program Files/erl-24.3.4.2/bin/erl
checking for erlc... /c/Program Files/erl-24.3.4.2/bin/erlc
checking for SSL_free in -lssl... yes
checking for SHA1_Init in -lcrypto... yes
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... yes
checking for openssl/ssl.h... yes
checking openssl/err.h usability... yes
checking openssl/err.h presence... yes
checking for openssl/err.h... yes
checking openssl/sha.h usability... yes
checking openssl/sha.h presence... yes
checking for openssl/sha.h... yes
checking openssl/opensslv.h usability... yes
checking openssl/opensslv.h presence... yes
checking for openssl/opensslv.h... yes
configure: creating ./config.status
config.status: creating vars.config
C:\Users\Paul\.mix\rebar get-deps compile
==> p1_utils (get-deps)
==> fast_tls-master (get-deps)
==> p1_utils (compile)
==> fast_tls-master (compile)
Compiling c_src/fast_tls.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31332 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

fast_tls.c
C:\msys64\mingw64\include\_mingw_mac.h(215): warning C4668: '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\msys64\mingw64\include\_mingw_mac.h(306): warning C4668: '_FORTIFY_SOURCE' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\msys64\mingw64\include\stdio.h(39): warning C4820: '_iobuf': '4' bytes padding added after data member '_cnt'
C:\msys64\mingw64\include\stdio.h(577): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(584): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(590): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(851): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(881): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1235): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1242): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1248): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1364): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdio.h(1374): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\swprintf.inl(27): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\swprintf.inl(34): error C2059: syntax error: 'type'
c:\Program Files\erl-24.3.4.2\erts-12.3.2.2\include\erl_drv_nif.h(40): warning C4820: '<unnamed-tag>': '4' bytes padding added after data member 'dirty_scheduler_support'
c:\Program Files\erl-24.3.4.2\erts-12.3.2.2\include\erl_drv_nif.h(156): warning C4820: '_SysIOVec': '4' bytes padding added after data member 'iov_len'
C:\msys64\mingw64\include\stdlib.h(389): error C2085: '_exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(389): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(396): error C2085: '_Exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(396): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(399): error C2085: '_Exit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(399): error C2143: syntax error: missing ';' before '{'
C:\msys64\mingw64\include\stdlib.h(399): warning C4013: '_exit' undefined; assuming extern returning int
C:\msys64\mingw64\include\stdlib.h(399): error C2065: 'status': undeclared identifier
C:\msys64\mingw64\include\stdlib.h(405): error C2059: syntax error: 'type'
C:\msys64\mingw64\include\stdlib.h(683): error C2491: '_beep': definition of dllimport function not allowed
C:\msys64\mingw64\include\stdlib.h(685): error C2085: '_seterrormode': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(685): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(686): error C2085: '_sleep': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(686): error C2143: syntax error: missing ';' before 'type'
C:\msys64\mingw64\include\stdlib.h(707): error C2085: 'ecvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(708): error C2085: 'fcvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(709): error C2085: 'gcvt': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(710): error C2085: 'itoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(711): error C2085: 'ltoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(712): error C2085: 'putenv': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(716): error C2085: 'swab': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(719): error C2085: 'ultoa': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(720): error C2085: 'onexit': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(726): error C2085: 'lldiv_t': not in formal parameter list
C:\msys64\mingw64\include\stdlib.h(728): error C2061: syntax error: identifier 'lldiv_t'
C:\msys64\mingw64\include\malloc.h(50): warning C4820: '_heapinfo': '4' bytes padding added after data member '_useflag'
C:\msys64\mingw64\include\malloc.h(82): fatal error C1083: Cannot open include file: 'mm_malloc.h': No such file or directory
ERROR: compile failed while processing c:/Users/Paul/Downloads/fast_tls-master/fast_tls-master: rebar_abort
make: *** [Makefile:6: src] Error 1

Paul@paul-pc03 MINGW64 ~/Downloads/fast_tls-master/fast_tls-master

I have installed Microsoft Visual Studio Community Edition 2020, and the system env path to the cl.exe program is:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x64;

After some conversations re: processone/ejabberd, we tried to run Windows 10 mix compile on fast_tls again.

The problem in Windows 10 mix compile appears to be with fetching a certain "pc v1.14.0" - called by p1_utils and fast_tls - we are informed that pc is a port_compiler, used for compiling C code, required by several ejabberd dependencies that include C code, all the fast_*.

When we compile fast_tls we are dumped out with a default Visual Studio cl.exe batch script that clearly doesn't understand any of the passed in params, but instead writes out a "vc140.pdb (program debug file). We also see that no files are written to the c_src sub-directory within fast_tls (normally object files etc are written out here during the compile stage). There is also an _ebin folder written out - which one assumes contains an attempt to produce erlang beam files and config.

We have a wls (Windows Subsystem for Linux) soft-link pointing to the same fast_tls folder. When we run the Elixir mix compile in wsl, we can see that indeed files are written to the c_src sub-directory (.o and .d files among others), and the _ebin folder is updated with what appears to be correctly configured erlang beam files and config. We also receive an Elixir mix compile success message.

If we then re-run the same Elixir mix compile, but this time in Windows
and not wsl against fast_tls, the command also succeeds with no further action taken. We can see that all files in the fast_tls folder are preserved and no timestamps are updated. The _ebin folder is not
updated and remains intact. We can't confirm if these are actually usable - since they were written out by wsl linux and not Windows, but we can then go ahead and install the stun dependency (which requires fast_tls) in Windows using mix deps.get, and the dependency appears to install without errors.

But we are completely lost as to how to make the windows version compile like the linux version in the first place.

We have checked the rebar config - these appear to be files that can't be edited - and all the environment variables - but we simply cannot see how to tell the windows version to compile fast_tls like the linux one - presumably calling the pc port compiler instead of running a default MSCV compiler ... We don't have experience in managing Erlang configs, we can handle it in Elixir mix, but that is the limit of our knowledge. Maybe there are examples out there on how to use the port_compiler on Microsoft Windows. Any ideas would be very much welcomed as we are now at a dead end!

This issue can now be closed. The fix has been provided: https://github.com/processone/stun/issues/37
Many thanks to all at processone!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文