-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build fails with "error: ‘av_register_all’ was not declared in this scope" #1411
Comments
I am getting same errors when trying to compile for android
|
Get same error when build ios |
Hi @dbogdanov can you please help here? this is happening even on normal build from master branch |
Okay, so, this persists, and, Essentia desperately needs pre-built libraries because compiling C++ is borderline impossible if you care about your sanity. @dbogdanov Same logs, same error messages, One in here: https://github.com/MTG/essentia/blob/master/src/algorithms/io/audioloader.h#L98 And others here: https://github.com/MTG/essentia/blob/master/src/essentia/utils/audiocontext.cpp#L33 Then we need to downgrade ourselves to version 4 of ffmpeg because there is a
there is only two occurrences of this function call. If I delete both (it is recommended to replace them with nothing), then the How the fuck are we going to find the latest version of ffmpeg 4. X? This is where things get beyond fucked up. In this patch, at, Sept. 15, 2021
from all libraries. So I am picking version 4.4 which released on 2021-04-09 Get the source code: $ wget https://ffmpeg.org/releases/ffmpeg-4.4.tar.xz
$ tar -xf ffmpeg-4.4.tar.xz
$ cd ffmpeg-4.4 Then build the ffmpeg yourself: ./configure --disable-doc \
--disable-htmlpages \
--disable-manpages \
--disable-podpages \
--disable-txtpages \
--pkg-config-flags="--static" \
--ld="g++" sudo make
sudo make install
# compile breaks if i don't remove decklink headers, try yourself before removing
sudo rm libavdevice/decklink* Configure won't throw any errors. If you run
You are coming with me. Apply the following patch: https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/effadce6c756247ea8bae32dc13bb3e6f464f0eb with either using patch -i ffmpeg.patch where If you want to manually edit, open Change the #define NEG_USR32 NEG_USR32
static inline uint32_t NEG_USR32(uint32_t a, int8_t s) {
if (__builtin_constant_p(s))
__asm__("shrl %1, %0\n\t" : "+r"(a) : "i"(-s & 0x1F));
else
__asm__("shrl %1, %0\n\t" : "+r"(a) : "c"((uint8_t)(-s)));
return a;
} Change the #define NEG_SSR32 NEG_SSR32
static inline int32_t NEG_SSR32(int32_t a, int8_t s) {
if (__builtin_constant_p(s))
__asm__("sarl %1, %0\n\t" : "+r"(a) : "i"(-s & 0x1F));
else
__asm__("sarl %1, %0\n\t" : "+r"(a) : "c"((uint8_t)(-s)));
return a;
} Change the #define MULL MULL
static av_always_inline av_const int MULL(int a, int b, unsigned shift) {
int rt, dummy;
__asm__(
"imull %3 \n\t"
"shrdl %4, %%edx, %%eax \n\t"
: "=a"(rt), "=d"(dummy)
: "a"(a), "rm"(b), "i"(shift & 0x1F));
return rt;
} then run the make command again. If you have no errors, yay, we are in the same state! If make errors out, god save your soul, you are not with me anymore.
run sudo make install if you got any errors, good luck, you are out again, if you see something like this when you run the built ffmpeg (essentia) ➜ ffmpeg-4.4.2 ./ffmpeg -version
ffmpeg version 4.4.2 Copyright (c) 2000-2021 the FFmpeg developers Then we are together again, and we are almost there! I say almost, because holy fucking shit, it does not end. Now that we have compiled FFMPEG, we can compile Essentia git clone https://github.com/MTG/essentia.git
cd essentia
python3 waf configure --build-static --with-tensorflow python3 waf there wont be any errors. if, somehow, you got error here, my condolences, you are out of my reach. if you have seen this output
run
previously, I thought building inside a virtual environment and then moving the include headers + library to the source code folder is the solution, but, if you run the waf install outside of a virtual environment, waf will place all the files to /usr/local/..., and library wont work outside of /usr/local/... Now it is time for GLSLang for libavcodec and various libraries of ffmpeg. git clone https://github.com/KhronosGroup/glslang.git
cd glslang
python3 update_glslang_sources.py
BUILD_DIR="build"
cmake -B $BUILD_DIR -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install"
make -j4 install
sudo ln -s /usr/local/bin/glslang /usr/bin/glslang
sudo ln -s /usr/local/bin/spirv-remap /usr/bin/spirv-remap hope there wont be any errors for you. optionally, gtest. sudo apt-get install -y libgtest-dev cmake
mkdir -p $HOME/build
cd $HOME/build
sudo cmake /usr/src/googletest/googletest
sudo make
sudo cp lib/libgtest* /usr/lib/
cd ..
sudo rm -rf build
sudo mkdir /usr/local/lib/googletest
sudo ln -s /usr/lib/libgtest.a /usr/local/lib/googletest/libgtest.a
sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/googletest/libgtest_main.a cmake time., get the following from your package manager (x11 and video accel is optional), Ubuntu: sudo apt-get install \
libva-dev \
libyaml-dev \
libvdpau-dev \
libx11-dev \
libsamplerate0-dev \
libprotobuf-dev \
protobuf-compiler \
libglslang-dev \
libeigen3-dev \
libfftw3-dev \
libchromaprint-dev \
libtagc0-dev \
libva-drm2 \
libbz2-dev \
liblzma-dev \
zlib1g-dev slam this to
save this to #include <essentia/algorithmfactory.h>
#include <essentia/essentia.h>
#include <essentia/pool.h>
#include <vector>
using namespace essentia;
using namespace essentia::standard;
int main(int argc, char** argv) {
essentia::init();
Pool pool;
AlgorithmFactory& factory = standard::AlgorithmFactory::instance();
Algorithm* loader = factory.create("MonoLoader", "filename",
"01. A Cleaved Head No Longer Plots.mp3",
"sampleRate", 44100);
Algorithm* duration = factory.create("Duration", "sampleRate", 44100);
std::vector<Real> audioBuffer;
Real durationSecond;
loader->output("audio").set(audioBuffer);
duration->input("signal").set(audioBuffer);
duration->output("duration").set(durationSecond);
loader->compute();
duration->compute();
factory.free(loader);
factory.free(duration);
essentia::shutdown();
std::cout << durationSecond << std::endl;
return 0;
} change the audio path, configure, compile, run, have fun. tldr: if you don't have any solid reasons, just use python bindings instead. peace. edit: bunch of typos, bad english, poor grammar, pinch me if you dont understand anything |
Updates, I have managed to compile CPP library by myself, attached a CMakeLists.txt, if any future readers stumble upon this and follow the comment, let me know if anything goes wrong, I can use Essentia + QT without any problems and fairly fast compilation time. |
Build fails with the following error:
The text was updated successfully, but these errors were encountered: