Project

General

Profile

Actions

Emulator Issues #13124

closed

Build failure against mbedTLS 3.2.1

Added by mgorny about 2 years ago. Updated over 1 year ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:
5.0-19749

Description

What's the problem? Describe what went wrong.

When mbedTLS 3.2.1 is installed on the system, Dolphin fails to compile with a number of different errors, e.g.:

/usr/bin/ccache /usr/lib/ccache/bin/c++ -DAUTOUPDATE=1 -DDATA_DIR=\"/usr/local/share/dolphin-emu/\" -DFMT_SHARED -DHAS_OPENGL -DHAS_VUL
KAN -DHAVE_EGL=1 -DHAVE_FFMPEG -DHAVE_LIBEVDEV=1 -DHAVE_LIBSYSTEMD -DHAVE_LIBUDEV=1 -DHAVE_X11=1 -DHAVE_XRANDR=1 -DSPNG_STATIC -DUSE_ANALYTICS=1 -DUSE_MEMORYWATCHER=1 -DUSE_PIPES=1 -DUSE_UPNP -D_ARCH_64=1 -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_M_X86=1 -D_M_X86_64=1 -D__LIBUSB__ -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/dolphin/Source/Core -I/tmp/dolphin/Externals/enet/include -I/tmp/dolphin/External/minizip -I/tmp/dolphin/Externals/soundtouch -I/usr/include/libusb-1.0 -I/tmp/dolphin/Externals/discord-rpc/include -I/tmp/dolphin/Externals/picojson -I/tmp/dolphin/build/Source/Core -I/tmp/dolphin/Externals/minizip/. -I/tmp/dolphin/build/Externals/zlib-ng/zlib-ng -I/tmp/dolphin/Externals/zlib-ng/zlib-ng -I/tmp/dolphin/Externals/FatFs -I/tmp/dolphin/Externals/libspng/libspng/spng -isystem /usr/include/miniupnpc -O3 -DNDEBUG -msse2 -fdiagnostics-color -fno-strict-aliasing -fno-exceptions -fvisibility-inlines-hidden -fvisibility=hidden -fomit-frame-pointer -Wall -Wtype-limits -Wsign-compare -Wignored-qualifiers -Wuninitialized -Wlogical-op -Wshadow -Winit-self -Wmissing-declarations -Wno-stringop-truncation -Werror=format -std=c++20 -MD -MT Source/Core/Common/CMakeFiles/common.dir/Crypto/SHA1.cpp.o -MF Source/Core/Common/CMakeFiles/common.dir/Crypto/SHA1.cpp.o.d -o Source/Core/Common/CMakeFiles/common.dir/Crypto/SHA1.cpp.o -c /tmp/dolphin/Source/Core/Common/Crypto/SHA1.cpp
In file included from /tmp/dolphin/Source/Core/Common/Crypto/SHA1.h:13,
                 from /tmp/dolphin/Source/Core/Common/Crypto/SHA1.cpp:4:
/tmp/dolphin/Source/Core/Common/Crypto/SHA1.cpp: In constructor ‘Common::SHA1::ContextMbed::ContextMbed()’:
/tmp/dolphin/Source/Core/Common/Crypto/SHA1.cpp:41:13: error: ‘mbedtls_sha1_starts_ret’ was not declared in this scope; did you mean ‘mbedtls_sha1_starts’?
   41 |     ASSERT(!mbedtls_sha1_starts_ret(&ctx));
      |             ^~~~~~~~~~~~~~~~~~~~~~~
/tmp/dolphin/Source/Core/Common/Assert.h:35:11: note: in definition of macro ‘ASSERT’
   35 |     if (!(_a_))                                                                                    \
      |           ^~~
/tmp/dolphin/Source/Core/Common/Crypto/SHA1.cpp: In member function ‘virtual void Common::SHA1::ContextMbed::Update(const u8*, size_t)’
:
/tmp/dolphin/Source/Core/Common/Crypto/SHA1.cpp:46:13: error: ‘mbedtls_sha1_update_ret’ was not declared in this scope; did you mean ‘m
bedtls_sha1_update’?
   46 |     ASSERT(!mbedtls_sha1_update_ret(&ctx, msg, len));
      |             ^~~~~~~~~~~~~~~~~~~~~~~
/tmp/dolphin/Source/Core/Common/Assert.h:35:11: note: in definition of macro ‘ASSERT’
   35 |     if (!(_a_))                                                                                    \
      |           ^~~
/tmp/dolphin/Source/Core/Common/Crypto/SHA1.cpp: In member function ‘virtual Common::SHA1::Digest Common::SHA1::ContextMbed::Finish()’:
/tmp/dolphin/Source/Core/Common/Crypto/SHA1.cpp:51:13: error: ‘mbedtls_sha1_finish_ret’ was not declared in this scope; did you mean ‘m
bedtls_sha1_finish’?
   51 |     ASSERT(!mbedtls_sha1_finish_ret(&ctx, digest.data()));
      |             ^~~~~~~~~~~~~~~~~~~~~~~
/tmp/dolphin/Source/Core/Common/Assert.h:35:11: note: in definition of macro ‘ASSERT’
   35 |     if (!(_a_))                                                                                    \
      |           ^~~
/tmp/dolphin/Source/Core/Common/Crypto/SHA1.cpp: At global scope:
/tmp/dolphin/Source/Core/Common/Crypto/SHA1.cpp:169:43: warning: ignoring attributes on template argument ‘__m128i’ [-Wignored-attribut
es]
  169 |   using WorkBlock = CyclicArray<__m128i, 4>;
      |                                           ^
/tmp/dolphin/Source/Core/Common/Crypto/SHA1.cpp:247:24: warning: ignoring attributes on template argument ‘__m128i’ [-Wignored-attribut
es]
  247 |   std::array<__m128i, 2> state{};
      |                        ^

I suspect these are general mbedTLS 3 incompatibilities. There's an official migration guide at https://github.com/Mbed-TLS/mbedtls/blob/development/docs/3.0-migration-guide.md

What steps will reproduce the problem?

Install mbedTLS 3.2.1, then configure and build Dolphin.

Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.

Yes. Tested as of d853da3b0b6546650d030daa706ba5a68057ad19.

Is the issue present in the latest stable version?

Yes.

What are your PC specifications? (CPU, GPU, Operating System, more)

Gentoo Linux/amd64

Is there anything else that can help developers narrow down the issue? (e.g. logs, screenshots,
configuration files, savefiles, savestates)

I've attached the log with all the compile failures I've managed to get with -k999. Not sure if there aren't more lurking.

I can try to prepare a pull request if you tell me whether you'd prefer preserving compatibility with both mbedTLS 2 and 3 (i.e. #if approach) or updating externals to mbedTLS 3 and just using the vendored version when mbedTLS 2 is present on the system.


Files

dolphin-fail.log (36.3 KB) dolphin-fail.log Build failures mgorny, 12/21/2022 11:32 AM
Actions

Also available in: Atom PDF