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!
01-31-2019 03:40 AM - edited 01-31-2019 04:36 AM
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
02-04-2019 09:12 PM
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
01-31-2019 02:51 PM - edited 01-31-2019 03:00 PM
Hi
Does your sysroot(rootfs) have libopencv_core.so ?
The error message says gcc compiler can't find libopencv_*.so
01-31-2019 07:57 PM - edited 01-31-2019 08:26 PM
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.
01-31-2019 08:25 PM - edited 01-31-2019 08:30 PM
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
01-31-2019 08:30 PM
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
01-31-2019 08:57 PM - edited 01-31-2019 09:01 PM
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
02-02-2019 02:36 AM - edited 02-02-2019 02:40 AM
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.
02-02-2019 02:42 AM
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.
02-02-2019 03:00 AM - edited 02-02-2019 03:01 AM
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
02-04-2019 02:35 AM
Hi @1ymw1
Are you still facing this issue?
02-04-2019 09:00 AM
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.
02-04-2019 09:12 PM
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
02-04-2019 09:49 PM - edited 02-04-2019 09:50 PM
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
02-04-2019 10:00 PM
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.
02-04-2019 10:02 PM - edited 02-04-2019 10:04 PM
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
02-04-2019 10:06 PM
Hi @1ymw1
02-04-2019 10:07 PM
Hi @1ymw1
Which platform you are using?
02-04-2019 10:22 PM
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.
02-04-2019 10:24 PM
Hi @1ymw1
I am glad that it helped you.
02-04-2019 10:26 PM
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