Cross-Compile FreeRDP using Mingw-w64

Original: https://github.com/FreeRDP/FreeRDP/wiki/Compilation

FreeRDP can be compiled for Windows (32/64 Bit) on a Linux system using the Mingw cross-compilers. The following instruction was tested with Mingw-w64 2.0 and gcc-4.7 on Scientific Linux 6.1 (x64) but should work relatively independent of the Mingw/gcc version.

1. Install the Mingw-cross compilers (most Linux distros offer binary packages for Mingw in their repos). On older distros you may need to compile the latest version of Mingw from source. If you want to create 32 Bit binaries only, then Mingw32 is sufficient, otherwise you should install Mingw-w64.

2. Download the latest version of openssl (http://www.openssl.org/), compile it using the Mingw cross-compilers and install it. Instructions how to do this can be found on http://www.blogcompiler.com/.

3. Download FreeRDP and unpack the source archive. Create a subdirectory in the FreeRDP source tree called “mingw_build” where FreeRDP will be build. Open a terminal and goto this directory. Enter the command


cmake -DCMAKE_SYSTEM_NAME="Windows" \
      -DCMAKE_C_COMPILER="/opt/mingw64/bin/x86_64-w64-mingw32-gcc" \
      -DCMAKE_RC_COMPILER="/opt/mingw64/bin/x86_64-w64-mingw32-windres" \
      -DCMAKE_INSTALL_PREFIX="/opt/mingw64" \
      -DBUILD_SHARED_LIBS=OFF \
      -DCMAKE_C_FLAGS="-DFREERDP_EXPORTS -Dsprintf_s=snprintf" \
      -DCMAKE_EXE_LINKER_FLAGS="-L/opt/mingw64/lib" \
      -DWITH_SSE2=OFF \
      -DWITH_SSE2_TARGET=OFF \
      -DOPENSSL_INCLUDE_DIR="/opt/mingw64/include" \
      -DLIB_EAY="/opt/mingw64/lib/libcrypto.a" \
      -DSSL_EAY="/opt/mingw64/lib/libssl.a" \
      ..

This will configure FreeRDP for cross-compilation. Note that you need to adjust the paths according to your installation of Mingw and OpenSSL. Using the command above the wfreerdp.exe binary will be statically linked and can be executed on any Windows machine.

Note: You need a recent version of cmake (I used 2.8.7) as the logic in the FindOpenSSL cmake makro is broken (for cross-compilation) in older versions.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值