Skip to content
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

Open
TylerTheHumanCompiler opened this issue Apr 30, 2024 · 25 comments

Comments

@TylerTheHumanCompiler
Copy link

Build fails with the following error:

[100/308] Compiling src/essentia/utils/audiocontext.cpp
../src/essentia/utils/audiocontext.cpp: In constructor ‘essentia::AudioContext::AudioContext()’:
../src/essentia/utils/audiocontext.cpp:33:3: error: ‘av_register_all’ was not declared in this scope
   33 |   av_register_all(); // this should be done once only..
      |   ^~~~~~~~~~~~~~~
../src/essentia/utils/audiocontext.cpp: In member function ‘int essentia::AudioContext::create(const std::string&, const std::string&, int, int, int)’:
../src/essentia/utils/audiocontext.cpp:48:53: error: invalid conversion from ‘const AVOutputFormat*’ to ‘AVOutputFormat*’ [-fpermissive]
   48 |   AVOutputFormat* av_output_format = av_guess_format(format.c_str(), 0, 0);
      |                                      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
      |                                                     |
      |                                                     const AVOutputFormat*
../src/essentia/utils/audiocontext.cpp:67:42: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
   67 |   _codecCtx                 = _avStream->codec;
      |                                          ^~~~~
@DarshReddy
Copy link

I am getting same errors when trying to compile for android

../src/essentia/utils/audiocontext.cpp:33:3: error: use of undeclared identifier 'av_register_all'
   33 |   av_register_all(); // this should be done once only..
      |   ^
../src/essentia/utils/audiocontext.cpp:48:19: error: cannot initialize a variable of type 'AVOutputFormat *' with an rvalue of type 'const AVOutputFormat *'
   48 |   AVOutputFormat* av_output_format = av_guess_format(format.c_str(), 0, 0);
      |                   ^                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/essentia/utils/audiocontext.cpp:67:42: error: no member named 'codec' in 'AVStream'
   67 |   _codecCtx                 = _avStream->codec;
      |                               ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:72:14: error: no member named 'channels' in 'AVCodecContext'
   72 |   _codecCtx->channels       = nChannels;
      |   ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:73:14: error: no member named 'channel_layout' in 'AVCodecContext'
   73 |   _codecCtx->channel_layout = av_get_default_channel_layout(nChannels);
      |   ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:73:31: error: use of undeclared identifier 'av_get_default_channel_layout'
   73 |   _codecCtx->channel_layout = av_get_default_channel_layout(nChannels);
      |                               ^
