Closed copiltembel closed 10 months ago
@nazar-pc @jmillan, Alpine Linux seems definitely problematic, this is not the first unexpected issue I see. Wondering if we should include an Alpine Docker image in CI and, if so, any experience in how to setup it?
Seems to be related to the flatbuffers update? Googling the error took me here: google/flatbuffers#7265
The PR https://github.com/google/flatbuffers/pull/7266 that fixed that issue was merged long ago and we use a more recent version of flatbuffers: 23.3.3. Those changes are in the version we use for sure.
This PR https://github.com/versatica/mediasoup/pull/1226 adds Alpine Docker to mediasoup and confirms this issue.
By installing and entering the container (and after running make clean-all
and npm ci
), installation fails as follows when compiling flatbuffers subproject:
In file included from ../../../subprojects/flatbuffers-23.3.3/include/flatbuffers/minireflect.h:21,
from ../../../include/Channel/ChannelRequest.hpp:8,
from ../../../include/Settings.hpp:6,
from ../../../include/Logger.hpp:91,
from ../../../src/RTC/RTCP/FeedbackPsFir.cpp:5:
../../../subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h: In function 'void flatbuffers::strtoval_impl(int64_t*, const char*, char**, int)':
../../../subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h:229:38: error: 'strtoll_l' was not declared in this scope; did you mean 'strtold_l'?
229 | #define __strtoll_impl(s, pe, b) strtoll_l(s, pe, b, ClassicLocale::Get())
| ^~~~~~~~~
../../../subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h:247:12: note: in expansion of macro '__strtoll_impl'
247 | *val = __strtoll_impl(str, endptr, base);
| ^~~~~~~~~~~~~~
../../../subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h: In function 'void flatbuffers::strtoval_impl(uint64_t*, const char*, char**, int)':
../../../subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h:228:39: error: 'strtoull_l' was not declared in this scope; did you mean 'strtoull'?
228 | #define __strtoull_impl(s, pe, b) strtoull_l(s, pe, b, ClassicLocale::Get())
| ^~~~~~~~~~
../../../subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h:252:10: note: in expansion of macro '__strtoull_impl'
252 | *val = __strtoull_impl(str, endptr, base);
| ^~~~~~~~~~~~~~~
make
version: GNU Make 4.4.1gcc
/g++
version: 12.2.1I am also encountering this problem. There seems to be a problem in environments that use musl for libc. https://github.com/oviceinc/mediasoup-elixir/actions/runs/7319795750/job/19938068141?pr=254
This seems to be happening when reading the flatbuffer header from the source code in mediasoup. In other words, https://github.com/google/flatbuffers/blob/129ef422e8a4e89d87a7216a865602673a6d0bf3/CMakeLists.txt#L97 This same check and definition of FLATBUFFERS_LOCALE_INDEPENDENT may be needed when building mediasoup.
2023-12-25T06:44:20.1980605Z In file included from ../../../../../../../home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.1/subprojects/flatbuffers-23.3.3/include/flatbuffers/minireflect.h:21,
2023-12-25T06:44:20.1981460Z from ../../../../../../../home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.1/include/Channel/ChannelRequest.hpp:8,
2023-12-25T06:44:20.1982269Z from ../../../../../../../home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.1/include/Settings.hpp:6,
2023-12-25T06:44:20.1982855Z from ../../../../../../../home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.1/include/Logger.hpp:91,
2023-12-25T06:44:20.1983818Z from ../../../../../../../home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.1/deps/libwebrtc/libwebrtc/rtc_base/experiments/alr_experiment.cc:17:
2023-12-25T06:44:20.1997142Z ../../../../../../../home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.1/subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h: In function ‘void flatbuffers::strtoval_impl(int64_t*, const char*, char**, int)’:
2023-12-25T06:44:20.1998559Z ../../../../../../../home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.1/subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h:229:38: error: ‘strtoll_l’ was not declared in this scope; did you mean ‘strcoll_l’?
2023-12-25T06:44:20.1998927Z 229 | #define __strtoll_impl(s, pe, b) strtoll_l(s, pe, b, ClassicLocale::Get())
2023-12-25T06:44:20.1999108Z | ^~~~~~~~~
2023-12-25T06:44:20.2000494Z ../../../../../../../home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.1/subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h:247:12: note: in expansion of macro ‘__strtoll_impl’
2023-12-25T06:44:20.2000680Z 247 | *val = __strtoll_impl(str, endptr, base);
2023-12-25T06:44:20.2000819Z | ^~~~~~~~~~~~~~
2023-12-25T06:44:20.2002235Z ../../../../../../../home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.1/subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h: In function ‘void flatbuffers::strtoval_impl(uint64_t*, const char*, char**, int)’:
2023-12-25T06:44:20.2003972Z ../../../../../../../home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.1/subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h:228:39: error: ‘strtoull_l’ was not declared in this scope; did you mean ‘strcoll_l’?
2023-12-25T06:44:20.2004270Z 228 | #define __strtoull_impl(s, pe, b) strtoull_l(s, pe, b, ClassicLocale::Get())
2023-12-25T06:44:20.2004419Z | ^~~~~~~~~~
2023-12-25T06:44:20.2005423Z ../../../../../../../home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mediasoup-sys-0.7.1/subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h:252:10: note: in expansion of macro ‘__strtoull_impl’
2023-12-25T06:44:20.2005577Z 252 | *val = __strtoull_impl(str, endptr, base);
2023-12-25T06:44:20.2005730Z | ^~~~~~~~~~~~~~~
This seems to be happening when reading the flatbuffer header from the source code in mediasoup. In other words, https://github.com/google/flatbuffers/blob/129ef422e8a4e89d87a7216a865602673a6d0bf3/CMakeLists.txt#L97 This same check and definition of FLATBUFFERS_LOCALE_INDEPENDENT may be needed when building mediasoup.
AFAIU this is a missing thing in the flatbuffers.wrap
meson wrap file, right?
So subprojects/flatbuffers-23.3.3/CMakeLists.txt
has this:
# Auto-detect locale-narrow 'strtod_l' and 'strtoull_l' functions.
if(NOT DEFINED FLATBUFFERS_LOCALE_INDEPENDENT)
include(CheckCXXSymbolExists)
set(FLATBUFFERS_LOCALE_INDEPENDENT 0)
if(MSVC_LIKE)
check_cxx_symbol_exists(_strtof_l stdlib.h FLATBUFFERS_HAS_STRTOF_L)
check_cxx_symbol_exists(_strtoui64_l stdlib.h FLATBUFFERS_HAS_STRTOULL_L)
else()
check_cxx_symbol_exists(strtof_l stdlib.h FLATBUFFERS_HAS_STRTOF_L)
check_cxx_symbol_exists(strtoull_l stdlib.h FLATBUFFERS_HAS_STRTOULL_L)
endif()
if(FLATBUFFERS_HAS_STRTOF_L AND FLATBUFFERS_HAS_STRTOULL_L)
set(FLATBUFFERS_LOCALE_INDEPENDENT 1)
endif()
endif()
add_definitions(-DFLATBUFFERS_LOCALE_INDEPENDENT=$<BOOL:${FLATBUFFERS_LOCALE_INDEPENDENT}>)
if(NOT WIN32)
check_symbol_exists(realpath "stdlib.h" HAVE_REALPATH)
if(NOT HAVE_REALPATH)
add_definitions(-DFLATBUFFERS_NO_ABSOLUTE_PATH_RESOLUTION)
endif()
endif()
However subprojects/flatbuffers-23.3.3/meson.build
only has this:
add_project_arguments('-DFLATBUFFERS_LOCALE_INDEPENDENT=@0@'.format(cpp.has_function('strtoull_l')), language: 'cpp')
It is not equivalent at all. @nazar-pc you know something about this?
No, you probably need to add a definition to the project that is building this file.
libwebrtc/libwebrtc/rtc_base/experiments/alr_experiment.cc
I'm not sure if this is the correct way to use this library, but that's the cause of the error.
How is this related to libwebrtc dependency?
The error occurs because the flatbuffers header is included from that source and strtoll_l is used there.
@satoren, this is the full error when building mediasoup worker in Alpine.
libwebrtc dep is not involved at all and strtoll_l
and strtoull_l
are not used in libwebrtcdep but only in flatbuffers subproject:
ack strtoll_l
subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h
206:// Use locale independent functions {strtod_l, strtof_l, strtoll_l, strtoull_l}.
229: #define __strtoll_impl(s, pe, b) strtoll_l(s, pe, b, ClassicLocale::Get())
subprojects/flatbuffers-23.3.3/include/flatbuffers/base.h
263: // Enable locale independent functions {strtof_l, strtod_l,strtoll_l,
subprojects/flatbuffers-23.3.3/docs/source/CppUsage.md
576:`strtoll_l`, `strtoull_l` to resolve this dependency.
ack strtoull_l
subprojects/flatbuffers-23.3.3/CMakeLists.txt
96:# Auto-detect locale-narrow 'strtod_l' and 'strtoull_l' functions.
106: check_cxx_symbol_exists(strtoull_l stdlib.h FLATBUFFERS_HAS_STRTOULL_L)
subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h
206:// Use locale independent functions {strtod_l, strtof_l, strtoll_l, strtoull_l}.
228: #define __strtoull_impl(s, pe, b) strtoull_l(s, pe, b, ClassicLocale::Get())
subprojects/flatbuffers-23.3.3/include/flatbuffers/base.h
264: // strtoull_l}.
subprojects/flatbuffers-23.3.3/docs/source/CppUsage.md
576:`strtoll_l`, `strtoull_l` to resolve this dependency.
subprojects/flatbuffers-23.3.3/meson.build
9:add_project_arguments('-DFLATBUFFERS_LOCALE_INDEPENDENT=@0@'.format(cpp.has_function('strtoull_l')), language: 'cpp')
@ibc It's a header file. Notice the source file that includes it and the project that builds source file.
Here is the log you pasted.
In file included from ../../../subprojects/flatbuffers-23.3.3/include/flatbuffers/minireflect.h:21,
from ../../../include/Channel/ChannelRequest.hpp:8,
from ../../../include/Settings.hpp:6,
from ../../../include/Logger.hpp:91,
from ../../../src/RTC/RTCP/XrReceiverReferenceTime.cpp:5:
../../../subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h: In function 'void flatbuffers::strtoval_impl(int64_t, const char*, char**, int)':
../../../subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h:229:38: error: 'strtoll_l' was not declared in this scope; did you mean 'strtold_l'?
229 | #define __strtoll_impl(s, pe, b) strtoll_l(s, pe, b, ClassicLocale::Get())
src/RTC/RTCP/XrReceiverReferenceTime.cpp
-> include/Logger.hpp
-> include/Settings.hpp
-> include/Channel/ChannelRequest.hpp
-> subprojects/flatbuffers-23.3.3/include/flatbuffers/minireflect.h
-> subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h
That is, the project that builds src/RTC/RTCP/XrReceiverReferenceTime.cpp
must include a definition for FLATBUFFERS_LOCALE_INDEPENDENT
.
The flatbuffers documentation doesn't specifically say so, so having code where __strtoll_impl
is used in a header file used by library users may itself be a bug in flatbuffers, but I can't tell.
I see now, thanks. So it must be a bug in flatbuffers since it should not define a macro only available in the library itself if later it uses it in a header file that the application includes (because such a macro is not defined in the application build system).
So tomorrow I'll report it and, as a temporary workaround, I'll define the same macro in mediasoup meson.build file.
It looks that that this issue was recently fixed in flatbuffers, see: https://github.com/sartura/flatbuffers/commit/92bd62407329caacd66e92e5bfd2949f2f137bfe (which was included in release v23.1.21).
However it was later removed. See master branch: https://github.com/google/flatbuffers/blob/129ef422e8a4e89d87a7216a865602673a6d0bf3/include/flatbuffers/base.h#L272
UPDATE: Ok, the fixing commit was done in a fork...
I've written a PR but I expect it to not be accepted: https://github.com/google/flatbuffers/pull/8198
PR done: https://github.com/versatica/mediasoup/pull/1279
@satoren can you take a look to it? It does work in Docker Alpine.
@ibc Thank you. I was on a long vacation, so I'm late, but I can confirm that I can build.
Hope you enjoyed your vacation ☺️
Bug Report
I am trying to build mediasoup on docker with an alpine node image, but this fails.
Very simple to reproduce, just init a node project and add mediasoup, like here: https://github.com/copiltembel/mediasoup-docker-alpine-not-building
Your environment
Issue description
Running
docker build .
with a simple mediasoup node project on docker alpine leads to the build failing with this error:../../../subprojects/flatbuffers-23.3.3/include/flatbuffers/util.h:228:39: error: 'strtoull_l' was not declared in this scope; did you mean 'strtoull'?
(See full stack error in the above repo.)Seems to be related to the flatbuffers update? Googling the error took me here: https://github.com/google/flatbuffers/issues/7265