UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
1,191 Views
Registered: ‎09-25-2018

sdsoc opencv configuration

Jump to solution

hi,

I have my own rootfs generated from petalinux, and it includes the opencv, I am trying to develop my vision algorithm based on this opencv in sdsoc, BUT I am getting error about linking opencv with sdsoc. If I use CHaiDNN opencv from here, everything works without any problem. and I have tried to use existing opencv in sdk but I face to the same problem.please help

44.png33.png22.png11.png

 

 

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
927 Views
Registered: ‎08-20-2018

Re: sdsoc opencv configuration

Jump to solution

Hi @1ymw1

Please try below option,

Navigate to C/C++ build settings->C/C++ Build-> Settings->SDS++ Linker->Miscellaneous->Linker Flags

Add below line, (If there are other flags already present, please retain)

--sysroot=${SYSROOT} -L=/lib -L=/usr/lib -Wl,-rpath-link=${SYSROOT}/lib,-rpath-link=${SYSROOT}/usr/lib

 

Best Regards,
Nutan
-------------------------------------------------------------------------------
Please don't forget to reply, kudo and accept as a solution
19 Replies
Explorer
Explorer
1,155 Views
Registered: ‎10-21-2015

Re: sdsoc opencv configuration

Jump to solution

Hi

Does your sysroot(rootfs) have libopencv_core.so ?

The error message says gcc compiler can't find libopencv_*.so 

Adventurer
Adventurer
1,138 Views
Registered: ‎09-25-2018

Re: sdsoc opencv configuration

Jump to solution

hi @hokim,

I generated petalinux rootfs in ubuntu machine and sdsoc is installed in windows machine, as far as I know, if I give the complete link for  /usr/lib and /usr/include it is not a problem, right?. if it is not enough can you tell me how to include opencv link to SYSROOT in windows machine, ?

thank you very much for reply.

0 Kudos
Explorer
Explorer
1,132 Views
Registered: ‎10-21-2015

Re: sdsoc opencv configuration

Jump to solution

Hi

I mean you should check filelist in your sysroot directory like this

$ find sysroot -name 'libopencv_core.so*'
sysroot/usr/lib/libopencv_core.so
sysroot/usr/lib/libopencv_core.so.3.3 sysroot/usr/lib/libopencv_core.so.3.3.0

Can you see libopencv_core.so ?

If you can't see it , you should check whether your petalinux image recipe includes packagegroup-petalinux-opencv-dev

Image recipe needs *-dev for *.so files

Adventurer
Adventurer
1,126 Views
Registered: ‎09-25-2018

Re: sdsoc opencv configuration

Jump to solution

Dear @hokim,

yes, I have double checked everytime whether evey *.so files are in the petalinux rootfs  /usr/bin and also *.hpp files in /usr/include .

thanks

0 Kudos
Explorer
Explorer
1,106 Views
Registered: ‎10-21-2015

Re: sdsoc opencv configuration

Jump to solution

I mean libopencv_core.so not libopencv_core.so.3*

Even though libopencv_core.so is actually symbolic link to libopencv_core.so.3.3,

gcc compiler require libopencv_core.so not libopencv_core.so.3* for build

If your rootfs has *.so file, I don't understand why such error message happended 

At last, could you build your project on linux system?

Windows system might not treat linux symbolic link properly 

Adventurer
Adventurer
966 Views
Registered: ‎09-25-2018

Re: sdsoc opencv configuration

Jump to solution

hi @hokim

you are correct, this problem is regarding the *.so files, in the windows *.so files do not linked with *.so.3.3 and *.so.3.3.0 properly. you can see in the images the *.so files and *.so.3.3 files have very less size when they are in windows computer, but these files show big size when they are in linux computer, I think they are not properly linked with each other, so what I did is I convert all the *.so.3.3.0 files into *.so.3.3 and *.so files by renaming *.so.3.3.0 files, in this way I was able to builld my project in sdsoc without any problem, do you think it is a good practise? I get these files from unpacking rootfs.tar.gz in linux computer into pen driver and use these files in sdsoc in windows machine.Screenshot from 2019-02-02 05-06-29.png

 

asssss.png
0 Kudos
Adventurer
Adventurer
977 Views
Registered: ‎09-25-2018

Re: sdsoc opencv configuration

Jump to solution

hi @hokim

you are correct, this problem is regarding the *.so files, in the windows *.so files do not linked with *.so.3.3 and *.so.3.3.0 properly. you can see in the images the *.so files and *.so.3.3 files have very less size when they are in windows computer, but these files show big size when they are in linux computer, I think they are not properly linked with each other, so what I did is I convert all the *.so.3.3.0 files into *.so.3.3 and *.so files by renaming *.so.3.3.0 files, in this way I was able to builld my project in sdsoc without any problem, do you think it is a good practise? I get these files from unpacking rootfs.tar.gz in linux computer into pen driver and use these files in sdsoc in windows machine.

Screenshot from 2019-02-02 05-06-29.pngasssss.png

0 Kudos
Explorer
Explorer
1,036 Views
Registered: ‎10-21-2015

Re: sdsoc opencv configuration

Jump to solution

This is how to solve linux symbolic link on  Windows

$ mkdir tmp
$ cd tmp
$ tar xvzf ../rootfs.tar.gz
$ zip -r ../rootfs.zip .

linux zip command replace  symbolic link with linked file 

Use rootfs.zip in Windows

Xilinx Employee
Xilinx Employee
966 Views
Registered: ‎08-20-2018

Re: sdsoc opencv configuration

Jump to solution

Hi @1ymw1

Are you still facing this issue?

Best Regards,
Nutan
-------------------------------------------------------------------------------
Please don't forget to reply, kudo and accept as a solution
Adventurer
Adventurer
947 Views
Registered: ‎09-25-2018

Re: sdsoc opencv configuration

Jump to solution

Dear @hokim , @nutang,

I am sorry about the late responce, using zip format in windows solved the problem in great degree. but there are few poor *.so files which could not to find the linked files because they were in another directory, for example, in my case,  in the libpthread.so, have statements as follow,

/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a )

as you can notice here the linked files of libpthread.so are in the rootfs/lib and rootfs/usr/lib but libpthread_nonshared.a was already in the rootfs/usr/lib, so what I did is copied the libpthread.so file from rootfs/lib to rootfs/usr/lib and change the statement "GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a )" to this "GROUP ( libpthread.so.0 libpthread_nonshared.a )"

And I did the same thing to the libc.so as follow

"GROUP (/lib/libc.so.6    /usr/libc_nonshared.a  AS_NEEDED ( /lib/ld-linux-armhf.so.3) )" to

"GROUP (libc.so.6    libc_nonshared.a  AS_NEEDED ( ld-linux-armhf.so.3) )"

and I copied te libc.so.6 and ld-linux-armhf.so.3 from /rootfs/lib to rootfs/usr/lib

in this way I was able to compile my code sucessfully. But I need to know that is this the correct way to do this? will this cause to future problem??? I am going to develop my whole algorithm on sdsoc,so I need to verify that I have done everything in correct way.

and Dear @hokim you have been very kind to me. you have tried to give me a solution for many cases, thank you. thank you so much.

0 Kudos
Xilinx Employee
Xilinx Employee
928 Views
Registered: ‎08-20-2018

Re: sdsoc opencv configuration

Jump to solution

Hi @1ymw1

Please try below option,

Navigate to C/C++ build settings->C/C++ Build-> Settings->SDS++ Linker->Miscellaneous->Linker Flags

Add below line, (If there are other flags already present, please retain)

--sysroot=${SYSROOT} -L=/lib -L=/usr/lib -Wl,-rpath-link=${SYSROOT}/lib,-rpath-link=${SYSROOT}/usr/lib

 

Best Regards,
Nutan
-------------------------------------------------------------------------------
Please don't forget to reply, kudo and accept as a solution
Adventurer
Adventurer
918 Views
Registered: ‎09-25-2018

Re: sdsoc opencv configuration

Jump to solution

hi @nutang

I re-extract my rootfs.zip and tried your script for linker flag, but it didnt work, I am using sdsoc(2018.2) in windows computer and I generated rootfs.zip in linux computer, compiler says,

cannot find /lib/libpthread.so.0

cannot find usr//lib/libppthread_nonshared.a

please read this thread from beggining. thanks

 

0 Kudos
Xilinx Employee
Xilinx Employee
911 Views
Registered: ‎08-20-2018

Re: sdsoc opencv configuration

Jump to solution

hi @1ymw1

This is the correct way to link the pthread library in run time, I have tested it multiple times.

If you have set $SYSROOT properly, 

clean and build again. 

 

Best Regards,
Nutan
-------------------------------------------------------------------------------
Please don't forget to reply, kudo and accept as a solution
Adventurer
Adventurer
909 Views
Registered: ‎09-25-2018

Re: sdsoc opencv configuration

Jump to solution

hi @nutang

can you please tell me how to set $SYSROOT in sdsoc in windows machine? ussually I give the complete path to the rootfs folder. example:

c:/rootfs/lib

c:rootfs/usr/lib

thanks

0 Kudos
Xilinx Employee
Xilinx Employee
905 Views
Registered: ‎08-20-2018

Re: sdsoc opencv configuration

Jump to solution

Hi @1ymw1

  • Windows: Go to Start  Control Panel  System  Advanced  Environment Variables. Create an environment variable SYSROOT with the value <platform>/sw/a53_linux/a53_linux/sysroot/aarch64-xilinx-linux/.
Best Regards,
Nutan
-------------------------------------------------------------------------------
Please don't forget to reply, kudo and accept as a solution
Xilinx Employee
Xilinx Employee
903 Views
Registered: ‎08-20-2018

Re: sdsoc opencv configuration

Jump to solution

Hi @1ymw1

Which platform you are using?

Best Regards,
Nutan
-------------------------------------------------------------------------------
Please don't forget to reply, kudo and accept as a solution
0 Kudos
Adventurer
Adventurer
893 Views
Registered: ‎09-25-2018

Re: sdsoc opencv configuration

Jump to solution

hi @nutang

wow, it works...... needed to restart the software. no need to change the content in any of the *.so files. thank you so much.

0 Kudos
Xilinx Employee
Xilinx Employee
891 Views
Registered: ‎08-20-2018

Re: sdsoc opencv configuration

Jump to solution

Hi @1ymw1

I am glad that it helped you.

Best Regards,
Nutan
-------------------------------------------------------------------------------
Please don't forget to reply, kudo and accept as a solution
Adventurer
Adventurer
889 Views
Registered: ‎09-25-2018

Re: sdsoc opencv configuration

Jump to solution

hi @nutang

I am using zedboard, with my own rootfs generated in petalinux with opencv. I added variable name with SYSROOT and c:\rootfs

thanks again for the concern

0 Kudos