I was trying to build/play-around-with the following project: https://github.com/friction2d/friction/blob/main/BUILD.md
Reading the project's build instructions, it requires some specific dependencies(ffmpeg 4.2.x for example), and since I am on fedora, I believe it is not very straight forward to get these dependencies just for this project. Because of this I looked into nix-shell as it seemed like it could be a helpful facilitator for creating the correct building environment for this project. After some research, I installed nix and configured nix-direnv. I created a shell.nix file for the project, and I believe I am very close to having a correct definition. The thing I am stuck on is: I can't seem to import/override/whatever the correct ffmpeg version, and all my attempts so far have not worked.
Atm, my shell.nix file looks like this:
shell.nix
with import <nixpkgs> {};
let
nixgl = import (fetchTarball "https://github.com/nix-community/nixGL/archive/main.tar.gz") { };
ffmpeg_4_2_3 = ffmpeg.override {
version = "4.2.3";
hash = "sha256-PibcYItd8Ls/sXdFqzjlJGNeNYqNwopXMGBOP18eEzg=";
};
in
mkShell {
nativeBuildInputs = [
pkg-config
cmake
clang_17
];
buildInputs = [
libglvnd
nixgl.auto.nixGLDefault
xorg.libX11
pcre2
expat
libunwind
freetype
harfbuzz
glib
fontconfig
libjpeg
libwebp
icu
libsForQt5.qscintilla
libsForQt5.full
ffmpeg_4_2_3
];
}
I also made some modifications inside src/app/CMakeLists.txt
for qscintilla paths, like noted in the build instructions:
src/app/CMakeLists.txt - line 74
#original# set(QSCINTILLA_LIBRARIES_DIRS "/usr/lib" CACHE STRING "qscintilla library path")
#original# set(QSCINTILLA_LIBRARIES "qscintilla2_qt5" CACHE STRING "qscintilla library")
#original# set(QSCINTILLA_INCLUDE_DIRS "/usr/include/x86_64-linux-gnu/qt5" CACHE STRING "qscintilla includes path")
execute_process (
COMMAND nix-instantiate --eval -E "with import <nixpkgs> {}; lib.makeIncludePath [ libsForQt5.qscintilla ]"
COMMAND sed "s/\"//g"
OUTPUT_VARIABLE myvar1
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process (
COMMAND nix-instantiate --eval -E "with import <nixpkgs> {}; lib.makeLibraryPath [ libsForQt5.qscintilla ]"
COMMAND sed "s/\"//g"
OUTPUT_VARIABLE myvar2
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(QSCINTILLA_LIBRARIES "qscintilla2")
set(QSCINTILLA_INCLUDE_DIRS ${myvar1})
set(QSCINTILLA_LIBRARIES_DIRS ${myvar2})
The nix-shell currently fails with the following output:
nix-shell error log
warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/4q1gxrjyn0spvjiwlcqwc5pkwc3pyw6v-ffmpeg-4.2.3.drv^*'
got build log for '/nix/store/4q1gxrjyn0spvjiwlcqwc5pkwc3pyw6v-ffmpeg-4.2.3.drv' from 'local'
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/9v0kfi9ga3lvdvq7k7hzbafshhzwr3bc-ffmpeg
source root is ffmpeg
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
patching script interpreter paths in .
./compat/cuda/ptx2c.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./compat/solaris/make_sunver.pl: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/ww69rb7srifikvilg39q4v8n9h1zcssf-perl-5.38.2/bin/perl"
./compat/windows/makedef: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./compat/windows/mslink: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./configure: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./doc/doxy-wrapper.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./ffbuild/pkgconfig_generate.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./ffbuild/version.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tests/copycooker.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tests/fate-run.sh: interpreter directive changed from "#! /bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tests/fate.sh: interpreter directive changed from "#! /bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tests/fate/source-check.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tools/bisect-create: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tools/cl2c: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tools/clean-diff: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tools/dvd2concat: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/ww69rb7srifikvilg39q4v8n9h1zcssf-perl-5.38.2/bin/perl"
./tools/gen-rc: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tools/libav-merge-next-commit: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tools/make_chlayout_test: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/ww69rb7srifikvilg39q4v8n9h1zcssf-perl-5.38.2/bin/perl"
./tools/missing_codec_desc: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tools/murge: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tools/patcheck: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tools/plotframes: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/ww69rb7srifikvilg39q4v8n9h1zcssf-perl-5.38.2/bin/perl"
./tools/target_dec_fate.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
./tools/unwrap-diff: interpreter directive changed from "#!/bin/sh" to "/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh"
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
patching script interpreter paths in ./configure
configure flags: --disable-static --prefix=/nix/store/dqm96bk6w5fkmq50zksj0lfmirhw50q5-ffmpeg-4.2.3 --target_os=linux --arch=x86_64 --pkg-config=pkg-config --enable-gpl --enable-version3 --disable-nonfree --disable-static --enable-shared --enable-pic --disable-thumb --disable-small --enable-runtime-cpudetect --disable-gray --enable-swscale-alpha --enable-hardcoded-tables --enable-safe-bitstream-reader --enable-pthreads --disable-w32threads --disable-os2threads --enable-network --enable-pixelutils --datadir=/nix/store/lfwdmxzklnvc9r49ipbbdh76a0rv3l99-ffmpeg-4.2.3-data/share/ffmpeg --enable-ffmpeg --enable-ffplay --enable-ffprobe --bindir=/nix/store/0g9hqqh06p9c9hsi70kzpbq3jxv1fdi8-ffmpeg-4.2.3-bin/bin --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avresample --enable-avutil --enable-postproc --enable-swresample --enable-swscale --libdir=/nix/store/csfb939rimkfwlhpqr30l50maw5044bl-ffmpeg-4.2.3-lib/lib --incdir=/nix/store/mpm1sx7zs7hb3j59ykizzqbd2v0ql4ip-ffmpeg-4.2.3-dev/include --enable-doc --enable-htmlpages --enable-manpages --mandir=/nix/store/inkqgvxanp5haad5qn6jikdk096519aw-ffmpeg-4.2.3-man/share/man --enable-podpages --enable-txtpages --docdir=/nix/store/7kihjq7nv9a6ah4sqa5rrj4nih27psh1-ffmpeg-4.2.3-doc/share/doc/ffmpeg --enable-alsa --enable-amf --enable-libaom --disable-appkit --enable-libass --disable-audiotoolbox --disable-avfoundation --disable-avisynth --disable-libbluray --disable-libbs2b --enable-bzlib --disable-libcaca --enable-libcelt --disable-chromaprint --disable-libcodec2 --disable-coreimage --disable-cuda --disable-cuda-llvm --enable-cuvid --enable-libdav1d --disable-libdc1394 --enable-libdrm --disable-libfdk-aac --enable-ffnvcodec --disable-libflite --enable-fontconfig --enable-libfontconfig --enable-libfreetype --disable-frei0r --disable-libfribidi --disable-libgme --enable-gnutls --disable-libgsm --enable-iconv --disable-libilbc --disable-libjack --disable-ladspa --enable-lzma --disable-libmfx --disable-libmodplug --enable-libmp3lame --disable-libmysofa --enable-nvdec --enable-nvenc --disable-openal --disable-opencl --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-opengl --disable-libopenh264 --enable-libopenjpeg --disable-libopenmpt --enable-libopus --enable-libpulse --disable-librav1e --disable-librtmp --disable-librubberband --disable-libsmbclient --enable-sdl2 --disable-libshine --disable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --disable-librsvg --enable-libsvtav1 --disable-libtensorflow --enable-libtheora --disable-libtwolame --enable-libv4l2 --enable-v4l2-m2m --enable-vaapi --enable-vdpau --disable-videotoolbox --disable-libvidstab --disable-libvmaf --disable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-vulkan --enable-libwebp --enable-libx264 --enable-libx265 --disable-libxavs --disable-libxcb --disable-libxcb-shape --disable-libxcb-shm --disable-libxcb-xfixes --disable-xlib --disable-libxml2 --enable-libxvid --enable-libzimg --enable-zlib --disable-libzmq --disable-debug --enable-optimizations --disable-extra-warnings --disable-stripping
Unknown option "--disable-librav1e".
See ./configure --help for available options.
It looks to be building ffmpeg 4.2.3 from source instead of using the cache, which makes sense as I have overridden the package to use a custom version.
The build(ffmpeg 4.2.3) however fails with the error Unknown option "--disable-librav1e"
.
If anyone has an idea what I am doing wrong, it would help me alot.
Nice, many people have a nvidia graphics pc. This seems very helpful for all non technical users.