简体   繁体   English

使用 cmake 在 Linux for Windows 上交叉编译程序

[英]Cross-Compiling a program on Linux for Windows using cmake

im trying to cross compile nextcloud on my Linux system for Windows 64x我试图在我的 Linux 系统上为 Windows 64x 交叉编译 nextcloud
So far i managed to get the c and cxx compiler running, but cmake wont find openssl.到目前为止,我设法让 c 和 cxx 编译器运行,但 cmake 找不到 openssl。

c compiler = x86_64-w64-mingw32-gcc-posix c 编译器 = x86_64-w64-mingw32-gcc-posix
cxx compiler = x86_64-w64-mingw32-g++-posix cxx 编译器 = x86_64-w64-mingw32-g++-posix

The thing is cmake finds openssl while using the linux compiler.问题是 cmake 在使用 linux 编译器时找到了 openssl。
c compiler= cc c编译器=cc
cxx compiler= c++ cxx 编译器= c++

Im not that experienced in cross compiling.我在交叉编译方面没有经验。
Do i need the windows version of openssl somewhere on my linux mashine to make cmake find it?我需要在我的 linux mashine 的某个地方安装 windows 版本的 openssl 才能让 cmake 找到它吗? I tried to set the CMAKE_PREFIX_PATH to the linux version of openssl but that seems somewhat silly to me.我试图将 CMAKE_PREFIX_PATH 设置为 openssl 的 linux 版本,但这对我来说似乎有些愚蠢。

Thanks for an help感谢您的帮助

The libssl your linux compiler find is an elf library which is not compatible with the pei format needed for windows.你的 linux 编译器找到的 libssl 是一个 elf 库,它与 windows 所需的 pei 格式不兼容。 Mingw cannot link against this library. Mingw 无法链接到这个库。

You need a mingw version of libssl and any library you want to link against.您需要一个 mingw 版本的 libssl 以及您想要链接的任何库。 If you cannot find a mingw version, you will need to cross compile it yourself.如果找不到 mingw 版本,则需要自己交叉编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM