lundi 25 juillet 2016

How to make mutexes work in NDK on Ubuntu?

Gradle experimental plugin v.0.7.0 is used to work with NDK in Android project.

For app module with native code this NDK configuration is used:

ndk {
        moduleName = 'engine'                                      
        toolchain  = 'clang'
        cppFlags.addAll(["-I${file(project.mPathIncOCV)}".toString(), 
                         '-O3',                                       
                         '-std=c++11',                               
                         '-frtti',                                   
                         '-fexceptions'])                          
        ldLibs.addAll(['android', 'log', 'opencv_java3'])            
        stl = 'gnustl_static'  
    }

Everything works great with such configuration. Some std includes also work.

But. When I try to use mutexes (from std) in my C++ code, it works well in OS X, but encounters next error in Ubuntu which makes compilation impossible:

'mutex' in namespace 'std' does not name a type

Looked for some corresponding questions. Tried to change stl on c++ and stlport, to use another (gcc) toolchain, but without any success.

Is it reasonable to keep trying to configure mutexes for compilation in Ubuntu, or it's better to look for some workaround (e.g. using mutexes from some library)?

Aucun commentaire:

Enregistrer un commentaire