MTG / essentia

C++ library for audio and music analysis, description and synthesis, including Python bindings
http://essentia.upf.edu
GNU Affero General Public License v3.0
2.83k stars 530 forks source link

Linker errors when trying to use iOS #916

Open johanlantz opened 5 years ago

johanlantz commented 5 years ago

Hi,

I just started off with Essentia and I have built the library without issues as described here: https://essentia.upf.edu/documentation/FAQ.html#cross-compiling-for-ios

Then I have added the search paths in xCode and setup the project to link with libessentia.a in the Build Phases.

The problem is that the linker fails as below: Undefined symbols for architecture arm64: "_nnls", referenced from: essentia::standard::NNLSChroma::compute() in libessentia.a(nnlschroma.cpp.1.o) ld: symbol(s) not found for architecture arm64

Compilation is fine but adding any function (like the init call below) calls causes the linker to fail complaining that the function is not found. `

include "essentia.h"

include

include <essentia/pool.h>

extern "C" void initEssentia() { essentia::init(); } `

Running nm does indicate that the _nnls function is indeed there: libessentia.a(nnls.c.1.o): U ___stack_chk_fail U ___stack_chk_guard 0000000000001e78 S _c__0 0000000000001d28 D _c__1 0000000000001d2c D _c__2 0000000000000000 T _d_sign 0000000000000090 T _g1 0000000000000380 T _h12 0000000000000a20 T _nnls

and running lipo -info libessentia.a correctly states that: Architectures in the fat file: /usr/local/lib/libessentia.a are: armv7 arm64 x86_64

So it kinda looks ok but still does not work.

Any suggestions welcome, been blocked with this the whole day with no progress.

johanlantz commented 5 years ago

If I comment out this line: nnls(curr_dict, nNote, nNote, signifIndex.size(), b, x, &rnorm, w, zz, indx, &mode);

in nnlschroma.cpp it links ok.

romanticamaj commented 4 years ago

I ran into this same issue.

Indeed, comment out nnls(curr_dict, nNote, nNote, signifIndex.size(), b, x, &rnorm, w, zz, indx, &mode); in nnlschroma.cpp it links ok.

Wouldn't this break the functionality of NNLSChroma?

Is there any other more safe way to fix this linking error?