Skip to content

Commit

Permalink
Fix build on musl based systems (such as Alpine Linux)
Browse files Browse the repository at this point in the history
Fixes #1223
  • Loading branch information
ibc committed Dec 28, 2023
1 parent 4620783 commit 2bd83e9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

* worker: Do not use references for async callbacks ([PR #1274](https://github.com/versatica/mediasoup/pull/1274)).
* liburing: Enable zero copy ([PR #1273](https://github.com/versatica/mediasoup/pull/1273)).
* Fix build on musl based systems (such as Alpine Linux) ([PR #XXXX](https://github.com/versatica/mediasoup/pull/XXXX)).


### 3.13.12
Expand Down
22 changes: 20 additions & 2 deletions worker/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ if get_option('ms_rtc_logger_rtp')
]
endif

cpp = meson.get_compiler('cpp')

# This is a workaround to define FLATBUFFERS_LOCALE_INDEPENDENT=0 outside
# flatbuffers project, which is needed in case the current arch doesn't support
# strtoll_l or strtoull_l (such as musl in Alpine Linux). Problem is that
# flatbuffers build system not only defines it for its own usage but also relies
# on it in its include/flatbuffers/util.h file, and if such a file is included
# by mediasoup source files (and it is included) build fails with "error:
# 'strtoull_l' was not declared in this scope".
# See issue: https://github.com/versatica/mediasoup/issues/1223
add_project_arguments('-DFLATBUFFERS_LOCALE_INDEPENDENT=@0@'.format(cpp.has_function('strtoull_l')), language: 'cpp')

common_sources = [
'src/lib.cpp',
'src/DepLibSRTP.cpp',
Expand Down Expand Up @@ -163,14 +175,13 @@ common_sources = [
'src/RTC/RTCP/XrReceiverReferenceTime.cpp',
]

cpp = meson.get_compiler('cpp')

openssl_proj = subproject(
'openssl',
default_options: [
'warning_level=0',
],
)

libuv_proj = subproject(
'libuv',
default_options: [
Expand All @@ -179,6 +190,7 @@ libuv_proj = subproject(
'build_benchmarks=false',
],
)

libsrtp2_proj = subproject(
'libsrtp2',
default_options: [
Expand All @@ -188,34 +200,40 @@ libsrtp2_proj = subproject(
'tests=disabled',
],
)

usrsctp_proj = subproject(
'usrsctp',
default_options: [
'warning_level=0',
'sctp_build_programs=false',
],
)

abseil_cpp_proj = subproject(
'abseil-cpp',
default_options: [
'warning_level=0',
'cpp_std=c++17',
],
)

catch2_proj = subproject(
'catch2',
default_options: [
'warning_level=0',
],
)

flatbuffers_proj = subproject(
'flatbuffers',
default_options: [
'warning_level=0',
],
)

# flatbuffers schemas subdirectory.
subdir('fbs')

# Add current build directory so libwebrtc has access to FBS folder.
libwebrtc_include_directories = include_directories('include', 'fbs')
subdir('deps/libwebrtc')
Expand Down

0 comments on commit 2bd83e9

Please sign in to comment.