当前位置: 代码迷 >> 综合 >> windows下编译srt.dll过程
  详细解决方案

windows下编译srt.dll过程

热度:78   发布时间:2024-02-21 04:19:04.0

    编译libsrt.so库,按官方的说明文档来操作,最终成功!中间试图用msys2+mingw64来编译失败了!
    annot find -lwsock32.lib 和 ld.exe: cannot find -lws2_32.lib。应该是可以解决的。
    下面记录用vs2019来编译生成srt.lib/srt.dll的过程。
    vcpkg install openssl --triplet x64-windows
    vcpkg install pthreads --triplet x64-windows    
    这两个操作均失败!openssl用下面的方法来生成的,成功了!pthreads则用vs2019来打开编译x64+release
    $ cd srt-master
    $ cmake ../ -G"Visual Studio 16 2019" -A x64 -DPTHREAD_INCLUDE_DIR=D:\wincpp\ffmpeg\srt\winx64\include -DPTHREAD_LIBRARY=D:\wincpp\ffmpeg\srt\winx64\lib
    $ cmake --build .        //有链接上的问题,用vs2019工程打开后修改配置:
    D:\wincpp\ffmpeg\srt\srt-master\buildx64\Release
    LIB目录: D:\wincpp\ffmpeg\srt\winx64\lib
    libs: libcrypto.lib;libssl.lib;pthread_dll.lib;ws2_32.lib
    原来cmake生成的工程配置感觉有点糟糕!
    终于,编译通过,生成srt.dll, srt.lib。
    
    windows下编译openssl过程:OpenSSL 1.1.1g
    For OpenSSL 1.1.0 and above perform these steps:
    1. Ensure you have perl installed on your machine (e.g. ActiveState or Strawberry), and available on your %PATH%
    2. Ensure you have NASM installed on your machine, and available on your %PATH%
    3. Extract the source files to your folder, here cd c:\myPath\openssl
    4. Launch Visual Studio tool x64 Cross Tools Command prompt
    5. Goto your defined folder cd c:\myPath\openssl
    Configure for the target OS with perl Configure VC-WIN64A or other configurations to be found in the INSTALL file (e.g. UNIX targets).
    For instance: perl Configure VC-WIN64A.
    (Optional) In case you compiled before on 32 or 64-bits, make sure you run nmake clean to prevent trouble across 32 and 64-bits which share output folder.
    Now build with: nmake
    Output can be found in the root of your folder as libcrypto-1_1x64.dll and libssl-1_1-x64.dll 
    (with all the build additionals such as .pdb .lik or static .lib). 
    You may check this is true 64bit code using the Visual Studio tool 'dumpbin'. 
    For instance dumpbin /headers libcrypto-1_1x64.dll | more, and look at the FILE HEADER section.
    Test the code using the 'test' make target, by running nmake test.
    Reminder, clean your code to prevent issues the next time you compile for a different target. See step 7.
    
    $ perl Configure VC-WIN64A --prefix=D:\wincpp\ffmpeg\srt\winx64
    $ nmake && nmake install
 

  相关解决方案