media-kit / media-kit

A cross-platform video player & audio player for Flutter & Dart.
https://github.com/media-kit/media-kit
MIT License
916 stars 132 forks source link

Error when building on Fedora 39 #595

Closed zyrouge closed 5 months ago

zyrouge commented 6 months ago

Part where build fails:

[+2082 ms] [1/19] Building CXX object plugins/media_kit_native_event_loop/shared/CMakeFiles/media_kit_native_event_loop.dir/media_kit_native_event_loop.cc.o
[   +2 ms] FAILED: plugins/media_kit_native_event_loop/shared/CMakeFiles/media_kit_native_event_loop.dir/media_kit_native_event_loop.cc.o 
[  +56 ms] /usr/bin/clang++ -D-pthread -DAPPLICATION_ID=\"io.github.yukino_org.kazahana\" -DDART_SHARED_LIB -D_REENTRANT -Dmedia_kit_native_event_loop_EXPORTS -isystem
/usr/include/spa-0.2 -isystem /usr/include/vapoursynth -isystem /usr/include/freetype2 -isystem /usr/include/cdio -isystem /usr/include/ffmpeg -isystem
/usr/include/lua-5.1 -isystem /usr/include/SDL2 -isystem /usr/include/uchardet -isystem /usr/include/AL -isystem /usr/include/pipewire-0.3 -isystem /usr/include/libdrm
-isystem /usr/include/ffnvcodec -isystem /usr/include/sysprof-6 -isystem /usr/include/python3.12 -isystem /usr/include/fribidi -isystem /usr/include/glib-2.0 -isystem
/usr/lib64/glib-2.0/include -isystem /usr/include/libpng16 -isystem /usr/include/libxml2 -isystem /usr/include/harfbuzz -g -std=gnu++17 -fPIC -D_REENTRANT -pthread -MD
-MT plugins/media_kit_native_event_loop/shared/CMakeFiles/media_kit_native_event_loop.dir/media_kit_native_event_loop.cc.o -MF
plugins/media_kit_native_event_loop/shared/CMakeFiles/media_kit_native_event_loop.dir/media_kit_native_event_loop.cc.o.d -o
plugins/media_kit_native_event_loop/shared/CMakeFiles/media_kit_native_event_loop.dir/media_kit_native_event_loop.cc.o -c
/home/zyrouge/Vault/ZDev/yukino-org/kazahana/linux/flutter/ephemeral/.plugin_symlinks/media_kit_native_event_loop/src/media_kit_native_event_loop.cc
[  +27 ms] In file included from <built-in>:446:
[        ] <command line>:1:9: error: macro name must be an identifier
[   +3 ms]     1 | #define -pthread 1
[        ]       |         ^
[        ] 1 error generated.
alexmercerind commented 6 months ago

Don't use Flutter from snap... if you are.

zyrouge commented 6 months ago

Don't use Flutter from snap... if you are.

I am not using Flutter from Snap.

alexmercerind commented 6 months ago

Then you're on your own... our CI passes.

zyrouge commented 6 months ago

Then you're on your own... our CI passes.

Could you hint what could be the possible issue? Is it with flutter or some other tooling like clang?

zyrouge commented 6 months ago

Tried my best and the only this I could suspect is the Clang version itself. I was able to run this on Fedora 38 (which had Clang 16), but with Fedora 39 (has Clang 17), it no longer works. I'll probably try building it in a VM if possible to check what is happening.

alexmercerind commented 6 months ago

I don't really know man about this ... so much can be different across Linux distributions, there's no hard & fast rule.

Do share us any details if you find, we'll add to README.

Thanks!

zyrouge commented 6 months ago

Seems like a Clang issue to me. Seems to build fine on Lubuntu LTS (has Clang 16) but not on Fedora 39 (Clang 17). I'm not sure how Flutter (or CMake) builds these plugins so I'll have to figure that out.

zyrouge commented 6 months ago

I can also confirm that Flutter itself works on both Clang 16 and 17.

iapicca commented 6 months ago

Then you're on your own... our CI passes.

@alexmercerind of course your CI passes, it tests on ubuntu!

zyrouge commented 6 months ago

Then you're on your own... our CI passes.

@alexmercerind of course your CI passes, it tests on ubuntu!

