OpenCv with Clang and Crystax in Gradle Experimental .. link errors

75 views
Skip to first unread message

Declan

unread,
Jan 17, 2017, 4:23:49 AM1/17/17
to crystax-ndk

    I get strange link errors when trying to use opencv with crystax, clang and the gradle experimental plugin.
   
    I build opencv according to the instructions at
    http://silverglint.com/opencv-on-android/
   
    Modify the google sample:
    https://github.com/googlesamples/android-ndk/tree/gradle-experimental/hello-libs
    so that it uses opencv.
   
    my .cpp files contains something like:
   
   
#include <opencv2/core.hpp>
   
   
int cpus = cv::getNumberOfCPUs();
    std
:string buildInfo =  cv::getBuildInformation();


   
    This builds and runs fine with:
        google ndk & gcc
        google ndk and clang
        crystax ndk  and gcc
   
    get strange link errors however if I try to use clang with crystax
   
  
  error: undefined reference to 'cv::getBuildInformation()'
    clang
: error: linker command failed with exit code 1


   
    Even more strange is that the linker has no trouble with cv::getNumberOfCPUs()
    (If I comment out just the cv::getBuildInformation() line then the app runs fine)
   
    even though both functions are defined in the same header and defined in the same libopencv_core.so
   
     
   moduules/core
       
"core.hpp"
            CV_EXPORTS_W
int getNumberOfCPUs();
            CV_EXPORTS_W
const string& getBuildInformation();
   
       
"system.cpp"
           
namespace cv { const std::string& getBuildInformation() }
           
       
"parallel.cpp"
           
int cv::getNumberOfCPUs(void)


   
    Im using Android Crystax nightly build from Dec 9 and the current Android Studio 2.2.3
    (gradle-experimental:0.8.3) and opencv 2.4

    Any ideas would be greatly appreciated.   

Declan

unread,
Jan 17, 2017, 8:24:34 AM1/17/17
to crystax-ndk
The fact that the problem manifests itself for the function returning the std::string, but not the int  seems to suggests that this might be realted to
https://groups.google.com/forum/#!topic/crystax-ndk/ljvUOJtnTjY
ie both are std lib related
Reply all
Reply to author
Forward
0 new messages