Building librist on Windows using VS2019
Hello,
Context: I am the author of an open source project named TSDuck (web, github, BSD license too) which manipulates MPEG transport streams. Input/output plugins include DVB tuners, modulators, UDP, HTTP, SRT, etc. A user is asking if RIST support could be added. I know nothing about RIST and I am investigating the feasibility.
Building librist on various Linux distros is unsurprisingly straightforward. And, equally unsurprisingly, building on Windows is not...
I use VS2019 and followed the instructions in librist README in section "Compile using meson/ninja (windows - Visual Studio 2019)". I run into many compilation errors. I must have missed something. Are there any more detailed instructions somewhere?
I would like to build a static librist library so that the final project (TSDuck) carries no external dependency.
For a start, cjson, cmocka and mbedtls are not available. On Linux, apt/dnf did the job. I wonder how to make them available on Windows to build librist.
Then, I got many compilation errors. I did not look into the source code but they do not seem related to the absence of cjson, cmocka and mbedtls, at least at first glance.
Output of meson setup build --backend vs2019:
Activating VS 16.11.2
The Meson build system
Version: 0.59.1
Source dir: D:\Devel\rist-installer\build\librist
Build dir: D:\Devel\rist-installer\build\librist\build
Build type: native build
Project name: libRIST
Project version: 0.2.6
C compiler for the host machine: cl (msvc 19.29.30133 "Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30133 for x64")
C linker for the host machine: link link 14.29.30133.0
Host machine cpu family: x86_64
Host machine cpu: x86_64
Library ws2_32 found: YES
Compiler for C supports arguments -wd4996: YES
Compiler for C supports arguments -wd4324: YES
Compiler for C supports arguments -fvisibility=hidden: NO
meson.build:130: WARNING: Compiler does not support -fvisibility=hidden, all symbols will be public!
Check usable header "stdatomic.h" : NO
Did not find pkg-config by name 'pkg-config'
Found Pkg-config: NO
Found CMake: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE (3.20.21032501)
Run-time dependency cjson found: NO (tried pkgconfig and cmake)
Has header "cjson/cJSON.h" : NO
Message: Using builtin cJSON library
Message: Building mbedtls
Run-time dependency mbedcrypto found: NO (tried pkgconfig and cmake)
Has header "mbedtls/aes.h" : NO
Message: Using builtin mbedtls code
Program C:\Program Files\Python39\Scripts\meson found: YES (C:\Program Files\Python39\Scripts\meson.exe)
Configuring version.h using configuration
Program objcopy found: NO
Configuring config.h using configuration
Message: Building tools
Library ws2_32 found: YES
Library cmocka found: NO
test\rist\meson.build:72: DEPRECATION: ":" is not allowed in test name "Main profile encryption receive server mode unencrupted, sender: client mode", it has been replaced with "_"
test\rist\meson.build:75: DEPRECATION: ":" is not allowed in test name "Main profile encryption client mode, sender: server mode unencrypted", it has been replaced with "_"
Build targets in project: 7
Output of meson compile -C build:
Activating VS 16.11.2
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Checking whether solution needs to be regenerated.
Everything is up-to-date, regeneration of build files is not needed.
Performing Custom Build Tools
crypto.c
D:\Devel\rist-installer\build\librist\src\rist-private.h(275,2): error C2061: syntax error: identifier 'atomic_bool' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(351,1): error C2059: syntax error: '}' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(371,25): error C2079: 'common' uses undefined struct 'rist_common_ctx' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(431,25): error C2079: 'common' uses undefined struct 'rist_common_ctx' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(569,2): error C2061: syntax error: identifier 'atomic_bool' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(580,31): warning C4142: 'cname': benign redefinition of type [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(314): message : see declaration of 'cname' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(584,1): error C2059: syntax error: '}' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(590,34): warning C4133: 'return': incompatible types - from 'int *' to 'rist_common_ctx *' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(592,36): warning C4133: 'return': incompatible types - from 'int *' to 'rist_common_ctx *' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(647,27): warning C4459: declaration of 'PEERS' hides global declaration [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(294,20): message : see declaration of 'PEERS' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(647,36): error C2037: left of 'PEERS' specifies undefined struct/union 'rist_common_ctx' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(654,9): error C2037: left of 'parent' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(656,31): error C2037: left of 'parent' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(657,14): error C2037: left of 'child' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(658,10): error C2037: left of 'child' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(661,36): error C2037: left of 'child' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(664,17): error C2037: left of 'sibling_next' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(666,13): error C2037: left of 'sibling_next' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(667,9): error C2037: left of 'sibling_prev' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(670,20): error C2037: left of 'sibling_next' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(673,11): error C2037: left of 'child_alive_count' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(677,15): error C2037: left of 'next' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(679,7): error C2037: left of 'prev' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(680,11): error C2037: left of 'next' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(683,18): error C2037: left of 'next' specifies undefined struct/union 'rist_peer' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\crypto\crypto.c(16,52): warning C4459: declaration of 'seq' hides global declaration [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
D:\Devel\rist-installer\build\librist\src\rist-private.h(317,11): message : see declaration of 'seq' [D:\Devel\rist-installer\build\librist\build\librist@sha.vcxproj]
Any help would be appreciated.