cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Participant
Participant
2,042 Views
Registered: ‎04-06-2018

Unable to emulate CHaiDNN build

Hello,

 

When I try to emulate the CHaiDNN build using the QEMU emulator from SDSoC, I get the following error :

 

/mnt/CHaiDNN.elf: error while loading shared libraries: libopencv_core.so.3.1: cannot open shared object file: No such file or directory

 

I tried to compile with the "-sdcard" option, in order to add the library directories inside the SD_Card image, but it doesn't work.

 

Does someone have an idea about how to fix this ?

 

Thank you.

0 Kudos
7 Replies
Highlighted
1,925 Views
Registered: ‎11-30-2016

I have similar problem. But different error:

Capture.PNG
0 Kudos
Highlighted
Contributor
Contributor
1,908 Views
Registered: ‎04-03-2018

Hi, 

 

In the debug configuration, you can define LD_LIBRARY_PATH and set the value as <PATH_TO> opencv_arm64/lib: <PATH_TO>protobuf_arm64/lib (if you have it on mnt then it is something like /mnt/opencv_arm64/lib:/mnt/protobuf_arm64/lib).

 

I hope it solves your issue.

--Ness

0 Kudos
Highlighted
1,892 Views
Registered: ‎11-30-2016

Hi,

Unfortunately, it doesn't work for me. 

mnt/ dosen't have any library files. lib/ has no what I have added opencv library either. 

 I had "define LD_LIBRARY_PATH" in "debug configuration" as below. Is it correct? 

Capture.PNG

thanks,

-Lily

0 Kudos
Highlighted
1,864 Views
Registered: ‎11-30-2016

I know how to mount library by using your method on hardware test.
What I don't know is how to do it on emulation. Since there is no opencv_arm64 folder appeared in qemu.
Thanks,
Lily
0 Kudos
Highlighted
Contributor
Contributor
1,813 Views
Registered: ‎05-27-2008

I am an Avnet FAE supporting Xilinx.  I have another customer that has run into the same problem with emulation of CHaiDNN.

 

If someone has a resolution or workaround, please post!

 

Thanks -

jd
Tags (2)
0 Kudos
Highlighted
Contributor
Contributor
1,797 Views
Registered: ‎04-03-2018

Hi Lily,

 

you can ssh to your local machine from qemu and scp the libraries in the /mnt folder.

 

Ness

0 Kudos
Highlighted
Newbie
Newbie
1,777 Views
Registered: ‎05-03-2018

Ping locked up for me.

 

This might not be for you but this is how I fixed my library emulation problem:

  1. put your SD_Card folder into your project, I used the src folder where the design and software folders are
  2. Open /opt/Xilinx/SDx/2017.4/bin/sdsoc_emulator.tcl as sudo
  3. Add the following functions (taken from scripts/sdsoc/sdsoc_file.tcl):

######################################################################
# funtions from ::sdsoc:file  can't see there from here ?

# delete a file (force), return 0 if successful
proc deleteFileForce { myfile } {
  set status [catch {file delete -force $myfile} result] 
  return $status
}

# return a list of files in a directory
proc getDirectoryFiles { dir } {
  set fileList {}
  foreach fileName [glob -nocomplain -type f -directory $dir *] {
    lappend fileList $fileName
  }
  foreach dirName [glob -nocomplain -type d -directory $dir *] {
    set subDirList [getDirectoryFiles $dirName]
    foreach subDirFile $subDirList {
      lappend fileList $subDirFile
    }
  }
  return $fileList
}

# copy a file to destination (force), return 0 if successful
proc copyFileForce { source dest } {
  set status [catch {file copy -force $source $dest} result]
  return $status
}

# copy source to target file if different
proc copyFileIfDifferent { source target } {
  if {[file exists $target]} {
    set status [catch {exec diff $source $target} result]
    if {$status == 0} {
      return
    }
  }
  deleteFileForce $target
  file mkdir [file dirname $target]
  copyFileForce $source $target
}

# copy source to target directory if different
proc copyDirectoryIfDifferent { source_dir target_dir } {
  # ::sdsoc::file::getDirectoryFiles builds a list of all files in the source_dir
  # hierarchy by recursively traversing the directory structure
  set files [getDirectoryFiles $source_dir]
  foreach source_file $files {
    regsub $source_dir $source_file $target_dir target_file
    copyFileIfDifferent $source_file $target_file
  }
}

 

4. locate (somewhere around line 617; before the above code added)

 

######################################################################
# SD card image

 

if {![info exists nobuild]} {
  set save_dir [pwd]
  cd [file join [pwd] _sds emulation]
  if {[file exists sd_card]} {
    delete_directory sd_card
  }
  if {[file exists sd_card.img]} {
    delete_file sd_card.img
  }
  file mkdir sd_card

 

5. Add (note the hard coded source directories) (the output is <project>/Debug/_sds/emulation/sd_card)

  set base_sd "../../../src/SD_Card/models"
  set new_dir [file join "sd_card" "models" ]
  file mkdir $new_dir
  copyDirectoryIfDifferent $base_sd $new_dir

  set base_sd "../../../src/SD_Card/lib"
  set new_dir [file join "sd_card" "lib" ]
  file mkdir $new_dir
  copyDirectoryIfDifferent $base_sd $new_dir

  set base_sd "../../../src/SD_Card/opencv_arm64"
  set new_dir [file join "sd_card" "opencv_arm64" ]
  file mkdir $new_dir
  copyDirectoryIfDifferent $base_sd $new_dir
 
  set base_sd "../../../src/SD_Card/protobuf_arm64"
  set new_dir [file join "sd_card" "protobuf_arm64" ]
  file mkdir $new_dir
  copyDirectoryIfDifferent $base_sd $new_dir

 

Good luck

0 Kudos