-
Notifications
You must be signed in to change notification settings - Fork 541
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. |
On what platform? I couldn't do it on Android 😢 |
@Joelcgx can you send the error message? |
Give me time to recompile because I formatted my computer, but the error came when I used the .so in android studio like when using essentia::init |
Yee I got you, hit me back with full compile log. Also be sure that you are not using the latest tensorflow libraries, use 2.12 for good measure. I will be here for three hours, i can respond instantly during that timeframe |
Compile FFmpeg 4.4 and EssentiaBelow is the script I used to compile: Script:
|
Is the libraries and headers under /usr/local/lib/libavutil.a latest ffmpeg? They have to be version 4.4 or lower. I dont know how you can determine it, but you should check the FFMPEG library versions first |
I followed those steps ffmpeg --version (Sorry if I'm very stupid or ignorant haha I'm new to this) joelcgx@joelcgx-HP-Compaq-8200-Elite-CMT-PC:~/Documentos/C++/ffmpeg-4.4$ ffmpeg --version
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 13 (Ubuntu 13.3.0-6ubuntu2~24.04)
configuration: --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --pkg-config-flags=--static --ld=g++
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
Unrecognized option '-version'.
Error splitting the argument list: Option not found
joelcgx@joelcgx-HP-Compaq-8200-Elite-CMT-PC:~/Documentos/C++/ffmpeg-4.4$
|
okay then it should all be fine. without doing make install, can you link to the libraries directly instead? like this https://github.com/caner-cetin/conan/blob/ffeb80726685f4421137a6c011bef4c6cf221731/CMakeLists.txt#L158 ffmpeg folder you are in contains all the required library, check relevant parts in my cmake |
I delete using sudo make uninstall and then use cmakelist.txt?? |
nonononono, keep the ffmpeg folder and your source folder as it is. are you using make? if yes, move on to the cmake if you can, if not, just replicate what I did with FFMpeg on make. All you have to do is take your ffmpeg folder, which, after you built the ffmpeg, every library folder will contain a binary such as libavcodec folder will have libavcodec.a and so on. As you see in my CMakeLists, I include all of that library folders and all the libraries inside the folders. Dont delete anything, just follow what I did on my CMakeLists. I know its convoluted but you can extract ffmpeg relevant bits fairly easily. |
Ok, I won't delete anything, this is the cmakelist I made, I don't know if it's right, but what do I put in source? A main.cpp (oh god I feel so stupid haha) # Specify the minimum version of CMake
cmake_minimum_required(VERSION 3.14)
# Project name
project(FFmpegProject)
# FFmpeg path (adjust this path according to your setup)
set(FFMPEG_PATH "/home/joelcgx/Documentos/C++/ffmpeg-4.4")
# Include FFmpeg headers
include_directories(
${FFMPEG_PATH}/libavutil
${FFMPEG_PATH}/libavcodec
${FFMPEG_PATH}/libavformat
${FFMPEG_PATH}/libavdevice
${FFMPEG_PATH}/libavfilter
${FFMPEG_PATH}/libswresample
${FFMPEG_PATH}/libswscale
)
# Find all libraries in the FFmpeg folders
file(GLOB FFMPEG_LIBS
${FFMPEG_PATH}/libavutil/libavutil.a
${FFMPEG_PATH}/libavcodec/libavcodec.a
${FFMPEG_PATH}/libavformat/libavformat.a
${FFMPEG_PATH}/libavdevice/libavdevice.a
${FFMPEG_PATH}/libavfilter/libavfilter.a
${FFMPEG_PATH}/libswresample/libswresample.a
${FFMPEG_PATH}/libswscale/libswscale.a
)
# Specify the source files of your project
file(GLOB SOURCES
${CMAKE_SOURCE_DIR}/src/main.cpp
)
# Create the executable
add_executable(${PROJECT_NAME} ${SOURCES})
# Link the FFmpeg libraries
target_link_libraries(${PROJECT_NAME}
${FFMPEG_LIBS}
pthread
m
)
|
yeeee you going right. dont fill main cpp, just put boilerplate empty main code inside main.cpp, compile, and if it compiles && builds, go into the ffmpeg folder then do
in the folder aaaand then compile essentia. you got this mate i believe in youz |
I get this, something went wrong joelcgx@joelcgx-HP-Compaq-8200-Elite-CMT-PC:~/Documentos/C++/ffmpeg-4.4/build$ cmake ..
-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/joelcgx/Documentos/C++/ffmpeg-4.4/build
joelcgx@joelcgx-HP-Compaq-8200-Elite-CMT-PC:~/Documentos/C++/ffmpeg-4.4/build$ make
[ 50%] Building CXX object CMakeFiles/FFmpegProject.dir/main.cpp.o
[100%] Linking CXX executable FFmpegProject
[100%] Built target FFmpegProject
joelcgx@joelcgx-HP-Compaq-8200-Elite-CMT-PC:~/Documentos/C++/ffmpeg-4.4/build$ sudo make install
[sudo] contraseña para joelcgx:
make: *** No hay ninguna regla para construir el objetivo 'install'. Alto.
joelcgx@joelcgx-HP-Compaq-8200-Elite-CMT-PC:~/Documentos/C++/ffmpeg-4.4/build$
|
i understand the cause of error but i never encountered something like this what the fuck. Can you try re launching terminal, sudo make and sudo make install again? I dont know what is wrong because there is clearly a rule for install command in make. |
Well I tried to compile Essentia and it didn't throw an error: joelcgx@joelcgx-HP-Compaq-8200-Elite-CMT-PC:~/Documentos/C++/essentia$ sudo python3 waf build -p -j8
/home/joelcgx/Documentos/C++/essentia/wscript:211: SyntaxWarning: invalid escape sequence '\w'
"""
Waf: Entering directory `/home/joelcgx/Documentos/C++/essentia/build'
→ building from /home/joelcgx/Documentos/C++/essentia
→ building from /home/joelcgx/Documentos/C++/essentia/src
Building all the algorithms
Ignoring the following algorithms: TensorflowPredictEffnetDiscogs, IFFTW, Resample, MusicExtractorSVM, MonoLoader, TensorflowPredictMAEST, EqloudLoader, MusicExtractor, GaiaTransform, AudioLoader, PitchCREPE, TensorflowPredict2D, IFFTAComplex, YamlInput, MonoWriter, Chromaprinter, AudioWriter, YamlOutput, FFTAComplex, FreesoundExtractor, TensorflowPredictFSDSINet, TensorflowPredictVGGish, EasyLoader, TensorflowPredict, MetadataReader, IFFTA, TensorflowPredictMusiCNN, FFTWComplex, TensorflowPredictCREPE, FFTW, FFTA, TensorflowPredictTempoCNN, IFFTWComplex, TempoCNN
Created algorithms registration file
[292/292][100%][\][==============================================================================================================================>][5m11.218s]
Waf: Leaving directory `/home/joelcgx/Documentos/C++/essentia/build'
'build' finished successfully (5m11.341s)
Do I need to do something else or do I try it in Android Studio and tell you what happens? |
holy shit okay you got this. do and then again you will see essentia on my cmakelists, put it on the correct order related to ffmpeg (above ffmpeg) then compile run report me back |
Wait wait wait dont do anything. Why is every single algorithm here ignored? Send me output of |
edit: Even now it doesn't detect ffmpeg joelcgx@joelcgx-HP-Compaq-8200-Elite-CMT-PC:~/Documentos/C++/essentia$ python3 waf configure --build-static --with-tensorflow
/home/joelcgx/Documentos/C++/essentia/wscript:211: SyntaxWarning: invalid escape sequence '\w'
"""
Setting top to : /home/joelcgx/Documentos/C++/essentia
Setting out to : /home/joelcgx/Documentos/C++/essentia/build
→ configuring the project in /home/joelcgx/Documentos/C++/essentia
→ Building in release mode
Checking for 'g++' (C++ compiler) : /usr/bin/g++
Checking for 'gcc' (C compiler) : /usr/bin/gcc
Checking for program 'pkg-config' : /usr/bin/pkg-config
Checking for 'eigen3' : yes
Checking for 'libavcodec' >= 55.34.1 : not found
Checking for 'libavformat' : not found
Checking for 'libavutil' : not found
Checking for 'libswresample' : not found
Checking for 'samplerate' : not found
Checking for 'taglib' >= 1.9 : yes
Checking for 'yaml-0.1' : yes
Checking for 'fftw3f' : yes
Checking for 'libchromaprint' : yes
Checking for 'tensorflow' : not found
The configuration failed
(complete log in /home/joelcgx/Documentos/C++/essentia/build/config.log) i try install Tensorflow joelcgx@joelcgx-HP-Compaq-8200-Elite-CMT-PC:~/Documentos/C++/essentia$ pip3 install tensorflow
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.12/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
|
dont install tensorflow like that
change the linux commands (and the filename at tar) with windows equivalent ones, i dont know powershell commands sorry. for ffmpeg, honestly, i dont know mate. try rebuilding doing
and then try compiling essentia again, then report back to me, if i dont reply back instantly i will get back to you in 8~ hours because its 7 am and im tired lol beep beep link i sent for tensorflow is dead use this |
dont worry man,It's 10 PM here, rest, I'll try, I'll do the same and thank you, I'll keep you informed |
Build fails with the following error:
The text was updated successfully, but these errors were encountered: