-
Notifications
You must be signed in to change notification settings - Fork 541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling using native windows Visual Studio compiler #330
Comments
Sure, here is the file, and your contributions are more than welcome. |
Thanks so much. |
Try changing back to the the old code of RogueVector for WIN32 which is now commented. |
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 // this->_M_impl._M_start = data; template // this->_M_impl._M_finish = 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 |
@q-depot Does that work? I may give your implementation a go. |
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. |
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. |
IMO the 1.2gb lib is not usable, I also reckon it should be compile without the dependencies. |
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. |
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'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. |
800mb is so huge! 😮 The cross-compiled library using mingw-w64 on Linux should be no more than 20mb. |
@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. |
I'm using the commented code you left there. It seems fine |
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) { it would be good to fix it in the master branch. |
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: |
what errors are you getting? I had similar problems with kissfft |
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.
|
I'm curious about how this is going. Stalled for the holidays? |
Hello, Somehow my company email and name (ESSENTIA) got linked to this post .... Gabor Simonsich Desarrollador de Negocios Cel: +598 95 120021 On Wed, Dec 30, 2015 at 4:22 AM, MGarvinNYC [email protected]
|
@Essentia Yes it is. You got referred accidentally, sorry for that. |
I've found this for building taglib for Visual Studio: http://stackoverflow.com/a/5365962 |
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 |
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? |
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: |
Hi Are there any resources detailing the RogueVector specifications and usage? Thanks |
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. |
Ok, thanks for the clarification and suggestions @wackou :) |
@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. |
hey @maxgraf96, I do not have tried yet to compile by myself. BTW if somebody can share the dll/lib would be nice! |
Alright, if you ever do let me know, I'll post some updates here in case I can get it to work! But for now it looks like it's pretty much impossible with VS... |
to build in VS you need to:
all these changes should be in my fork: https://github.com/q-depot/essentia/commits/python_win The build instructions mentioned by @dbogdanov are a good starting point @moebiussurfing some of your errors are missing dependencies, I compiled my library without that stuff, just use the minimum dependencies, there should be an option for "lightweight" build. @dbogdanov would be great if you could check at those changes in my repo and merge |
@q-depot Any hits as to what should be done with the RogueVector? Also, were you able to reduce the static lib size in the end? 800mb is not useable for the hardware I am planning to run it on. |
Hi @q-depot & @hosaka When trying to compile with only one algorithm (MonoLoader), it still compiles 38 algos, including the streaming and freesound algorithms. Here is my command in the x64 command prompt : It doesn't find my 3rd parties dependencies, even if they are in the folder. Thanks! Edit : Installing pkgconfiglite through chocolatey solved my problem. |
Hi, After setting I've tried with different flags (debug/release/reduced dependencies), but I can't manage to get it linked properly. |
I'm interested in well working *.lib and *.dll of Essentia compiled for Visual Studio 2019, Windows 7, x64 |
yes, should be nice that some successful compiled files can be shared to download... |
did you successful compile it on windows use waf? |
The python_win branch has been updated further, cherry-picking from @q-depot and with other modifications. |
thanks, hte prebuilding lib includes all third party depencies ? |
@dbogdanov do you know if anyone gets Essentia running in streaming mode on Windows 10 using VisualStudio-built lib or dll? Not sure what's the latest with #204 ? Thanks. |
@yyf |
@goloskokovic thanks for your example! My python waf configures successfully but python waf fails at Thanks. |
@yyf |
@goloskokovic I tried to build the MFCC example with your prebuilt essentia.lib but got lots of linker errors (716): |
Be sure to link 3rdparty libs In short you are probably mixing release and debug |
@goloskokovic Finally got it compiled. My MFCC (and other examples) execute fine without error, but they don't output any result/file for some reason. It doesn't behave like the MFCC example in the prebuilt extractor binaries, where it logs "...start processing... writing results to file..." Ever seen this before? |
@yyf |
@goloskokovic Works now. Had some typo in my debug setting. Thanks again. |
So, do we have some static library for x64 and x86 for Visual Studio? |
maybe could use this one? |
Hi, I'm trying to build a minimalistic version of Essentia, with no dependencies, on Visual Studio 2022. I can't use dbogdanov's build because I need it to be built with /MD (Multithreaded DLL) rather than /MT (Multithreaded static library). I'm stumbilng onto the RogueVector thing, too. I understand that some of you (@dbogdanov, @q-depot) have found a working fix for this, but I must be missing something as I'm not finding it in your repos... Any hint about this? |
there where some python projects to compile if I not remember bad. |
@andreaagostini Out of interest, how are you setting the CRT config? The only way I can see to do it is via CXXFLAGS, something like |
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.
The text was updated successfully, but these errors were encountered: