언어 설정

Menu
Sites
Language
Statically linking OpenCV Libs

I am trying to statically integrate opencv libs in my tizen native application but the app is getting crashed while installing it on device. I don't know the whether the problem is with -- 1) Statically linking opencv libs or ,2) Opencv Libs are not proper.

 

Responses

15 댓글
Alex Dem

Нi,
Do you mean that : you have built static library from sources (IDE->Tizen Native project->Template ->Library->Static Library) succesfully for 'arm' configuration, linked static library with your Tizen project, but your Tizen Project crashes after deploy onto Tizen device?
Alexey.

Ankit Vijay

Hi Alex,

I have not built the static library from sources but have used the pre-built libraries located in Tizen repository (http://download.tizen.org/snapshots/tizen/ivi/latest/repos/arm/packages/armv7l/). And I followed the procedure given at the post https://developer.tizen.org/forums/native-application-development/static-library for linking the libraries statically.

After linking these lib, I was getting the following error:

/.../ServiceApp/lib/libopencv_calib3d.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
collect2: ld returned 1 exit status

To disable this error, I built the native project using "--allow-shlib-undefined" flag in linker options (properties->C/C++ Build->Settings->C++ Linker->Miscallaneous->other options).

Thanks.

colin Rao

f.y.i.

https://developer.tizen.org/forums/native-application-development/static-library

Ankit Vijay

Hi Alex,

I have not built the static library from sources but have used the pre-built libraries located in Tizen repository (http://download.tizen.org/snapshots/tizen/ivi/latest/repos/arm/packages/armv7l/). And I followed the procedure given at the post https://developer.tizen.org/forums/native-application-development/static-library for linking the libraries statically.

After linking these lib, I was getting the following error:

/.../ServiceApp/lib/libopencv_calib3d.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
collect2: ld returned 1 exit status

To disable this error, I built the native project using "--allow-shlib-undefined" flag in linker options (properties->C/C++ Build->Settings->C++ Linker->Miscallaneous->other options).

Thanks.

 

 

daniel kim

Hi,

According to below link, OpenCV doesn't support tizen officially. 

    http://opencv.org/platforms.html

And someone already tried to develop application with it. but failed to pulish it to AppStore. I think that this lib is for IVI profile in tizen. please refer to this link. 

   https://developer.tizen.org/forums/general-support/shared-libs-tizen-native-app?tab=active

Regards

TizenTom

Hi,

May be some misunderstanding from me but

Why you ask about static libs if you use shared ones (.so) ("/.../ServiceApp/lib/libopencv_calib3d.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20' collect2: ld returned 1 exit status")?

 

The reason of problem you have may be one of the following:

- you use opencv for ivi profile (but as I understand you need it for mobile);

- opencv static libs require other third-party libs (like glib, libjpeg, libpng, etc.);

 

Best wishes

 

Adil Malla

Hi TizenTom,

You mentioned two reasons for the problem. I checked the libraries are working on mobile phone. 

1. The opencv libraries i am using are for mobile. 

2. we are also using the pre-requisite libraries for opencv i.e. glib, libjpeg, libpng etc.

* when i tell you that libraries are working fine when we put the opencv libraries in the rooted phone and then install the app.
but we want to install the app with libraries.

Now the problems we are facing:

1. we have .so libraries can we make our executable to find the libs in opt/apps/"ourapp"/lib instead of using the usr/lib/ ?

2. Can we use .so files as they are shared libs, or do we need static libs (.a) ?

 

Regards,

 

Adil Hamid 

TizenTom

Hi Adil Hamid,

Regarding the first question you should put shared libs into project_root_dir/lib and they could  be deployed and used within your app (and you don't need to load lib methods via eina_module api as mentioned below). I have used successfully in both rooted and production devices. For root device you also could install opencv shared libs into device using rpm, and use them as platform libs. For production device it is forbidden.  Concerning the second question I think you should use either shared libs or static. So, the answer is you really do use only shared libs. Also I have used opencv as static libs in my project, but additionally it was required to add some third-party libs (libpng, libjpeg, libtiff). Thus, you can use static/shared libs from your project on rooted and product devices. Any special priviligies are required for that. Hope my tips help.

Best wishes

Adil Malla

Hi TizenTom,

Actually thing is i want to install the application with opencv libraries. Since i am targetting the production devices, i cannot install the opencv libraries using rpm, which you correctly mentioned we cannot do. Also i dont want to install the opencv libs seperately.

Now on rooted devices i am able to run my application, which packages all the shared libs in "opt/usr/apps/org.tizen.myapp/lib", and it successfully works. But when i am trying the same thing on production devices, it is failing.

 

Also as you mentioned i am using the third party libs like jpeg,tiff,png.

how to make it work on production devices. I am really stuck on this step. 

Thanks for helping. 

Regards, 

Adil Hamid

 

TizenTom

Hi,

"But when i am trying the same thing on production devices, it is failing." - it is fails with notification that app failed or you have white screen? I had white screen if I run my app in Debug mode. Actually, better run your app in Release mode. Otherwise I have any suggestions why it fails.

Best wishes

Adil Malla

Thanks TizenTom. I will check my app in Release mode. 
Regrading whether it is failing or white screen, so my app gets launched in debud mode but then stops.

Can i get the opencv libraries you are using.

 

Regards,

Adil Hamid Malla

TizenTom

I have built opencv (version 2.4.9) from https://review.tizen.org/gerrit from platform/upstream/opencv (branch tizen).

Also there is one possible issue with failing your app.  If it works with images from gallery it is required to add some priviligies in manifest file, e.g. for process images from gallery you should add <privilege>http://tizen.org/privilege/mediastorage</privilege>. 

Adil Malla

Hi, 

I am not using an image as of now, i am just defining a matrix with some values in my function and trying to do simple operation using the Mat.

Thanks & Regards

Adil Hamid

Alex Dem

Hi
just fyi: As I know if you want put some shared libraries (*.so) into your Tizen project and deploy it on phone: just put them inside IDE->yourProjectDir/lib folder
and after your app will be built & installed libraries should be here /opt/usr/apps/org.tizen.yourApp/lib/
but to get access to methods of library from your project code you should load them with eina_module api.
Alexey.

Adil Malla

Hi Alex,

I was successfull in deploying the opencv libraries on a rooted phone. I also checked the functionality of the libraries by using them in my application.

But, when i am trying to install the app in a market ready tizen phone, it is failing. What could be the possible issue? Do i need some special permission(privelege).


What i get from your reply is- the third party libraries are only accessible if we load them using the eina_module. Correct me if i am making any wrong assumption.

Will try loading them using the eina_module api, any headsup regarding the eina_module api will be appreciated.

 

Regards,

Adil Hamid Malla