../src/essentia/utils/audiocontext.cpp:77:12: error: cannot initialize a variable of type 'AVCodec *' with an rvalue of type 'const AVCodec *'
   77 |   AVCodec* audioCodec = avcodec_find_encoder(_codecCtx->codec_id);
      |            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/essentia/utils/audiocontext.cpp:125:49: error: no member named 'channels' in 'AVCodecContext'
  125 |       _codecCtx->frame_size = 4096 / _codecCtx->channels / av_get_bytes_per_sample(AV_SAMPLE_FMT_S16);
      |                                      ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:140:57: error: no member named 'channels' in 'AVCodecContext'
  140 |                                              _codecCtx->channels, 
      |                                              ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:145:20: error: no member named 'filename' in 'AVFormatContext'
  145 |   strncpy(_muxCtx->filename, _filename.c_str(), sizeof(_muxCtx->filename));
      |           ~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:145:65: error: no member named 'filename' in 'AVFormatContext'
  145 |   strncpy(_muxCtx->filename, _filename.c_str(), sizeof(_muxCtx->filename));
      |                                                        ~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:151:65: error: no member named 'channel_layout' in 'AVCodecContext'
  151 |   av_opt_set_int(_convertCtxAv, "in_channel_layout", _codecCtx->channel_layout, 0);
      |                                                      ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:152:66: error: no member named 'channel_layout' in 'AVCodecContext'
  152 |   av_opt_set_int(_convertCtxAv, "out_channel_layout", _codecCtx->channel_layout, 0);
      |                                                       ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:194:28: error: no member named 'codec' in 'AVStream'
  194 |   avcodec_close(_avStream->codec);
      |                 ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:198:24: error: no member named 'codec' in 'AVStream'
  198 |   av_freep(&_avStream->codec);
      |             ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:218:18: error: no member named 'channels' in 'AVCodecContext'
  218 |   if (_codecCtx->channels != 2) {
      |       ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:219:100: error: no member named 'channels' in 'AVCodecContext'
  219 |     throw EssentiaException("Trying to write stereo audio data to an audio file with ", _codecCtx->channels, " channels");
      |                                                                                         ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:243:18: error: no member named 'channels' in 'AVCodecContext'
  243 |   if (_codecCtx->channels != 1) {
      |       ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:244:98: error: no member named 'channels' in 'AVCodecContext'
  244 |     throw EssentiaException("Trying to write mono audio data to an audio file with ", _codecCtx->channels, " channels");
      |                                                                                       ~~~~~~~~~  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Waf: Leaving directory `/Users/darshreddy/Artium/essentia/build'
Build failed
 -> task in 'essentia' failed with exit status 1: 
	{task 4391454768: cxx audiocontext.cpp -> audiocontext.cpp.1.o}
['/usr/bin/clang++', '-std=c++11', '-pipe', '-Wall', '-O2', '-fPIC', '-std=c++11', '-I/usr/local/include', '-w', '-fPIC', '-Isrc', '-I../src', '-Isrc/essentia', '-I../src/essentia', '-Isrc/essentia/scheduler', '-I../src/essentia/scheduler', '-Isrc/essentia/streaming', '-I../src/essentia/streaming', '-Isrc/essentia/streaming/algorithms', '-I../src/essentia/streaming/algorithms', '-Isrc/essentia/utils', '-I../src/essentia/utils', '-Isrc/3rdparty', '-I../src/3rdparty', '-Isrc/3rdparty/spline', '-I../src/3rdparty/spline', '-Isrc/3rdparty/nnls', '-I../src/3rdparty/nnls', '-Isrc/3rdparty/cephes/bessel', '-I../src/3rdparty/cephes/bessel', '-I/opt/homebrew/Cellar/eigen/3.4.0_1/include/eigen3', '-I/opt/homebrew/Cellar/ffmpeg/7.0.2/include', '-I/opt/homebrew/Cellar/libsamplerate/0.2.2/include', '-DGTEST_HAS_TR1_TUPLE=0', '-DHAVE_EIGEN3=1', '-DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS', '-DHAVE_AVCODEC=1', '-DHAVE_AVFORMAT=1', '-DHAVE_AVUTIL=1', '-DHAVE_SWRESAMPLE=1', '-DHAVE_SAMPLERATE=1', '-D__STDC_CONSTANT_MACROS', '-DEIGEN_MPL2_ONLY', '../src/essentia/utils/audiocontext.cpp', '-c', '-o/Users/darshreddy/Artium/essentia/build/src/essentia/utils/audiocontext.cpp.1.o', '-fPIC', '-I/opt/homebrew/opt/[email protected]/include']

@luckysmg
Copy link

Get same error when build ios

@DarshReddy
Copy link

Hi @dbogdanov can you please help here? this is happening even on normal build from master branch

@caner-cetin
Copy link

caner-cetin commented Dec 30, 2024

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, av_register_all does not exist, because, yes, it truly does not exist. leandromoreira/ffmpeg-libav-tutorial#29 it has been dropped with 4.0 version which was 6 years ago. So there is two locations where av_register_all is used.

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

#1248

Support ffmpeg version 5 issue that has been open for two, nearly three years.

there is only two occurrences of this function call. If I delete both (it is recommended to replace them with nothing), then the algorithms_info.py that is used within both compiling and configuring will break, and, besides that two function calls, there are so many moving parts of ffmpeg and version 4 to 6 is definitely not compatible

How the fuck are we going to find the latest version of ffmpeg 4. X? This is where things get beyond fucked up.

https://patchwork.ffmpeg.org/project/ffmpeg/patch/AM7PR03MB6660E1F8A57B76DF6578148B8FDB9@AM7PR03MB6660.eurprd03.prod.outlook.com/

In this patch, at, Sept. 15, 2021 av_mallocz_array is deprecated, and there are, i am not exaggerating FUCKTON of references to this function call. At first, I have downloaded and setup 4.4.2 (yes i followed these steps twice, you can do it mate) which released after this patch and my CMake output is full of

[build] /home/cansu/ffmpeg-4.4.2/libavcodec/snowenc.c:88:(.text.unlikely+0x18f): undefined reference to `av_mallocz_array'

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 make with no errors, congrats, advance to the next step, if you see an error like this:

(essentia) ➜  ffmpeg-4.4.2 make
CC      libavformat/adtsenc.o
./libavcodec/x86/mathops.h: Assembler messages:
./libavcodec/x86/mathops.h:125: Error: operand type mismatch for `shr'
./libavcodec/x86/mathops.h:125: Error: operand type mismatch for `shr'
./libavcodec/x86/mathops.h:125: Error: operand type mismatch for `shr'

You are coming with me.

Apply the following patch: https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/effadce6c756247ea8bae32dc13bb3e6f464f0eb

with either using patch

patch -i ffmpeg.patch

where ffmpeg.patch is the patch from link above, for convenience https://pastebin.com/raw/c0Uq4TJU

If you want to manually edit, open libavcodec/x86/mathops.h file.

Change the NEG_USR32 with this:

#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 NEG_SSR32 with this:

#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 MULL with this:

#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.
Delete the latest versions of required libraries

sudo apt-get remove libavcodec-dev libavformat-dev libavutil-dev

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

if it is all green
image

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

[316/316] Linking build/src/libessentia.a
Waf: Leaving directory `/home/cansu/Git/essentia/essentia/build'
'build' finished successfully (3m55.438s)

run

python3 waf install

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 CMakeLists.txt. handwritten by myself, commented by Claude sorry if its overcommented

# Specify the minimum required version of CMake. The version range 3.14...3.31 means
# the project requires at least CMake 3.14 but will work with any version up to 3.31
cmake_minimum_required(VERSION 3.14...3.31)

project(Conan)

# Add preprocessor definitions that will be available during compilation
# These are important POSIX and GNU specific macros that enable various features
add_definitions(
    # Enable POSIX.1b real-time extensions
    -D_POSIX_C_SOURCE=199309L
    # Enable GNU extensions
    -D_GNU_SOURCE
    # Enable macros for constant values in stdint.h
    -D__STDC_CONSTANT_MACROS
    # Enable printf format macros in inttypes.h
    -D__STDC_FORMAT_MACROS
    # Enable limit macros in stdint.h
    -D__STDC_LIMIT_MACROS
)

# Configure C++ standard settings
set(CMAKE_CXX_STANDARD 17)              # Use C++17 standard
set(CMAKE_CXX_STANDARD_REQUIRED ON)     # Require C++17 support (don't fall back to previous versions)
set(CMAKE_CXX_EXTENSIONS ON)            # Allow compiler-specific extensions
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)   # Generate compile_commands.json for tooling

find_package(glslang REQUIRED)   # GLSL compiler
find_package(Protobuf REQUIRED)  # Protocol Buffers
find_package(PkgConfig REQUIRED) # Package configuration tool
find_package(X11 QUIET)         # X11 window system (optional)

# Use pkg-config to find additional libraries
find_package(PkgConfig REQUIRED)
pkg_check_modules(CHROMAPRINT REQUIRED libchromaprint)  # Audio fingerprinting library
pkg_check_modules(VDPAU QUIET vdpau)                    # Video acceleration (optional)

# Create the executable target from the main source file
add_executable(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/src/main.cpp)

# Define vendor directory paths for better organization
set(FFMPEG_VENDOR_DIR   ${CMAKE_SOURCE_DIR}/src/vendor/ffmpeg)
set(GLSLANG_VENDOR_DIR  ${CMAKE_SOURCE_DIR}/src/vendor/glslang)

# Configure include directories for the target
# PRIVATE means these includes are only used internally by this target
target_include_directories(${PROJECT_NAME} PRIVATE
    ${X11_INCLUDE_DIR}                    # X11 headers
    ${VDPAU_INCLUDE_DIRS}                 # VDPAU headers
    /usr/local/include/essentia  
    samplerate                           # Audio sample rate conversion
    ${CMAKE_SOURCE_DIR}/src/include      # Project headers
    ${Protobuf_INCLUDE_DIRS}            # Protocol Buffers headers
    # GLSL and SPIR-V related headers
    ${GLSLANG_VENDOR_DIR}/SPIRV
    ${GLSLANG_VENDOR_DIR}/external/spirv-headers/include
    ${GLSLANG_VENDOR_DIR}/External/spirv-tools
    /usr/local/include/spirv-tools/
    # Eigen matrix library headers
    /usr/include/eigen3
    /usr/include/eigen3/unsupported
    # TensorFlow headers
    /usr/local/tensorflow/include
    ${CMAKE_SOURCE_DIR}/src
    ${CHROMAPRINT_INCLUDE_DIRS}          # Chromaprint headers
    ${YAML_INCLUDE_DIR}                  # YAML parser headers
    # FFmpeg related headers
    ${FFMPEG_VENDOR_DIR}
    ${FFMPEG_VENDOR_DIR}/libavformat
    ${FFMPEG_VENDOR_DIR}/libavformat/*.h
    ${FFMPEG_VENDOR_DIR}/libavcodec
    ${FFMPEG_VENDOR_DIR}/libavcodec/*.h
    ${FFMPEG_VENDOR_DIR}/libavdevice
    ${FFMPEG_VENDOR_DIR}/libavfilter
    ${FFMPEG_VENDOR_DIR}/libavresample
    ${FFMPEG_VENDOR_DIR}/libavutil
    ${FFMPEG_VENDOR_DIR}/libpostproc
    ${FFMPEG_VENDOR_DIR}/libswresample
    ${FFMPEG_VENDOR_DIR}/libswscale
)

# Add additional library search directories
target_link_directories(${PROJECT_NAME} PRIVATE
    /usr/local/tensorflow/lib
)

# Define paths to FFmpeg static libraries
set(LIBAVUTIL_LIBRARY       ${FFMPEG_VENDOR_DIR}/libavutil/libavutil.a)
set(LIBAVCODEC_LIBRARY      ${FFMPEG_VENDOR_DIR}/libavcodec/libavcodec.a)
set(LIBAVFORMAT_LIBRARY     ${FFMPEG_VENDOR_DIR}/libavformat/libavformat.a)
set(LIBAVFILTER_LIBRARY     ${FFMPEG_VENDOR_DIR}/libavfilter/libavfilter.a)
set(LIBSWRESAMPLE_LIBRARY   ${FFMPEG_VENDOR_DIR}/libswresample/libswresample.a)
set(LIBSWSCALE_LIBRARY      ${FFMPEG_VENDOR_DIR}/libswscale/libswscale.a)
set(LIBAVDEVICE_LIBRARY     ${FFMPEG_VENDOR_DIR}/libavdevice/libavdevice.a)

# Link all required libraries to the target
# WARNING: FFmpeg libraries must be linked in this specific order due to dependencies
target_link_libraries(${PROJECT_NAME} PRIVATE
    /usr/local/lib/libessentia.a
    samplerate                          # Sample rate conversion
    # FFmpeg libraries (order matters!)
    ${LIBAVDEVICE_LIBRARY}
    ${LIBAVFILTER_LIBRARY}
    ${LIBAVFORMAT_LIBRARY}
    ${LIBAVCODEC_LIBRARY}
    ${LIBSWRESAMPLE_LIBRARY}
    ${LIBSWSCALE_LIBRARY}
    ${LIBAVUTIL_LIBRARY} 
    # Video acceleration libraries
    va
    va-drm
    ${X11_LIBRARIES}
    ${VDPAU_LIBRARIES}
    # Machine learning libraries
    tensorflow
    tensorflow_framework
    # Various other dependencies
    glslang
    ${Protobuf_LIBRARIES}
    tag                                 # Audio metadata library
    fftw3                              # Fast Fourier Transform
    fftw3f
    yaml                               # YAML parser
    va                                 # Video acceleration
    z                                  # Compression
    bz2                                # Compression
    lzma                               # Compression
    ${CHROMAPRINT_LIBRARIES}           # Audio fingerprinting
)

save this to main.cpp

#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

@caner-cetin
Copy link

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.

@Joelcgx
Copy link

Joelcgx commented Jan 14, 2025

Actualizaciones, he logrado compilar la biblioteca CPP por mí mismo, adjunté un CMakeLists.txt, si algún lector futuro se topa con esto y sigue el comentario, avíseme si algo sale mal, puedo usar Essentia + QT sin ningún problema y un tiempo de compilación bastante rápido.

On what platform? I couldn't do it on Android 😢

@caner-cetin
Copy link

@Joelcgx can you send the error message?

@Joelcgx
Copy link

Joelcgx commented Jan 15, 2025

@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

@caner-cetin
Copy link

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

@Joelcgx
Copy link

Joelcgx commented Jan 15, 2025

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 Essentia

Below is the script I used to compile:

Script: build_essentia.sh

#! /bin/bash

# Build for Android aarch64

# Toolchain setup
export NDK=/home/joelcgx/Android/Sdk/ndk/21.3.6528147
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin
export PATH=$TOOLCHAIN:$PATH
export CLANG=$TOOLCHAIN/aarch64-linux-android24-clang
export CLANGXX=$TOOLCHAIN/aarch64-linux-android24-clang++

# Configure build
CC=$CLANG CXX=$CLANGXX python3 ./waf configure \
    --cross-compile-android \
    --lightweight=libav,libsamplerate \
    --fft=KISS \
    --prefix=/home/joelcgx/Documentos/C++/essentia/OUT

# Build Output
joelcgx@joelcgx-HP-Compaq-8200-Elite-CMT-PC:~/Documentos/C++/essentia$ python3 waf
/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: EqloudLoader, TensorflowPredictEffnetDiscogs, FFTW, FreesoundExtractor, GaiaTransform, TensorflowPredict2D, TensorflowPredictCREPE, MetadataReader, MusicExtractor, YamlOutput, TempoCNN, Resample, TensorflowPredictVGGish, EasyLoader, MusicExtractorSVM, IFFTW, TensorflowPredict, YamlInput, TensorflowPredictMAEST, FFTWComplex, FFTA, FFTAComplex, IFFTA, TensorflowPredictMusiCNN, IFFTAComplex, Chromaprinter, IFFTWComplex, PitchCREPE, TensorflowPredictTempoCNN, MonoLoader, TensorflowPredictFSDSINet
Created algorithms registration file
[  1/296] Compiling src/algorithms/stats/instantpower.cpp
[  2/296] Compiling src/algorithms/standard/vectorrealaccumulator.cpp
[  3/296] Compiling src/algorithms/spectral/maxmagfreq.cpp
[  4/296] Compiling src/essentia/utils/extractor_music/MusicLowlevelDescriptors.cpp
[  5/296] Compiling src/essentia/streaming/algorithms/ringbufferinput.cpp
[  6/296] Compiling src/essentia/parameter.cpp
[  7/296] Compiling src/essentia/connector.cpp
[  8/296] Compiling src/essentia/algorithm.cpp
[  9/296] Compiling src/algorithms/stats/decrease.cpp
[ 10/296] Compiling src/algorithms/spectral/bfcc.cpp
[ 11/296] Compiling src/3rdparty/cephes/bessel/hyperg.cpp
[ 12/296] Compiling src/3rdparty/nnls/nnls.c
[ 13/296] Compiling src/algorithms/extractor/barkextractor.cpp
[ 14/296] Compiling src/algorithms/io/fileoutputproxy.cpp
[ 15/296] Compiling src/essentia/utils/extractor_music/MusicRhythmDescriptors.cpp
[ 16/296] Compiling src/algorithms/standard/chromagram.cpp
[ 17/296] Compiling src/algorithms/io/audiowriter.cpp
[ 18/296] Compiling src/algorithms/stats/powermean.cpp
[ 19/296] Compiling src/algorithms/spectral/tensorflowinputvggish.cpp
[ 20/296] Compiling src/algorithms/stats/singlegaussian.cpp
[ 21/296] Compiling src/algorithms/standard/warpedautocorrelation.cpp
[ 22/296] Compiling src/algorithms/stats/variance.cpp
[ 23/296] Compiling src/algorithms/stats/centralmoments.cpp
[ 24/296] Compiling src/algorithms/stats/rawmoments.cpp
[ 25/296] Compiling src/algorithms/standard/nsgiconstantq.cpp
[ 26/296] Compiling src/algorithms/spectral/strongpeak.cpp
[ 27/296] Compiling src/algorithms/stats/poolaggregator.cpp
[ 28/296] Compiling src/algorithms/standard/slicer.cpp
[ 29/296] Compiling src/essentia/utils/extractor_freesound/FreesoundTonalDescriptors.cpp
[ 30/296] Compiling src/algorithms/stats/distributionshape.cpp
[ 31/296] Compiling src/algorithms/stats/median.cpp
[ 32/296] Compiling src/algorithms/tonal/tuningfrequency.cpp
[ 33/296] Compiling src/algorithms/spectral/melbands.cpp
[ 34/296] Compiling src/algorithms/stats/entropy.cpp
[ 35/296] Compiling src/algorithms/stats/geometricmean.cpp
[ 36/296] Compiling src/algorithms/complex/cartesiantopolar.cpp
[ 37/296] Compiling src/essentia/streaming/algorithms/poolstorage.cpp
[ 38/296] Compiling src/algorithms/tonal/tristimulus.cpp
[ 39/296] Compiling src/algorithms/filters/iir.cpp
[ 40/296] Compiling src/algorithms/tonal/pitchcontoursmultimelody.cpp
[ 41/296] Compiling src/algorithms/filters/movingaverage.cpp
[ 42/296] Compiling src/algorithms/spectral/rolloff.cpp
[ 43/296] Compiling src/algorithms/filters/dcremoval.cpp
[ 44/296] Compiling src/algorithms/tonal/nnlschroma.cpp
[ 45/296] Compiling src/algorithms/filters/highpass.cpp
[ 46/296] Compiling src/essentia/utils/extractor_freesound/FreesoundRhythmDescriptors.cpp
[ 47/296] Compiling src/algorithms/filters/allpass.cpp
[ 48/296] Compiling src/algorithms/tonal/multipitchklapuri.cpp
[ 49/296] Compiling src/algorithms/rhythm/percivalevaluatepulsetrains.cpp
[ 50/296] Compiling src/algorithms/spectral/spectralwhitening.cpp
[ 51/296] Compiling src/algorithms/rhythm/noveltycurve.cpp
[ 52/296] Compiling src/algorithms/tonal/pitchsaliencefunctionpeaks.cpp
[ 53/296] Compiling src/essentia/essentiautil.cpp
[ 54/296] Compiling src/algorithms/rhythm/rhythmtransform.cpp
[ 55/296] Compiling src/algorithms/rhythm/loopbpmconfidence.cpp
[ 56/296] Compiling src/algorithms/tonal/pitchyin.cpp
[ 57/296] Compiling src/algorithms/rhythm/temposcalebands.cpp
[ 58/296] Compiling src/algorithms/spectral/hpcp.cpp
[ 59/296] Compiling src/algorithms/rhythm/onsets.cpp
[ 60/296] Compiling src/algorithms/tonal/pitchsaliencefunction.cpp
[ 61/296] Compiling src/essentia/utils/audiocontext.cpp
[ 62/296] Compiling src/algorithms/rhythm/beattrackerdegara.cpp
[ 63/296] Compiling src/algorithms/rhythm/beattrackermultifeature.cpp
[ 64/296] Compiling src/algorithms/tonal/tonicindianartmusic.cpp
[ 65/296] Compiling src/algorithms/rhythm/noveltycurvefixedbpmestimator.cpp
[ 66/296] Compiling src/algorithms/rhythm/beatsloudness.cpp
[ 67/296] Compiling src/algorithms/spectral/tensorflowinputmusicnn.cpp
[ 68/296] Compiling src/algorithms/tonal/audio2midi.cpp
[ 69/296] Compiling src/essentia/streaming/accumulatoralgorithm.cpp
[ 70/296] Compiling src/algorithms/rhythm/rhythmextractor2013.cpp
[ 71/296] Compiling src/algorithms/rhythm/bpmhistogramdescriptors.cpp
[ 72/296] Compiling src/algorithms/tonal/pitchyinfft.cpp
[ 73/296] Compiling src/algorithms/rhythm/tempotapdegara.cpp
[ 74/296] Compiling src/algorithms/spectral/spectrumtocent.cpp
[ 75/296] Compiling src/algorithms/rhythm/onsetdetectionglobal.cpp
[ 76/296] Compiling src/algorithms/tonal/chordsdetectionbeats.cpp
[ 77/296] Compiling src/essentia/utils/asciidag.cpp
[ 78/296] Compiling src/algorithms/rhythm/bpmhistogram.cpp
[ 79/296] Compiling src/algorithms/audioproblems/saturationdetector.cpp
[ 80/296] Compiling src/algorithms/tonal/highresolutionfeatures.cpp
[ 81/296] Compiling src/algorithms/audioproblems/humdetector.cpp
[ 82/296] Compiling src/algorithms/spectral/spectralpeaks.cpp
[ 83/296] Compiling src/algorithms/audioproblems/noiseburstdetector.cpp
[ 84/296] Compiling src/algorithms/tonal/oddtoevenharmonicenergyratio.cpp
[ 85/296] Compiling src/algorithms/audioproblems/gapsdetector.cpp
[ 86/296] Compiling src/algorithms/standard/spectrum.cpp
[ 87/296] Compiling src/algorithms/audioproblems/clickdetector.cpp
[ 88/296] Compiling src/algorithms/tonal/pitchcontoursmelody.cpp
[ 89/296] Compiling src/algorithms/highlevel/fadedetection.cpp
[ 90/296] Compiling src/algorithms/spectral/spectralcentroidtime.cpp
[ 91/296] Compiling src/algorithms/highlevel/crosssimilaritymatrix.cpp
[ 92/296] Compiling src/algorithms/tonal/multipitchmelodia.cpp
[ 93/296] Compiling src/algorithms/highlevel/intensity.cpp
[ 94/296] Compiling src/essentia/streaming/streamingalgorithmwrapper.cpp
[ 95/296] Compiling src/algorithms/highlevel/pca.cpp
[ 96/296] Compiling src/algorithms/tonal/pitchfilter.cpp
[ 97/296] Compiling src/algorithms/highlevel/dynamiccomplexity.cpp
[ 98/296] Compiling src/algorithms/spectral/triangularbands.cpp
[ 99/296] Compiling src/algorithms/standard/minmax.cpp
[100/296] Compiling src/algorithms/synthesis/sinemodelanal.cpp
[101/296] Compiling src/algorithms/standard/nsgconstantq.cpp
[102/296] Compiling src/essentia/scheduler/network.cpp
[103/296] Compiling src/algorithms/standard/framebuffer.cpp
[104/296] Compiling src/algorithms/standard/startstopsilence.cpp
[105/296] Compiling src/algorithms/synthesis/sprmodelsynth.cpp
[106/296] Compiling src/algorithms/spectral/erbbands.cpp
[107/296] Compiling src/algorithms/standard/stereomuxer.cpp
[108/296] Compiling src/algorithms/synthesis/sinesubtraction.cpp
[109/296] Compiling src/algorithms/standard/cubicspline.cpp
[110/296] Compiling src/essentia/streaming/streamingalgorithm.cpp
[111/296] Compiling src/algorithms/standard/fftk.cpp
[112/296] Compiling src/algorithms/synthesis/stochasticmodelsynth.cpp
[113/296] Compiling src/algorithms/standard/tensornormalize.cpp
[114/296] Compiling src/algorithms/spectral/frequencybands.cpp
[115/296] Compiling src/algorithms/synthesis/hprmodelanal.cpp
[116/296] Compiling src/algorithms/standard/trimmer.cpp
[117/296] Compiling src/algorithms/standard/unaryoperatorstream.cpp
[118/296] Compiling src/essentia/debugging.cpp
[119/296] Compiling src/algorithms/standard/silencerate.cpp
[120/296] Compiling src/algorithms/synthesis/sprmodelanal.cpp
[121/296] Compiling src/algorithms/standard/maxfilter.cpp
[122/296] Compiling src/algorithms/spectral/energyband.cpp
[123/296] Compiling src/algorithms/standard/ifftkcomplex.cpp
[124/296] Compiling src/algorithms/synthesis/harmonicmask.cpp
[125/296] Compiling src/algorithms/standard/ifftk.cpp
[126/296] Compiling src/essentia/streaming/sinkbase.cpp
[127/296] Compiling src/algorithms/standard/monomixer.cpp
[128/296] Compiling src/algorithms/sfx/strongdecay.cpp
[129/296] Compiling src/algorithms/standard/idct.cpp
[130/296] Compiling src/algorithms/sfx/maxtototal.cpp
[131/296] Compiling src/3rdparty/cephes/bessel/iv.cpp
[132/296] Compiling src/3rdparty/kiss_fft130/kiss_fft.c
[133/296] Compiling src/algorithms/standard/peakdetection.cpp
[134/296] Compiling src/essentia/streaming/algorithms/ringbuffervectoroutput.cpp
[135/296] Compiling src/algorithms/extractor/tonalextractor.cpp
[136/296] Compiling src/algorithms/standard/vectorrealtotensor.cpp
[137/296] Compiling src/algorithms/extractor/keyextractor.cpp
[138/296] Compiling src/algorithms/sfx/pitchsalience.cpp
[139/296] Compiling src/algorithms/experimental/meter.cpp
[140/296] Compiling src/algorithms/standard/derivative.cpp
[141/296] Compiling src/essentia/utils/extractor_music/MusicTonalDescriptors.cpp
[142/296] Compiling src/algorithms/temporal/larm.cpp
[143/296] Compiling src/algorithms/temporal/effectiveduration.cpp
[144/296] Compiling src/algorithms/standard/tensortovectorreal.cpp
[145/296] Compiling src/algorithms/io/monowriter.cpp
[146/296] Compiling src/algorithms/spectral/panning.cpp
[147/296] Compiling src/algorithms/io/audioonsetsmarker.cpp
[148/296] Compiling src/algorithms/standard/framecutter.cpp
[149/296] Compiling src/algorithms/stats/crest.cpp
[150/296] Compiling src/algorithms/stats/flatness.cpp
[151/296] Compiling src/algorithms/stats/energy.cpp
[152/296] Compiling src/algorithms/standard/nsgconstantqstreaming.cpp
[153/296] Compiling src/algorithms/spectral/barkbands.cpp
[154/296] Compiling src/algorithms/stats/histogram.cpp
[155/296] Compiling src/algorithms/tonal/harmonicpeaks.cpp
[156/296] Compiling src/algorithms/complex/polartocartesian.cpp
[157/296] Compiling src/essentia/utils/extractor_freesound/FreesoundSfxDescriptors.cpp
[158/296] Compiling src/algorithms/filters/lowpass.cpp
[159/296] Compiling src/algorithms/tonal/predominantpitchmelodia.cpp
[160/296] Compiling src/algorithms/filters/bandreject.cpp
[161/296] Compiling src/algorithms/spectral/gfcc.cpp
[162/296] Compiling src/algorithms/filters/bandpass.cpp
[163/296] Compiling src/algorithms/tonal/inharmonicity.cpp
[164/296] Compiling src/algorithms/rhythm/percivalbpmestimator.cpp
[165/296] Compiling src/essentia/streaming/algorithms/devnull.cpp
[166/296] Compiling src/algorithms/rhythm/rhythmextractor.cpp
[167/296] Compiling src/algorithms/tonal/pitchyinprobabilistic.cpp
[168/296] Compiling src/algorithms/rhythm/tempotap.cpp
[169/296] Compiling src/algorithms/spectral/flux.cpp
[170/296] Compiling src/algorithms/rhythm/bpmrubato.cpp
[171/296] Compiling src/algorithms/tonal/pitchmelodia.cpp
[172/296] Compiling src/algorithms/rhythm/superfluxnovelty.cpp
[173/296] Compiling src/essentia/utils/asciidagparser.cpp
[174/296] Compiling src/algorithms/rhythm/percivalenhanceharmonics.cpp
[175/296] Compiling src/algorithms/tonal/chordsdescriptors.cpp
[176/296] Compiling src/algorithms/spectral/spectralcomplexity.cpp
[177/296] Compiling src/algorithms/audioproblems/startstopcut.cpp
[178/296] Compiling src/algorithms/rhythm/harmonicbpm.cpp
[179/296] Compiling src/algorithms/tonal/audio2pitch.cpp
[180/296] Compiling src/algorithms/audioproblems/falsestereodetector.cpp
[181/296] Compiling src/essentia/essentia.cpp
[182/296] Compiling src/algorithms/audioproblems/snr.cpp
[183/296] Compiling src/algorithms/highlevel/coversongsimilarity.cpp
[184/296] Compiling src/algorithms/tonal/pitchcontoursmonomelody.cpp
[185/296] Compiling src/algorithms/spectral/flatnessdb.cpp
[186/296] Compiling src/algorithms/highlevel/danceability.cpp
[187/296] Compiling src/algorithms/tonal/dissonance.cpp
[188/296] Compiling src/algorithms/standard/bpf.cpp
[189/296] Compiling src/essentia/streaming/streamingalgorithmcomposite.cpp
[190/296] Compiling src/algorithms/standard/replaygain.cpp
[191/296] Compiling src/algorithms/synthesis/resamplefft.cpp
[192/296] Compiling src/algorithms/standard/welch.cpp
[193/296] Compiling src/algorithms/spectral/tensorflowinputfsdsinet.cpp
[194/296] Compiling src/algorithms/standard/tensortranspose.cpp
[195/296] Compiling src/algorithms/synthesis/harmonicmodelanal.cpp
[196/296] Compiling src/essentia/range.cpp
[197/296] Compiling src/essentia/configurable.cpp
[198/296] Compiling src/algorithms/standard/envelope.cpp
[199/296] Compiling src/algorithms/synthesis/hpsmodelanal.cpp
[200/296] Compiling src/algorithms/spectral/energybandratio.cpp
[201/296] Compiling src/algorithms/standard/stereodemuxer.cpp
[202/296] Compiling src/algorithms/standard/constantq.cpp
[203/296] Compiling src/3rdparty/cephes/bessel/gamma.cpp
[204/296] Compiling src/algorithms/standard/spectrumCQ.cpp
[205/296] Compiling src/algorithms/essentia_algorithms_reg.cpp
[206/296] Compiling src/algorithms/extractor/extractor.cpp
[207/296] Compiling src/algorithms/standard/autocorrelation.cpp
[208/296] Compiling src/algorithms/sfx/flatnesssfx.cpp
[209/296] Compiling src/algorithms/temporal/duration.cpp
[210/296] Compiling src/algorithms/temporal/loudnessvickers.cpp
[211/296] Compiling src/algorithms/standard/binaryoperatorstream.cpp
[212/296] Compiling src/algorithms/stats/rms.cpp
[213/296] Compiling src/algorithms/stats/mean.cpp
[214/296] Compiling src/algorithms/stats/centroid.cpp
[215/296] Compiling src/algorithms/standard/clipper.cpp
[216/296] Compiling src/algorithms/spectral/mfcc.cpp
[217/296] Compiling src/algorithms/filters/medianfilter.cpp
[218/296] Compiling src/algorithms/rhythm/singlebeatloudness.cpp
[219/296] Compiling src/algorithms/tonal/pitchyinprobabilities.cpp
[220/296] Compiling src/algorithms/rhythm/tempotapticks.cpp
[221/296] Compiling src/algorithms/tonal/key.cpp
[222/296] Compiling src/essentia/utils/extractor_freesound/FreesoundLowlevelDescriptors.cpp
[223/296] Compiling src/algorithms/spectral/triangularbarkbands.cpp
[224/296] Compiling src/algorithms/rhythm/onsetrate.cpp
[225/296] Compiling src/algorithms/rhythm/superfluxpeaks.cpp
[226/296] Compiling src/algorithms/tonal/pitch2midi.cpp
[227/296] Compiling src/algorithms/audioproblems/truepeakdetector.cpp
[228/296] Compiling src/essentia/scheduler/networkparser.cpp
[229/296] Compiling src/algorithms/highlevel/chromacrosssimilarity.cpp
[230/296] Compiling src/algorithms/standard/stereotrimmer.cpp
[231/296] Compiling src/algorithms/spectral/tensorflowinputtempocnn.cpp
[232/296] Compiling src/algorithms/standard/unaryoperator.cpp
[233/296] Compiling src/algorithms/tonal/pitchyinprobabilitieshmm.cpp
[234/296] Compiling src/algorithms/synthesis/spsmodelsynth.cpp
[235/296] Compiling src/algorithms/standard/noiseadder.cpp
[236/296] Compiling src/essentia/streaming/sourcebase.cpp
[237/296] Compiling src/algorithms/synthesis/sinemodelsynth.cpp
[238/296] Compiling src/algorithms/standard/crosscorrelation.cpp
[239/296] Compiling src/algorithms/sfx/tctototal.cpp
[240/296] Compiling src/3rdparty/cephes/bessel/polevl.cpp
[241/296] Compiling src/algorithms/standard/pooltotensor.cpp
[242/296] Compiling src/algorithms/extractor/lowlevelspectraleqloudextractor.cpp
[243/296] Compiling src/algorithms/io/audioloader.cpp
[244/296] Compiling src/algorithms/filters/equalloudness.cpp
[245/296] Compiling src/algorithms/complex/magnitude.cpp
[246/296] Compiling src/algorithms/tonal/pitchcontoursegmentation.cpp
[247/296] Compiling src/algorithms/spectral/hfc.cpp
[248/296] Compiling src/algorithms/tonal/pitchcontours.cpp
[249/296] Compiling src/algorithms/rhythm/onsetdetection.cpp
[250/296] Compiling src/algorithms/rhythm/superfluxextractor.cpp
[251/296] Compiling src/essentia/stringutil.cpp
[252/296] Compiling src/algorithms/highlevel/sbic.cpp
[253/296] Compiling src/algorithms/standard/powerspectrum.cpp
[254/296] Compiling src/algorithms/spectral/spectralcontrast.cpp
[255/296] Compiling src/algorithms/synthesis/spsmodelanal.cpp
[256/296] Compiling src/algorithms/standard/tensortopool.cpp
[257/296] Compiling src/algorithms/temporal/zerocrossingrate.cpp
[258/296] Compiling src/algorithms/standard/scale.cpp
[259/296] Compiling src/algorithms/rhythm/tempotapmaxagreement.cpp
[260/296] Compiling src/algorithms/rhythm/loopbpmestimator.cpp
[261/296] Compiling src/algorithms/tonal/chordsdetection.cpp
[262/296] Compiling src/algorithms/standard/frametoreal.cpp
[263/296] Compiling src/algorithms/synthesis/stochasticmodelanal.cpp
[264/296] Compiling src/3rdparty/spline/splineutil.cpp
[265/296] Compiling src/algorithms/audioproblems/discontinuitydetector.cpp
[266/296] Compiling src/algorithms/spectral/logspectrum.cpp
[267/296] Compiling src/algorithms/standard/fftkcomplex.cpp
[268/296] Compiling src/algorithms/standard/windowing.cpp
[269/296] Compiling src/algorithms/tonal/vibrato.cpp
[270/296] Compiling src/algorithms/standard/overlapadd.cpp
[271/296] Compiling src/algorithms/sfx/aftermaxtobeforemaxenergyratio.cpp
[272/296] Compiling src/algorithms/temporal/lpc.cpp
[273/296] Compiling src/algorithms/temporal/loudness.cpp
[274/296] Compiling src/algorithms/standard/dct.cpp
[275/296] Compiling src/algorithms/temporal/loudnessebur128filter.cpp
[276/296] Compiling src/essentia/streaming/algorithms/ringbufferoutput.cpp
[277/296] Compiling src/algorithms/temporal/loudnessebur128.cpp
[278/296] Compiling src/algorithms/standard/spline.cpp
[279/296] Compiling src/algorithms/temporal/leq.cpp
[280/296] Compiling src/algorithms/sfx/mintototal.cpp
[281/296] Compiling src/algorithms/experimental/beatogram.cpp
[282/296] Compiling src/algorithms/standard/multiplexer.cpp
[283/296] Compiling src/algorithms/extractor/tuningfrequencyextractor.cpp
[284/296] Compiling src/essentia/utils/synth_utils.cpp
[285/296] Compiling src/algorithms/standard/realaccumulator.cpp
[286/296] Compiling src/algorithms/sfx/logattacktime.cpp
[287/296] Compiling src/algorithms/extractor/rhythmdescriptors.cpp
[288/296] Compiling src/algorithms/extractor/lowlevelspectralextractor.cpp
[289/296] Compiling src/algorithms/standard/binaryoperator.cpp
[290/296] Compiling src/algorithms/extractor/levelextractor.cpp
[291/296] Compiling src/essentia/pool.cpp
[292/296] Compiling src/algorithms/standard/viterbi.cpp
[293/296] Compiling src/algorithms/sfx/derivativesfx.cpp
[294/296] Compiling src/3rdparty/kiss_fft130/tools/kiss_fftr.c
[295/296] Compiling essentia.pc.in
[296/296] Linking build/src/libessentia.so
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavformat.a when searching for -lavformat
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavformat.a when searching for -lavformat
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavformat.a when searching for -lavformat
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavformat.a when searching for -lavformat
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lavformat
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavcodec.a when searching for -lavcodec
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavcodec.a when searching for -lavcodec
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavcodec.a when searching for -lavcodec
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavcodec.a when searching for -lavcodec
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lavcodec
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavcodec.a when searching for -lavcodec
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavcodec.a when searching for -lavcodec
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavcodec.a when searching for -lavcodec
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavcodec.a when searching for -lavcodec
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lavcodec
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libswresample.a when searching for -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lswresample
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: skipping incompatible /usr/local/lib/libavutil.a when searching for -lavutil
/home/joelcgx/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lavutil
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Waf: Leaving directory `/home/joelcgx/Documentos/C++/essentia/build'
Build failed
 -> task in 'essentia' failed with exit status 1 (run with -v to display more information)

@caner-cetin
Copy link

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

@Joelcgx
Copy link

Joelcgx commented Jan 15, 2025

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

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, av_register_all does not exist, because, yes, it truly does not exist. leandromoreira/ffmpeg-libav-tutorial#29 it has been dropped with 4.0 version which was 6 years ago. So there is two locations where av_register_all is used.

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

#1248

Support ffmpeg version 5 issue that has been open for two, nearly three years.

there is only two occurrences of this function call. If I delete both (it is recommended to replace them with nothing), then the algorithms_info.py that is used within both compiling and configuring will break, and, besides that two function calls, there are so many moving parts of ffmpeg and version 4 to 6 is definitely not compatible

How the fuck are we going to find the latest version of ffmpeg 4. X? This is where things get beyond fucked up.

https://patchwork.ffmpeg.org/project/ffmpeg/patch/AM7PR03MB6660E1F8A57B76DF6578148B8FDB9@AM7PR03MB6660.eurprd03.prod.outlook.com/

In this patch, at, Sept. 15, 2021 av_mallocz_array is deprecated, and there are, i am not exaggerating FUCKTON of references to this function call. At first, I have downloaded and setup 4.4.2 (yes i followed these steps twice, you can do it mate) which released after this patch and my CMake output is full of

[build] /home/cansu/ffmpeg-4.4.2/libavcodec/snowenc.c:88:(.text.unlikely+0x18f): undefined reference to `av_mallocz_array'

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 make with no errors, congrats, advance to the next step, if you see an error like this:

(essentia) ➜  ffmpeg-4.4.2 make
CC      libavformat/adtsenc.o
./libavcodec/x86/mathops.h: Assembler messages:
./libavcodec/x86/mathops.h:125: Error: operand type mismatch for `shr'
./libavcodec/x86/mathops.h:125: Error: operand type mismatch for `shr'
./libavcodec/x86/mathops.h:125: Error: operand type mismatch for `shr'

You are coming with me.

Apply the following patch: https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/effadce6c756247ea8bae32dc13bb3e6f464f0eb

with either using patch

patch -i ffmpeg.patch

where ffmpeg.patch is the patch from link above, for convenience https://pastebin.com/raw/c0Uq4TJU

If you want to manually edit, open libavcodec/x86/mathops.h file.

Change the NEG_USR32 with this:

#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 NEG_SSR32 with this:

#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 MULL with this:

#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. Delete the latest versions of required libraries

sudo apt-get remove libavcodec-dev libavformat-dev libavutil-dev

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

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$

@caner-cetin
Copy link

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

@Joelcgx
Copy link

Joelcgx commented Jan 15, 2025

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??

@caner-cetin
Copy link

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.

@Joelcgx
Copy link

Joelcgx commented Jan 15, 2025

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
)


@caner-cetin
Copy link

caner-cetin commented Jan 15, 2025

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

sudo make install

in the folder aaaand then compile essentia. you got this mate i believe in youz

@Joelcgx
Copy link

Joelcgx commented Jan 15, 2025

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$ 

@caner-cetin
Copy link

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.

@Joelcgx
Copy link

Joelcgx commented Jan 15, 2025

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?

@caner-cetin
Copy link

caner-cetin commented Jan 15, 2025

holy shit okay you got this. do sudo waf install now, note the locations your libraries and headers are in (they will be displayed as your build installs)

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

@caner-cetin
Copy link

caner-cetin commented Jan 15, 2025

Wait wait wait dont do anything. Why is every single algorithm here ignored? Send me output of python3 waf configure --build-static --with-tensorflow replace python3 with whatever python executable you are using pleaee

@Joelcgx
Copy link

Joelcgx commented Jan 15, 2025

Wait wait wait dont do anything. Why is every single algorithm here ignored? Send me output of python3 waf configure --build-static --with-tensorflow replace python3 with whatever python executable you are using pleaee

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 pip3 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.

@caner-cetin
Copy link

caner-cetin commented Jan 15, 2025

dont install tensorflow like that

wget -q https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-2.12.1.zip 
mkdir -p src/vendor/tensorflow
sudo tar -C src/vendor/tensorflow -xzf libtensorflow-gpu-linux-x86_64-2.12.1.tar.gz

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

./configure --disable-doc \
--disable-htmlpages \
--disable-manpages \
--disable-podpages \
--disable-txtpages \
--pkg-config-flags="--static" \
--ld="g++"
sudo make
sudo make install

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
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-2.7.0.zip

@Joelcgx
Copy link

Joelcgx commented Jan 15, 2025

dont install tensorflow like that

wget -q https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-2.12.1.zip 
mkdir -p src/vendor/tensorflow
sudo tar -C src/vendor/tensorflow -xzf libtensorflow-gpu-linux-x86_64-2.12.1.tar.gz

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

./configure --disable-doc \
--disable-htmlpages \
--disable-manpages \
--disable-podpages \
--disable-txtpages \
--pkg-config-flags="--static" \
--ld="g++"
sudo make
sudo make install

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants