Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 703280 - media-video/obs-studio-24.0.3 with mbedtls-2.19.1: plugins/obs-outputs/librtmp/rtmp_sys.h:110:5: error: unknown type name ‘mbedtls_x509_crt’
Summary: media-video/obs-studio-24.0.3 with mbedtls-2.19.1: plugins/obs-outputs/librtm...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Chiitoo
URL: https://github.com/obsproject/obs-stu...
Whiteboard:
Keywords:
: 703426 (view as bug list)
Depends on: 705038
Blocks:
  Show dependency tree
 
Reported: 2019-12-18 10:50 UTC by Kobboi
Modified: 2020-04-03 21:26 UTC (History)
12 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log.gz (build.log.gz,10.85 KB, application/gzip)
2019-12-18 10:51 UTC, Kobboi
Details
Temporal patch to make this work (override_config_fix.patch,415 bytes, patch)
2019-12-24 16:45 UTC, Pablo Cholaky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kobboi 2019-12-18 10:50:34 UTC
[155/310] /usr/bin/x86_64-pc-linux-gnu-gcc -DCRYPTO -DHAVE_OBSCONFIG_H -DUSE_MBEDTLS -DUSE_XDG -Dobs_outputs_EXPORTS -Iplugins/obs-outputs/config -I/var/tmp/portage/media-video/obs-studio-24.0.3/work/obs-studio-24.0.3/libobs -Iconfig  -DNDEBUG -Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers -O2 -march=x86-64 -pipe -fomit-frame-pointer -g -ggdb -std=gnu99 -fno-strict-aliasing -fPIC   -mmmx -msse -msse2 -pthread -fvisibility=hidden -MD -MT plugins/obs-outputs/CMakeFiles/obs-outputs.dir/librtmp/amf.c.o -MF plugins/obs-outputs/CMakeFiles/obs-outputs.dir/librtmp/amf.c.o.d -o plugins/obs-outputs/CMakeFiles/obs-outputs.dir/librtmp/amf.c.o -c /var/tmp/portage/media-video/obs-studio-24.0.3/work/obs-studio-24.0.3/plugins/obs-outputs/librtmp/amf.c
FAILED: plugins/obs-outputs/CMakeFiles/obs-outputs.dir/librtmp/amf.c.o 
/usr/bin/x86_64-pc-linux-gnu-gcc -DCRYPTO -DHAVE_OBSCONFIG_H -DUSE_MBEDTLS -DUSE_XDG -Dobs_outputs_EXPORTS -Iplugins/obs-outputs/config -I/var/tmp/portage/media-video/obs-studio-24.0.3/work/obs-studio-24.0.3/libobs -Iconfig  -DNDEBUG -Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers -O2 -march=x86-64 -pipe -fomit-frame-pointer -g -ggdb -std=gnu99 -fno-strict-aliasing -fPIC   -mmmx -msse -msse2 -pthread -fvisibility=hidden -MD -MT plugins/obs-outputs/CMakeFiles/obs-outputs.dir/librtmp/amf.c.o -MF plugins/obs-outputs/CMakeFiles/obs-outputs.dir/librtmp/amf.c.o.d -o plugins/obs-outputs/CMakeFiles/obs-outputs.dir/librtmp/amf.c.o -c /var/tmp/portage/media-video/obs-studio-24.0.3/work/obs-studio-24.0.3/plugins/obs-outputs/librtmp/amf.c
In file included from /var/tmp/portage/media-video/obs-studio-24.0.3/work/obs-studio-24.0.3/plugins/obs-outputs/librtmp/amf.c:26:
/var/tmp/portage/media-video/obs-studio-24.0.3/work/obs-studio-24.0.3/plugins/obs-outputs/librtmp/rtmp_sys.h:110:5: error: unknown type name ‘mbedtls_x509_crt’
  110 |     mbedtls_x509_crt *cacert;
      |     ^~~~~~~~~~~~~~~~
/var/tmp/portage/media-video/obs-studio-24.0.3/work/obs-studio-24.0.3/plugins/obs-outputs/librtmp/rtmp_sys.h:119:3: error: unknown type name ‘mbedtls_x509_crt’
  119 |   mbedtls_x509_crt cert;
      |   ^~~~~~~~~~~~~~~~


Reproducible: Always
Comment 1 Kobboi 2019-12-18 10:51:34 UTC
Created attachment 600014 [details]
build.log.gz
Comment 2 foxxconn 2019-12-18 12:12:47 UTC
Same error here. This happens after today net-libs/mbedtls update to 2.19.1

With =net-libs/mbedtls-2.17.0 it compiles very well.
Comment 3 Anton Gubarkov 2019-12-20 03:20:27 UTC
Same error happens when compiling with mbedtls-2.18.1.
Comment 4 Chiitoo gentoo-dev 2019-12-21 19:47:40 UTC
*** Bug 703426 has been marked as a duplicate of this bug. ***
Comment 5 PhobosK 2019-12-22 07:50:22 UTC
Seems like an upstream Cmake problem in >=mbedtls-2.18.1 in installation step
See also: https://github.com/ARMmbed/mbedtls/issues/2965
Comment 6 Gabriel Marcano 2019-12-22 19:44:38 UTC
This seems to be an issue transcending media-video/obs-studio (which makes sense taking a look at how the CMake installation of mbedtls is handling things). I'm also having issues with games-emulation/dolphin-9999 (as of today at least).

I tried editing out the lines in "crypto/include/CMakeLists.txt" which control what gets installed from crypto. Specifically, I commented out the lines:

    install(FILES ${headers}
        DESTINATION include/mbedtls
        PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)

The top-most Makefile doesn't install these include files, as far as I can understand it. The problem with this approach is that because it doesn't seem to install everything under "crypto/include", games-emulation/dolphin-9999 was failing due to the header "mbedtls/aes.h" missing (as it only seems to be a part of the "crypto" submodule). I expect the regular Makefile compilation and installation yields the same problem, although I did not try it (I see no reference of the "crypto/include" directory being installed, other than the "crypto/include/psa" one).

As a second experiment, I modified the order of some lines the top-most CMakeLists.txt, changing:
    add_subdirectory(library)
    add_subdirectory(include)
    add_subdirectory(crypto/library)
    add_subdirectory(crypto/include)
to
    add_subdirectory(library)
    add_subdirectory(crypto/library)
    add_subdirectory(crypto/include)
    add_subdirectory(include)

This order forces the real "config.h" to be written out and overwrite the example one included in the "crypto" submodule.

With this second change, I can confirm I'm able to build games-emulation/dolphin-9999. As I don't use obs-studio I can't confirm the fix with it, although I expect it to work. Upstream needs to fix their build system.
Comment 7 Michael Baer 2019-12-22 21:48:27 UTC
I can confirm, obs-studio compiles after applying the changes mentioned by Gabriel Marcano 

Dirty workaround to install mbedtls and obs-studio:

(1) cd /usr/portage/net-libs/mbedtls
(2) ebuild mbedtls-2.19.1.ebuild compile
--- changes in CMakeLists.txt ---
(3) vi +198 $( emerge --info | grep PORTAGE_TMPDIR | cut -d\" -f2)/portage/net-libs/mbedtls-2.19.1/work/mbedtls-mbedtls-2.19.1/CMakeLists.txt
---
change
    add_subdirectory(library)
    add_subdirectory(include)
    add_subdirectory(crypto/library)
    add_subdirectory(crypto/include)
to
    add_subdirectory(library)
    add_subdirectory(crypto/library)
    add_subdirectory(crypto/include)
    add_subdirectory(include)
----
(4) ebuild mbedtls-2.19.1.ebuild install
(5) ebuild mbedtls-2.19.1.ebuild qmerge
(6) emerge obs-studio

(optional !!!USE AT YOUR OWN RISK!!! cleanup of the temporary mbedtls folder)  rm -Rf $( emerge --info | grep PORTAGE_TMPDIR | cut -d\" -f2)/portage/net-libs/mbedtls-2.19.1/

Afterwards obs-studio should be successfully installed.

Thanks to Gabriel for his work!
Comment 8 Gabriel Marcano 2019-12-22 22:59:10 UTC
Someone (Ionic) upstream posted a better patch upstream than my hack, which should do something similar to what my crappy one did.

We need input from upstream before we really know what the real fix ought to be. At the very least I'm not sure which include files should be installed, as the upstream build systems contradict each other. To keep backwards compatibility it looks like both the Makefile and the CMake need to be tweaked (Makefile doesn't install crypto headers, CMake thrashes config.h at minimum).
Comment 9 Pablo Cholaky 2019-12-24 16:45:39 UTC
Created attachment 600572 [details, diff]
Temporal patch to make this work

Hi,

What mentioned works successful as workaround.

Providing a patch just in case would be useful of anyone else.

As also mentioned, shouldn't intended as final solution, as a project bug.
Comment 10 Attila Tóth 2019-12-24 23:56:18 UTC
Attached patch worked for me, thanks!
Comment 11 N. Andrew Walsh 2020-01-02 16:21:24 UTC
how do you apply this patch? Saving it in /etc/portage/patches/media-video/obs-studio/ results in a failed patch.
Comment 12 keeperofdakeys 2020-01-04 05:43:52 UTC
(In reply to N. Andrew Walsh from comment #11)
> how do you apply this patch? Saving it in
> /etc/portage/patches/media-video/obs-studio/ results in a failed patch.

The patch is for net-libs/mbedtls. You'll need to create it for that (eg /etc/portage/patches/net-libs/mbedtls/fix-mbedtls.patch), emerge net-libs/mbedtls , then emerge obs-studio. I just successfully applied this patch to fix building dolphin.
Comment 13 Anthony Basile gentoo-dev 2020-01-11 18:56:17 UTC
(In reply to Pablo Cholaky from comment #9)
> Created attachment 600572 [details, diff] [details, diff]
> Temporal patch to make this work
> 
> Hi,
> 
> What mentioned works successful as workaround.
> 
> Providing a patch just in case would be useful of anyone else.
> 
> As also mentioned, shouldn't intended as final solution, as a project bug.

I'm waiting for a fix to land upstream.  For now 2.18.1 and 2.18.2 are masked.
Comment 14 Kobboi 2020-01-22 08:36:42 UTC
The mask was undone, breaking obs-studio again.

commit 157af36452b697e9d483f578bde415a4d07c9a7e
Author: Anthony G. Basile <blueness@gentoo.org>
Date:   Tue Jan 21 16:49:10 2020 -0500

    package.mask: remove masks on net-libs/mbedtls, bug #705038
    
    Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Comment 15 Hector Martin 2020-01-26 08:44:00 UTC
Upstream committed a fix and Gentoo pulled it in as a patch, but the fix is *backwards*. It removes the *main* config.h header, not the *crypto* one, so it makes the problem worse.

Now you need to undo the broken patch *and* use this upstream patch (from the bug, not the commit), which works:

https://github.com/ARMmbed/mbedtls/issues/2965#issuecomment-568306592
Comment 16 Hector Martin 2020-01-26 15:45:56 UTC
Just realized what happened. Upstream *correctly* committed the fix to the mbed-crypto subproject, and Gentoo pulled it and applied it to *mbed* without adding /crypto/ to the path. The patch applies cleanly to the parent CMakeLists too... and thus silently makes things worse instead of helping.

The header of the .patch file needs to be changed to add /crypto/ to the path, then it works:

diff --git a/crypto/include/CMakeLists.txt b/crypto/include/CMakeLists.txt
index 02f924df4..92229a221 100644
--- a/crypto/include/CMakeLists.txt
+++ b/crypto/include/CMakeLists.txt
Comment 17 Chiitoo gentoo-dev 2020-01-26 20:18:29 UTC
I may be a little blind, but I still don't see the upstream commit (I only see the proposed fix in Ionic's fork).
Comment 18 Juan Pedro 2020-01-27 09:16:20 UTC
Hey, isn't there a patch that works so far?
Comment 19 Chiitoo gentoo-dev 2020-01-27 15:35:02 UTC
(In reply to Juan Pedro from comment #18)
> Hey, isn't there a patch that works so far?

You may either use 'net-libs/mbedtls-2.17.0' or lower, or try to replace the patch for the newer version(s) as mentioned by the earlier comments here.
Comment 20 Hector Martin 2020-01-31 07:40:12 UTC
Yes, the ARM upstream doesn't have the fix yet, only Ionic's fork does. But either way, that patch is what made it into portage, except it's getting applied to the wrong file.

Right now, net-libs/mbedtls/files/mbedtls-dont-overwrite-headers.patch just needs to have /crypto/ added to the file paths (and the ebuild revbumped to get people to rebuild it).
Comment 21 Hector Martin 2020-01-31 07:44:01 UTC
Ah, I see that happened already. This should be fixed then, except people need to manually rebuild mbedtls.

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9bdff0e5ea288b745e38ef08914fe141a127902c
Comment 22 Chiitoo gentoo-dev 2020-04-03 21:26:53 UTC
Seems to be working with '2.19.1-r2' now.

Thanks!