complexlogic / rsgain

A simple, but powerful ReplayGain 2.0 tagging utility
Other
289 stars 21 forks source link

How to build this for Fedora with proprietary FFMPEG codecs installed? #85

Closed kylxbn closed 1 year ago

kylxbn commented 1 year ago

I use Fedora with the proprietary codecs and the complete FFMPEG software (including x264) installed. However, I cannot build the source because:

Problem 1: package libavformat-free-devel-6.0-2.fc38.i686 from fedora requires libavformat-free(x86-32) = 6.0-2.fc38, but none of the providers can be installed
Problem 2: package libavcodec-free-devel-6.0-2.fc38.i686 from fedora requires libavcodec-free(x86-32) = 6.0-2.fc38, but none of the providers can be installed
Problem 3: package libswresample-free-devel-6.0-2.fc38.i686 from fedora requires libswresample-free(x86-32) = 6.0-2.fc38, but none of the providers can be installed

Trying to install the RPM file directly results in a similar thing.

package rsgain-3.4-1.x86_64 from @commandline requires libswresample-free >= 6, but none of the providers can be installed
package ffmpeg-libs-6.0-6.fc38.x86_64 from rpmfusion-free conflicts with libswresample-free provided by libswresample-free-6.0-2.fc38.x86_64 from fedora

Can you please help me install the dependencies needed to build this?

complexlogic commented 1 year ago

The provided rsgain RPM package won't work, because it was built against the standard Fedora FFmpeg package. You need to build from source yourself.

You can't use the dependency installation command from the build instructions, because that's tailored for the standard Fedora repo also. Substitue the equivalent RPM Fusion packages where appropriate. I believe that would be ffmpeg-libs, which you already have installed.

kylxbn commented 1 year ago

Thank you for the reply. It seems that RPM Fusion does not include -devel packages in their repository, and those -devel packages on Fedora conflict with the RPM Fusion packages, so I can't build the package, because it keeps on saying this:

-- Checking for module 'libavcodec'
--   Package 'libavcodec', required by 'virtual:world', not found

I think I might return to Arch Linux... maybe...

complexlogic commented 1 year ago

You could also build static FFmpeg libraries from source. rsgain requires only a very basic FFmpeg.

kylxbn commented 1 year ago

For now, I settled with running the Windows version of rsgain via Wine and while it does work, there are a lot of visual (not functional) glitches that make it a bit worrisome to use, mainly Wine's stub function reporting and the lack of support for UTF-8 Unicode characters. Still, it does work. Not the optimal solution but it does work.

I wish there was an easier way to build and run this natively on Linux.

complexlogic commented 1 year ago

I'm working on providing some static builds for Linux that work on most/all distros. Download the build here and let me know if it works for you.

kylxbn commented 1 year ago

Tried on Fedora 38 GNOME, RPM Fusion FFMPEG installed, worked perfectly fine!

Added the executable to $PATH, added the custom presets on XDG Config folder, tried scanning a bunch of WavPack files, with a custom preset. Scanning and analyzing was fast, and correct metadata were written to the files.

Thanks for this! It would be awesome if the prebuilt executables were distributed in future releases... Unfortunately, Linux isn't made for prebuilt executables and adding them to releases might be a pain to manage, but for some users like me, it's the easiest way...

complexlogic commented 1 year ago

The builds are generated and uploaded automatically by GitHub's CI, so managing it won't be an issue.

One thing I recommend is to run strip on the extracted executable, e.g. strip /path/to/rsgain. That will remove the unused symbols from the binary and should bring the uncompressed size down to around 4-5 MB. I'm going to add this to the build script so it is done automatically, but I haven't had the chance to incorporate it yet.

magicgoose commented 1 year ago

Which steps do you use to make such a build? I've tried what I could and I can't get past

> CXX=gcc cmake .. -DCMAKE_BUILD_TYPE=Release
-- Checking for module 'libavcodec'
--   Package 'libavcodec', required by 'virtual:world', not found
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:607 (message):
  A required package was not found

normal libavcodec-devel can't be installed due to conflicts, and the secret-sauce libavcodec variant has no -devel package.

complexlogic commented 1 year ago

@magicgoose I'm working on adding automatic building of dependencies to the build system. Not done yet, but my current progress is available in the static_build branch. The following commands will automatically compile rsgain along with a static FFmpeg, using system libs for all other dependencies:

git clone -b static_build https://github.com/complexlogic/rsgain.git
cd rsgain && mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DVCPKG=ON -DVCPKG_MANIFEST_FEATURES="ffmpeg;"
make
magicgoose commented 10 months ago

@complexlogic thanks for this build instruction, works perfectly!