I mean it does, everyone builds their app compatible with Ubuntu LTS like 75% of the time, it's no wonder. It's also hard to test with multiple distros in multiple configuration. Gotta give this some time since Fedora 39 was just released.

alexmercerind commented 6 months ago

First of all, I don't think this issue relates to flutter/flutter.


Of course your CI passes, it tests on Ubuntu!

Certainly someone using Fedora knows better about Fedora (& has better opportunity to figure out) than I do.


Comment on #594:

We do not provide our own libmpv binaries for GNU/Linux, unlike other platforms (probably we may have static builds sometime in future; contributions welcomed).

It does not matter to me how one installs libmpv on their system. If you're using a GNU/Linux distribution, you must know in & out of your operating system & not expect it from me (& I don't know in this case). Like I said above, there's no hard & fast rule. I don't care, if you:

In this case, better option might be to reach out to maintainers of the libmpv package for Fedora etc... wherever you are installing it from (it's not us).

On other conventional platforms, we provide our own standalone binaries which are bundled along with the application.


Thanks!

alexmercerind commented 6 months ago

@zyrouge,

You can try to add pthread below this line locally:

https://github.com/media-kit/media-kit/blob/0ab6b10ea660ead8e8e1694517aabe3582f25d5c/media_kit_native_event_loop/src/CMakeLists.txt#L65

See if that works.


As such:

target_link_libraries(
  ${TARGET_NAME} PRIVATE
  PkgConfig::mpv
  pthread
)
zyrouge commented 6 months ago

That didn't change anything in the logs,

[  +33 ms] Building Linux application...
[  +13 ms] <- compile package:kazahana/main.dart
[   +3 ms] executing: [build/linux/x64/debug/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DFLUTTER_TARGET_PLATFORM=linux-x64
/home/zyrouge/Vault/ZDev/yukino-org/kazahana/linux
[ +151 ms] -- Configuring done (0.1s)
[  +69 ms] -- Generating done (0.1s)
[  +14 ms] -- Build files have been written to: /home/zyrouge/Vault/ZDev/yukino-org/kazahana/build/linux/x64/debug
[  +11 ms] executing: ninja -C build/linux/x64/debug install
[  +12 ms] ninja: Entering directory `build/linux/x64/debug'
[+1904 ms] [1/19] Building CXX object plugins/media_kit_native_event_loop/shared/CMakeFiles/media_kit_native_event_loop.dir/media_kit_native_event_loop.cc.o
[   +2 ms] FAILED: plugins/media_kit_native_event_loop/shared/CMakeFiles/media_kit_native_event_loop.dir/media_kit_native_event_loop.cc.o 
[  +57 ms] /usr/bin/clang++ -D-pthread -DAPPLICATION_ID=\"io.github.yukino_org.kazahana\" -DDART_SHARED_LIB -D_REENTRANT -Dmedia_kit_native_event_loop_EXPORTS -isystem
/usr/include/spa-0.2 -isystem /usr/include/vapoursynth -isystem /usr/include/freetype2 -isystem /usr/include/cdio -isystem /usr/include/ffmpeg -isystem
/usr/include/lua-5.1 -isystem /usr/include/SDL2 -isystem /usr/include/uchardet -isystem /usr/include/AL -isystem /usr/include/pipewire-0.3 -isystem /usr/include/libdrm
-isystem /usr/include/ffnvcodec -isystem /usr/include/sysprof-6 -isystem /usr/include/python3.12 -isystem /usr/include/fribidi -isystem /usr/include/glib-2.0 -isystem
/usr/lib64/glib-2.0/include -isystem /usr/include/libpng16 -isystem /usr/include/libxml2 -isystem /usr/include/harfbuzz -g -std=gnu++17 -fPIC -D_REENTRANT -pthread -MD
-MT plugins/media_kit_native_event_loop/shared/CMakeFiles/media_kit_native_event_loop.dir/media_kit_native_event_loop.cc.o -MF
plugins/media_kit_native_event_loop/shared/CMakeFiles/media_kit_native_event_loop.dir/media_kit_native_event_loop.cc.o.d -o
plugins/media_kit_native_event_loop/shared/CMakeFiles/media_kit_native_event_loop.dir/media_kit_native_event_loop.cc.o -c
/home/zyrouge/Vault/ZDev/yukino-org/kazahana/linux/flutter/ephemeral/.plugin_symlinks/media_kit_native_event_loop/src/media_kit_native_event_loop.cc
[  +15 ms] In file included from <built-in>:446:
[   +1 ms] <command line>:1:9: error: macro name must be an identifier
[   +6 ms]     1 | #define -pthread 1
[        ]       |         ^
[        ] 1 error generated.
TechComet commented 6 months ago
[        ] [ +568 ms] release_bundle_linux-x64_assets: Complete
[        ] [  +66 ms] Persisting file store
[        ] [  +11 ms] Done persisting file store
[        ] [  +14 ms] build succeeded.
[        ] [  +13 ms] "flutter assemble" took 33,822ms.
[        ] [ +170 ms] ensureAnalyticsSent: 156ms
[        ] [        ] Running 0 shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [        ] exiting with code 0
[   +1 ms] ninja: build stopped: subcommand failed.
[  +29 ms] Building Linux application... (completed in 38.2s)
[   +1 ms] "flutter linux" took 39,472ms.
[   +4 ms] Build process failed
[        ] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _runBuild (package:flutter_tools/src/linux/build_linux.dart:186:5)
           <asynchronous suspension>
           #2      buildLinux (package:flutter_tools/src/linux/build_linux.dart:80:5)
           <asynchronous suspension>
           #3      BuildLinuxCommand.runCommand (package:flutter_tools/src/commands/build_linux.dart:89:5)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1350:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:348:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:294:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:112:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:90:3)
           <asynchronous suspension>

[ +197 ms] ensureAnalyticsSent: 183ms
[   +3 ms] Running 0 shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1
zyrouge commented 6 months ago
[        ] [ +568 ms] release_bundle_linux-x64_assets: Complete
[        ] [  +66 ms] Persisting file store
[        ] [  +11 ms] Done persisting file store
[        ] [  +14 ms] build succeeded.
[        ] [  +13 ms] "flutter assemble" took 33,822ms.
[        ] [ +170 ms] ensureAnalyticsSent: 156ms
[        ] [        ] Running 0 shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [        ] exiting with code 0
[   +1 ms] ninja: build stopped: subcommand failed.
[  +29 ms] Building Linux application... (completed in 38.2s)
[   +1 ms] "flutter linux" took 39,472ms.
[   +4 ms] Build process failed
[        ] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _runBuild (package:flutter_tools/src/linux/build_linux.dart:186:5)
           <asynchronous suspension>
           #2      buildLinux (package:flutter_tools/src/linux/build_linux.dart:80:5)
           <asynchronous suspension>
           #3      BuildLinuxCommand.runCommand (package:flutter_tools/src/commands/build_linux.dart:89:5)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1350:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:348:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:294:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:112:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:90:3)
           <asynchronous suspension>

[ +197 ms] ensureAnalyticsSent: 183ms
[   +3 ms] Running 0 shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

Add the --verbose for more explicit logs. This way we can see it's the same error.

femalemonkeyman commented 5 months ago

It's not the clang version, I am now having this issue on Arch linux with clang 16

femalemonkeyman commented 5 months ago

If the offending lines -D-pthread are removed from the ninja build file you can manually run ninja to build and it builds successfully

CosmicRaptor commented 4 weeks ago

Would like to add that this is still an issue on fedora 40(Clang 18)

The merged PR fixes it, I hope you release it soon on pub.dev

Thanks!

TechComet commented 4 weeks ago
dependencies:
  #  ...
  media_kit: any
  media_kit_video: any
  media_kit_libs_video: any
  media_kit_native_event_loop: any

dependency_overrides:
  media_kit:
    git:
      url: https://github.com/media-kit/media-kit
      path: media_kit
      ref: main
  media_kit_video:
    git:
      url: https://github.com/media-kit/media-kit
      path: media_kit_video
      ref: main
  media_kit_libs_video:
    git:
      url: https://github.com/media-kit/media-kit
      path: libs/universal/media_kit_libs_video
      ref: main

  media_kit_native_event_loop:
    git:
      url: https://github.com/media-kit/media-kit
      path: media_kit_native_event_loop
      ref: main

work on Fedora

TechComet commented 4 weeks ago

youtube, vimeo work on dart_vlc but not work on media-kit