Code Monkey home page Code Monkey logo

Comments (7)

wackou avatar wackou commented on May 26, 2024

Well, this is trickier than it seems...

Normally, you should just uncomment those lines: https://github.com/MTG/essentia/blob/master/wscript#L65

However, if you do that, then this file doesn't compile anymore: https://github.com/MTG/essentia/blob/master/src/base/roguevector.h

And the problem lies in the fact that the RogueVector class relies on an implementation detail of the C++ library which uses protected inheritance in libstdc++, so we can override its behavior, but uses private inheritance in libc++... There is actually no clean way to do this with libc++, so we're stuck with libstdc++ at the moment (which is not very nice when developing with clang/libc++, I agree...).

The correct and clean solution would be to replace all uses of std::vector in Essentia using a new essentia::Vector class that would also give us the behavior of the RogueVector class (ie: can "borrow" memory from another vector, required for the streaming mode). That is however quite some bit of work...

from essentia.

sarith avatar sarith commented on May 26, 2024

I completely understand. I wish I had the necessary skills to contribute a solution to this issue.

In the meantime, I suppose one workable solution for my prototype would be to compile my extractor as a command line utility, execute the utility from my "host" application, write the algorithm results to a file, and then read/parse the file contents to my host libc++ application.

If anyone else has any ideas, input would be greatly appreciated.

from essentia.

wackou avatar wackou commented on May 26, 2024

Compiling the extractor as a command-line utility seems the best choice:

  • a crash in Essentia doesn't crash your host app
  • it is very easily parallelizable if you want to run an extractor on lots of files; you can also have a task queue distribute jobs depending on the number of cores available to optimize CPU usage (very adapted to running lots of tasks on a cluster)
  • you get the build system for the extractor nearly "for free", just add yours in the src/examples and edit the https://github.com/MTG/essentia/blob/master/src/examples/wscript file to add it.

from essentia.

loretoparisi avatar loretoparisi commented on May 26, 2024

I just came across the same issue when trying to build Essentia on mobile iOS.
I ported FFTW to iOS/armv7 using this script that works (quite) good:

http://stackoverflow.com/questions/3588904/how-to-link-third-party-libraries-like-fftw3-and-sndfile-to-an-iphone-project-in

Then I put everything in XCode5 and build.

Now the error is exactly the problem depicted here:

Without having the libc++ flags active I have:

/Users/loreto/Projects/iOS/AUDIO/EssentiaTouch/EssentiaTouch/Classes/essentia/roguevector.h:127:40: No member named '_M_impl' in 'essentia::RogueVector'

My question here is

Is possibile to use instead Apple "veclib.h" from Accelerate.Framework here ?

I mean

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h

from essentia.

wackou avatar wackou commented on May 26, 2024

the problem here is that the RogueVector class relies on an implementation detail of the std::vector class from the gnu libstdc++ that gcc links to. Clang however links against libc++ which has a different implementation and doesn't allow the RogueVector to be implemented on top of it, because all its member variables are private (they are protected in libstdc++).

If you could compile using libstdc++ instead of libc++ that should make it work.

Otherwise, the better (but more time consuming) solution would be to implement a custom vector class that would allow the RogueVector to be implemented, and change all the buffers in the streaming mode to use that vector class (instead of std::vector currently)

from essentia.

loretoparisi avatar loretoparisi commented on May 26, 2024

I agree that the best solution would it be to implement the custom vector class. So far I'm compiling against libstdc++ and it works fine on LLVM5.0 / armv7.

That was operating in standard mode, due to too much native IO limitation with the streaming mode on armv7 devices.

Hope to see a RogueVector specific implementation and a huge refactoring then!

from essentia.

wackou avatar wackou commented on May 26, 2024

The latest version of master now builds against libc++ instead of libstdc++ on mac os. It's a big fat hack but it works, so that's what it is :-) The correct fix is still to move most of Essentia to a specific essentia::Vector (and essentia::Matrix to replace tnt::Array2D), but that will be for a later version. In the meantime, it should now compile everywhere using the native compiler and C++ standard lib (should also work on iphone, although I haven't tested it)

from essentia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.