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.81k stars 525 forks source link

Compiling using native windows Visual Studio compiler #330

Open Tripphippie opened 8 years ago

Tripphippie commented 8 years ago

I'm attempting to build Essentia using Visual studio and native windows tools. I'm not a linux guy and I don't want to setup cygwin and all that nonsense. Would someone be so kind as to send me a copy of essentia_algorithms_reg.cpp that I could use? I'm going to replace the python with something else and I need a template to know what to output. If anyone is interested in native windows builds I might be able to upstream my changes. Also what is up with the RogueVector class. The methods that access private members of std::vector won't compile but I think with swap semantics and the c++11 compiler features you shouldn't have to use the rogueVector at all.

dbogdanov commented 8 years ago

Sure, here is the file, and your contributions are more than welcome.

Tripphippie commented 8 years ago

Thanks so much. Any ideas on what to do with RogueVector? It's basically a hack and it won't compile in this version of VCC. I'm almost convinced I can remove it completely but I need to run some tests to be sure.

dbogdanov commented 8 years ago

Try changing back to the the old code of RogueVector for WIN32 which is now commented.

q-depot commented 8 years ago

I've been trying to compile with VS for months, still can't get it to work, for the RogueVector I've replace these functions:

template void RogueVector::setData(T* data) { T* this_data = this->data(); this_data = data;

// this->_M_impl._M_start = data; }

template void RogueVector::setSize(size_t size) { this->resize( size ); this->shrink_to_fit();

// this->_M_impl._M_finish = this->_M_impl._M_start + size; // this->_M_impl._M_end_of_storage = this->_M_impl._M_start + size; }

@dbogdanov is there any chance somebody can look at a proper VS solution? seems many people would like to use it on windows and to be honest I don't know anybody using codeblocks.

thanks

Tripphippie commented 8 years ago

@q-depot Does that work? I may give your implementation a go. @dbogdanov That was the first thing I tried to do. The implementation has changed and that code doesn't compile anymore in VS. If I understood what the RogueVector was trying to accomplish then I think I can come up with a good implementation for Visual Studio. I think the swap constructor does what RogueVector is trying to do which is avoid a copy.

q-depot commented 8 years ago

I've managed to compile everything in VS and build a static library, but the library itself didn't work so I couldn't test that implementation. Besides the roguevector there are many other issues you need to go through, namespace, includes etc. I'm about to have another go so I'll keep you posted, but I think I'm giving up with the static library, the one I've compiled was about 1gb( osx static lib is 40mb), not sure why it gets so big.

Tripphippie commented 8 years ago

I have a static lib working right now and I've managed to link it to a test application but I don't have roguevector implemented. I ran my test app and it stopped on RogueVector because I put a _DebugBreak() stub in there to remind me to fix it. I'm not sure why the lib would be so big. mine is also 1.2gb. I had to pull a fresh build of ffmpeg to get stuff to link. I'm going to try your version of RogueVector next as I've spent most of today resolving libav dependencies.

q-depot commented 8 years ago

IMO the 1.2gb lib is not usable, I also reckon it should be compile without the dependencies.

Tripphippie commented 8 years ago

I think it might have something to do with the dependencies why it is so large. I'm going to try to make it into a DLL after I get this static lib working. Then I might be able to see why it is so large. I think we might have a situation where the entire cygwin c-runtime is linked into this static lib. All the dependencies would need to be recompiled under windows to correct the problem. Keep in mind this is under a debug build so it may shrink when all the debug junk is removed.

q-depot commented 8 years ago

the static library in release was about 700-800Mb so still huge.

Today I've made some progress, as I said I gave up(for now) with the static library, instead I've compiled the source straight in my app, I've stripped out most of the library and all the dependencies. I had to fix a few issues mostly with the cmath library, and I uncommented the roguevector implementation which seems to be working. The current implementation is not fully working but at least I can build and compute(badly) the mfcc.

MGarvinNYC commented 8 years ago

I'm glad to hear that there's an effort to build a Windows/VS version!

Re the size (800MB?!): There is supposedly a way to cross-compile a Windows lib from Linux. I don't think that the library will do much good in itself, as it's not VS-compatible, and supposedly has no Python bindings. But perhaps it would give an indication of size to expect in a reasonable VS build.

dbogdanov commented 8 years ago

800mb is so huge! :open_mouth: The cross-compiled library using mingw-w64 on Linux should be no more than 20mb.

dbogdanov commented 8 years ago

@q-depot Your fix for RogueVector using data(), resize() and shrink_to_fit() looks dangerous. If the size of the vector was smaller before setSize, I would expect resize() to mess up with the data in the data() pointer.

q-depot commented 8 years ago

I'm using the commented code you left there. It seems fine

q-depot commented 8 years ago

I've found another issue while building in debug, the static free method in algorithfactory.h seems in conflict with the reserved one, I had to rename it to something like this:

static void freeAlgo(BaseAlgorithm* algo) { delete algo; }

it would be good to fix it in the master branch.

Tripphippie commented 8 years ago

Ok so a little update on this. I have a static lib working mostly. I have a dll that is much much smaller (7mb) but is missing a bunch of ESSENTIA_API export tags, it will grow as I add missing things. I can't get taglib to work at all since the dll in the package folder is for gcc or something. So MetadataReader is missing from the lib. I'm not actually sure at this time how I got taglib working in the static version of the library, strange. I'm currently decorating missing functions but it is impossible to know which ones are missing until I link with an test exe so I may not find them all.

EDIT: Oh man! I think I just stumbled across some dark hole of dllimport and headers and inlining and dlls. I may have to refactor this whole thing a little. I get link errors on global variables and statics.

q-depot commented 8 years ago

what errors are you getting? I had similar problems with kissfft

Tripphippie commented 8 years ago

Taglib won't link because the lib file is missing and I'm too lazy to compile the whole thing. Even if it existed linker would be looking for the wrong name mangling scheme as the DLL is full of gcc names. I didn't have problems with kiss as the source is there. I just pulled the source into my project. I'm having problems getting certain symbols to export in the DLL. I'm going to have to get all the test programs to compile and link and then maybe I have a chance of getting a full complete DLL. Problem is that gcc exports most things by default while MSVC requires templates to be instantiated. I had to add some template instance declarations to force the template instance to be created and exported. Now I'm stuck on getting statics and globals to export properly. Here's my current error list.

2>BasicExtractor.obj : error LNK2001: unresolved external symbol "int essentia::activatedDebugLevels" (?activatedDebugLevels@essentia@@3HA)
2>BasicExtractor.obj : error LNK2001: unresolved external symbol "int essentia::debugIndentLevel" (?debugIndentLevel@essentia@@3HA)
2>BasicExtractor.obj : error LNK2001: unresolved external symbol "class essentia::Logger essentia::loggerInstance" (?loggerInstance@essentia@@3VLogger@1@A)
2>BasicExtractor.obj : error LNK2001: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const essentia::standard::Algorithm::processingMode" (?processingMode@Algorithm@standard@essentia@@2V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B)
2>BasicExtractor.obj : error LNK2001: unresolved external symbol "private: static class essentia::EssentiaFactory<class essentia::standard::Algorithm> * essentia::EssentiaFactory<class essentia::standard::Algorithm>::_instance" (?_instance@?$EssentiaFactory@VAlgorithm@standard@essentia@@@essentia@@0PAV12@A)
MGarvinNYC commented 8 years ago

I'm curious about how this is going. Stalled for the holidays?

Essentia commented 8 years ago

Hello,

Somehow my company email and name (ESSENTIA) got linked to this post .... As far as I could read on the post, it's related music files?


Gabor Simonsich

Desarrollador de Negocios Business Developer Essentia

Cel: +598 95 120021 gabor.simonsich@essentia.com.uy www.essentia.com.uy

On Wed, Dec 30, 2015 at 4:22 AM, MGarvinNYC notifications@github.com wrote:

I'm curious about how this is going. Stalled for the holidays?

— Reply to this email directly or view it on GitHub https://github.com/MTG/essentia/issues/330#issuecomment-167950439.

dbogdanov commented 8 years ago

@Essentia Yes it is. You got referred accidentally, sorry for that.

dbogdanov commented 8 years ago

I've found this for building taglib for Visual Studio: http://stackoverflow.com/a/5365962

Tripphippie commented 8 years ago

This has come to a halt for the time being. Holidays is over and the skunk-works time I had at work has expired with it. If I disable the debug macros I can get it down to 1 variable not linking properly. I'm not sure how to fix this problem.I think this link is relevant. http://stackoverflow.com/questions/17614172/c-template-singletons-in-a-dll So I think I need to move some stuff around in the headers and have templates in cpp files which is weird. last error.... 2>BasicExtractor.obj : error LNK2001: unresolved external symbol "private: static class essentia::EssentiaFactory * essentia::EssentiaFactory::_instance" (?_instance@?$EssentiaFactory@VAlgorithm@standard@essentia@@@essentia@@0PAV12@A)

MGarvinNYC commented 8 years ago

Sorry to hear that the real world is intruding! :-) It sounds like you're so close, too.

Perhaps Dmitri or others could shed some light on that last problem?

Tripphippie commented 8 years ago

I cracked some sort of solution but I don't like it. None of my other solutions have worked except this. If I compile the DLL with #include "algorithmfactory_impl.h" and then comment that line out when I include it in my executable it works. #ifdef'ing the line out doesn't work for some reason. neither does moving the code from algorithmfactory_impl.h to a cpp file and only including it in the dll project. I think I might try moving the code to a "algorithmfactory_private.h" and making a copy to use when importing the DLL. Basically the templated function is expanding in both compilation units and then failing to link because it is in a different compilation unit, it needs to only include the basic interface and not any of the template function bodies. Windows DLLs differ from SOs on linux in that they don't invoke the linker when binding. you can end up with the same templated classes in both objs and statics become a problem.

edit: nevermind. I'm still not sure why this works but I moved the template instantiation to the header with the extern keyword and it works without commenting out lines selectively. Now to actually try to use some algorithms and probably sort out some more issues since this is like a basic basic link test that is working.

double edit: Seems all the win32 3rd party dlls don't match the libs that are right next to them. Need to get win32 libs for ffmpeg.

mathieu-b commented 8 years ago

Hi I am also trying to have Essentia up and running under Visual Studio 2015. Any updates about how to possibly implement RogueVector (or an equivalent) under VisualStudio? @wackou / @Tripphippie / @dbogdanov ?

Are there any resources detailing the RogueVector specifications and usage?

Thanks

wackou commented 8 years ago

the RogueVector initially was a hack in C++98 to support non-owning vector and allow a nicer api than passing (float* array, int size) as arguments to all functions.

A better solution (since C++11) would be to use a std::array (http://en.cppreference.com/w/cpp/container/array) which has the efficiency of passing raw pointers around but has a nice object-oriented api. That involves changing a bit of code, but it probably would be worth it in the long run. Alternatively, one could define an essentia::Array type, use it everywhere in the api, and typedef it to a given type (std::array for instance)

For a quick solution, though, I maybe looking at the source code of roguevector (https://github.com/MTG/essentia/blob/master/src/essentia/roguevector.h#L77) and see how it could be adapted to the (I imagine) new libstdc++ from the latest Visual Studio would be faster.

mathieu-b commented 8 years ago

Ok, thanks for the clarification and suggestions @wackou :)

q-depot commented 6 years ago

is there any update on this? I've managed to compile in VisualStudio a while ago, I had to do many tweaks and hacks. Now I want to update to the latest and I basically have to start from scratch. has the code been updated to c++11?

dbogdanov commented 6 years ago

Check the python_win branch, there's some work done to be able to compile with VS. See the build instructions here. We have prebuilt 32 bit dependencies, but we are missing some of the 64bit. We'll add a download link if you need those.

q-depot commented 6 years ago

is that link only for the python bindings or the library too I've managed to compile the latest master as a static library, it's not tested, but it seems promising, the last time I tried to compile the static library I've ended up with 1GB lib file, this time the size is reasonable.

My approach is a bit brutal, I basically got rid of all dependencies except for fftw which is linked against the dll, at the moment I'm only building the standard and spectral algorithms, but it should work with the others too.

I'll spend a couple of more days on it and maybe post an update, but please let me know if you are already working on a VS solution.

dbogdanov commented 6 years ago

This will build essentia library too.

q-depot commented 6 years ago

I'll give it a try thanks, I was also wrong about my static lib, it's again huge, I'm not sure why.

dbogdanov commented 6 years ago

@q-depot That's no good. My test build for python occupies only 13 MB.

q-depot commented 6 years ago

the waf config doesn't find the fftw lib. I couldn't run prepare_fftw3_build.sh without errors, so I've done it manually, I'm fairly confident everything is in the right place. Also I think there is an error in the script, the exp file is renamed "fftwf3" instead "fftw3f"

this is what I have:

packaging\win32_3rdparty\builds\fftw-3.3.3\include\fftw3.h packaging\win32_3rdparty\builds\fftw-3.3.3\lib\fftw3f.def (is it needed?) packaging\win32_3rdparty\builds\fftw-3.3.3\lib\fftw3f.exp (is it needed?) packaging\win32_3rdparty\builds\fftw-3.3.3\lib\fftw3f.lib packaging\win32_3rdparty\builds\fftw-3.3.3\lib\libfftw3f-3.dll

EDIT: it seems I've found the issue, I was missing the .pc file, I just copied it over from the master branch. win32_3rdparty\builds\fftw-3.3.3\lib\pkgconfig\fftw3f.pc

q-depot commented 6 years ago

I've managed to compile the static library, but it's again huge, about 800mb. If I run the script without build-static option, it compiles file, but I always get an error at the end when it tries to link:

essentia_algorithms_reg.cpp [244/244] Linking build\src\essentia.dll LINK : fatal error LNK1181: cannot open input file 'm.lib'

Ideally I'd prefer to compile the static library, but I'm fine with the dll too.

this is how I run the waf script, I tried with both vc2015 ad vc2017 tools, same result: python waf configure --msvc_targets="x64" --mode="release" --with-python python waf configure --msvc_targets="x64" --mode="release" --build-static --with-python

EDIT: I should have also mentioned that I'm trying to build it only with fftw as dependency

dbogdanov commented 6 years ago

@q-depot Btw, you can get rid of fftw dependency if you configure with --fft=KISS.

q-depot commented 6 years ago

I'm fine with fftw for now unless you have a good point for not using it.

The main problem is I still can't compile it, as I said when I do a static build the library is huge. When I try to build the dll I get a linker error for the m.lib, do you know what this is?

thanks

ihassantariq commented 5 years ago

Hey @Tripphippie I am trying to build for windows too to use it for building wrappers for my project instead of p-invokes. Can you give me your file which is already compiled I just need symbols. Also, if you have visual studio project that could also work. Thanks in advance.

paleomoon commented 4 years ago

I compiled dll according to this:https://github.com/MTG/essentia/blob/python_win/INSTALL_windows.md, but get linking error when linking it to examples, some kind like @Tripphippie meet before, but I can't solve this. Can anyone help me?Please...😭

1>test.obj : error LNK2019: unresolved external symbol "public: void __cdecl essentia::Logger::debug(enum essentia::DebuggingModule,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)" (?debug@Logger@essentia@@QEAAXW4DebuggingModule@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z) referenced in function "protected: class essentia::standard::Algorithm * __cdecl essentia::EssentiaFactory<class essentia::standard::Algorithm>::create_i(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &)const " (?create_i@?$EssentiaFactory@VAlgorithm@standard@essentia@@@essentia@@IEBAPEAVAlgorithm@standard@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0AEBVParameter@2@01010101@Z)
1>test.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl essentia::nameOfType(class type_info const &)" (?nameOfType@essentia@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVtype_info@@@Z) referenced in function "public: class std::vector<float,class std::allocator<float> > const & __cdecl essentia::Pool::value<class std::vector<float,class std::allocator<float> > >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (??$value@V?$vector@MV?$allocator@M@std@@@std@@@Pool@essentia@@QEBAAEBV?$vector@MV?$allocator@M@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)
1>test.obj : error LNK2019: unresolved external symbol "void __cdecl essentia::init(void)" (?init@essentia@@YAXXZ) referenced in function main
1>test.obj : error LNK2019: unresolved external symbol "void __cdecl essentia::shutdown(void)" (?shutdown@essentia@@YAXXZ) referenced in function main
1>test.obj : error LNK2019: unresolved external symbol "public: void __cdecl essentia::ParameterMap::add(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &)" (?add@ParameterMap@essentia@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVParameter@2@@Z) referenced in function "public: void __cdecl essentia::Configurable::configure(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &)" (?configure@Configurable@essentia@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVParameter@2@010101010101010101010101010101@Z)
1>test.obj : error LNK2019: unresolved external symbol "public: class essentia::Parameter const & __cdecl essentia::ParameterMap::operator[](class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (??AParameterMap@essentia@@QEBAAEBVParameter@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: class essentia::Parameter const & __cdecl essentia::Configurable::parameter(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?parameter@Configurable@essentia@@QEBAAEBVParameter@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>test.obj : error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl essentia::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,enum essentia::Parameter::ParamType const &)" (??6essentia@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AEAV12@AEBW4ParamType@Parameter@0@@Z) referenced in function "public: __cdecl essentia::EssentiaException::EssentiaException<char [38],enum essentia::Parameter::ParamType>(char const (&)[38],enum essentia::Parameter::ParamType const &)" (??$?0$$BY0CG@DW4ParamType@Parameter@essentia@@@EssentiaException@essentia@@QEAA@AEAY0CG@$$CBDAEBW4ParamType@Parameter@1@@Z)
1>test.obj : error LNK2019: unresolved external symbol "public: void __cdecl essentia::Pool::add(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<float,class std::allocator<float> > const &,bool)" (?add@Pool@essentia@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$vector@MV?$allocator@M@std@@@4@_N@Z) referenced in function main
1>test.obj : error LNK2001: unresolved external symbol "int essentia::activatedDebugLevels" (?activatedDebugLevels@essentia@@3HA)
1>test.obj : error LNK2001: unresolved external symbol "int essentia::debugIndentLevel" (?debugIndentLevel@essentia@@3HA)
1>test.obj : error LNK2001: unresolved external symbol "class essentia::Logger essentia::loggerInstance" (?loggerInstance@essentia@@3VLogger@1@A)
1>test.obj : error LNK2001: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const essentia::standard::Algorithm::processingMode" (?processingMode@Algorithm@standard@essentia@@2V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B)
1>test.obj : error LNK2001: unresolved external symbol "private: static class essentia::EssentiaFactory<class essentia::standard::Algorithm> * essentia::EssentiaFactory<class essentia::standard::Algorithm>::_instance" (?_instance@?$EssentiaFactory@VAlgorithm@standard@essentia@@@essentia@@0PEAV12@EA)
q-depot commented 4 years ago

have a look at the changes I made in my repository, I had the same issues and I've managed to compile and link the dll.

https://github.com/q-depot/essentia/tree/python_win

paleomoon commented 4 years ago

Hi @q-depot , thanks for your reply. I compiled your fork and changed ESSENTIA_EXPORTS to 0 in config.h when linking the dll , got 2 lingking error:

1>test.obj : error LNK2019: unresolved external symbol "public: void __cdecl essentia::Pool::add(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<float,class std::allocator<float> > const &,bool)" (?add@Pool@essentia@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$vector@MV?$allocator@M@std@@@4@_N@Z) referenced in function main
1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class essentia::standard::Algorithm * __cdecl essentia::EssentiaFactory<class essentia::standard::Algorithm>::create(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &)" (__imp_?create@?$EssentiaFactory@VAlgorithm@standard@essentia@@@essentia@@SAPEAVAlgorithm@standard@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0AEBVParameter@2@01010101@Z) referenced in function main

After adding ESSENTIA_API to class Pool , compiled the dll, I got only the last one error:

1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class essentia::standard::Algorithm * __cdecl essentia::EssentiaFactory<class essentia::standard::Algorithm>::create(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class essentia::Parameter const &)" (__imp_?create@?$EssentiaFactory@VAlgorithm@standard@essentia@@@essentia@@SAPEAVAlgorithm@standard@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0AEBVParameter@2@01010101@Z) referenced in function main

Now I'm stuck here...😖

q-depot commented 4 years ago

try to build it with this script python waf configure --fft=KISS --msvc_targets="x64" --prefix="REPLACE_THIS" --mode="debug"

paleomoon commented 4 years ago

@q-depot Great appreciate! It worked! Just notice debug mode needs flag -bigobj for me:

ctx.env.CXXFLAGS += ['-Od', '-MDd', '-Gd','-bigobj']

I'v tried these commands:

  1. Linking error
    python waf configure --msvc_targets="x64" --lightweight=libav,libsamplerate --fft=KISS --prefix="D:\temp" --mode="release"
    python waf configure --msvc_targets="x64" --lightweight=libav,libsamplerate --fft=KISS --prefix="D:\temp" --mode="debug"
  2. factory.create runtime error: std::bad_alloc
    python waf configure --msvc_targets="x64" --fft=KISS --prefix="D:\temp" --mode="release"
  3. Everything well
    python waf configure --msvc_targets="x64" --fft=KISS --prefix="D:\temp" --mode="debug"

    To summarize, only debug mode and no --lightweight flag works for me.

q-depot commented 4 years ago

glad it worked! the downside is I didn't pull from the main repo in a while, so it's a bit out of date.

@dbogdanov do think we can merge those changes?

goloskokovic commented 4 years ago

@paleomoon @q-depot I followed all the steps and was able to build a library. How do I link it in VS project for MFCC example? I keep getting errors like yours from Nov 2019. Can you share built library ?

it works when changing Runtime Library https://stackoverflow.com/questions/28887001/lnk2038-mismatch-detected-for-runtimelibrary-value-mt-staticrelease-doesn

adding Additional Dependencies C:\Users\user\source\repos\essentia\build\src\essentia.lib C:\Users\user\source\repos\essentia\packaging\win32_3rdparty\lib\avcodec.lib C:\Users\user\source\repos\essentia\packaging\win32_3rdparty\lib\avformat.lib C:\Users\user\source\repos\essentia\packaging\win32_3rdparty\lib\avresample.lib C:\Users\user\source\repos\essentia\packaging\win32_3rdparty\lib\avutil.lib C:\Users\user\source\repos\essentia\packaging\win32_3rdparty\lib\libfftw3f-3.lib C:\Users\user\source\repos\essentia\packaging\win32_3rdparty\lib\chromaprint.lib C:\Users\user\source\repos\essentia\packaging\win32_3rdparty\lib\samplerate.lib C:\Users\user\source\repos\essentia\packaging\win32_3rdparty\lib\tag.lib C:\Users\user\source\repos\essentia\packaging\win32_3rdparty\lib\yaml.lib C:\Users\user\source\repos\essentia\packaging\win32_3rdparty\lib\zlib.lib

essentia.lib 750MB https://drive.google.com/file/d/1qtwMW-D94za2lG65r5KcWhW-XTCPBrhl/view?usp=sharing

moebiussurfing commented 4 years ago

hey @goloskokovic , thanks for your link to the lib. @q-depot too for your tips

I am trying to compile the engine within an openFrameworks project using the https://github.com/leozimmerman/ofxAudioAnalyzer addon. On the project folder, I am using the src/essentia/ files from essentia-2.1_beta5 release tag.

It's the same version that yours?

Any idea of what can I try?

Any change to get fresh info or the compiled .dll/.lib from you?

These are my errors:

Severity    Code    Description Project File    Line    Suppression State
Error   C2059   syntax error: ')' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\streamingalgorithmcomposite.cpp) example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\scheduler\graphutils.h 112 
Error   C1083   Cannot open include file: 'libavcodec/avcodec.h': No such file or directory (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\utils\audiocontext.cpp)  example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\utils\ffmpegapi.h  24  
Error   C1083   Cannot open include file: 'yaml.h': No such file or directory (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\utils\jsonconvert.cpp) example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\utils\yamlast.h    28  
Error   C1083   Cannot open include file: 'yaml.h': No such file or directory (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\utils\yamlast.cpp) example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\utils\yamlast.h    28  
Error   C2589   '(': illegal token on right side of '::' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.cpp)   example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.h 51  
Error   C2062   type 'unknown-type' unexpected (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.cpp) example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.h 51  
Error   C2059   syntax error: ')' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.cpp)  example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.h 51  
Error   C2589   '(': illegal token on right side of '::' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.cpp)   example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.h 53  
Error   C2062   type 'unknown-type' unexpected (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.cpp) example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.h 53  
Error   C2059   syntax error: ')' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.cpp)  example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\devnull.h 53  
Error   C2589   '(': illegal token on right side of '::' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.cpp)   example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.h 71  
Error   C2062   type 'unknown-type' unexpected (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.cpp) example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.h 71  
Error   C2059   syntax error: ')' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.cpp)  example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.h 71  
Error   C2589   '(': illegal token on right side of '::' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.cpp)   example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.h 73  
Error   C2062   type 'unknown-type' unexpected (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.cpp) example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.h 73  
Error   C2059   syntax error: ')' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.cpp)  example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\streaming\algorithms\poolstorage.h 73  
Error (active)  E0040   expected an identifier  example-rmsInput    F:\openFrameworks\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\scheduler\graphutils.h 112 
Error   C2589   '(': illegal token on right side of '::' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\scheduler\network.cpp)  example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\scheduler\graphutils.h 112 
Error   C2062   type 'unknown-type' unexpected (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\scheduler\network.cpp)    example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\scheduler\graphutils.h 112 
Error   C2059   syntax error: ')' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\scheduler\network.cpp) example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\scheduler\graphutils.h 112 
Error   C2589   '(': illegal token on right side of '::' (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\streamingalgorithmcomposite.cpp)  example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\scheduler\graphutils.h 112 
Error   C2062   type 'unknown-type' unexpected (compiling source file ..\..\..\addons\ofxAudioAnalyzer\libs\essentia\include\essentia\streaming\streamingalgorithmcomposite.cpp)    example-rmsInput    f:\openframeworks\addons\ofxaudioanalyzer\libs\essentia\include\essentia\scheduler\graphutils.h 112 

https://github.com/leozimmerman/ofxAudioAnalyzer/issues/26

goloskokovic commented 4 years ago

@moebiussurfing version I was able to compile is from @q-depot https://github.com/q-depot/essentia/tree/python_win

dbogdanov commented 4 years ago

Have a look at the build instructions in that branch.

maxgraf96 commented 4 years ago

@moebiussurfing hey! Did you get it running with OF? I'm currently trying to integrate essentia into JUCE with Visual Studio, but I'm also getting linker errors.