3dtof / voxelsdk

VoxelSDK - an SDK supporting TI's 3D Time of Flight cameras
BSD 3-Clause "New" or "Revised" License
108 stars 71 forks source link

DepthCameraLibrary::getABIVersion() returns incorrect value #168

Open abrdej opened 5 years ago

abrdej commented 5 years ago

Hi, I've built SDK from sources and I've got Ignoring Voxel library warnings caused by ABI versions mismatch. It looks like there is an error in DepthCameraLibrary::getABIVersion() method part for LINUX. A proper solution could be something like:

--- a/Voxel/DepthCameraLibrary.cpp
+++ b/Voxel/DepthCameraLibrary.cpp
@@ -190,12 +190,20 @@ int DepthCameraLibrary::getABIVersion()

   ELFIO::dynamic_section_accessor d(reader, dynamicSection);

-  ELFIO::Elf_Xword tag = DT_SONAME, value;
+  ELFIO::Elf_Xword tag, value;

   String soName;
-    
-  if(!d.get_entry(0, tag, value, soName))
-  {
+  bool hasSoname = false;  
+
+  for(int i = 0; i < d.get_entries_num(); i++) {
+
+    if (d.get_entry(i, tag, value, soName) && tag == DT_SONAME)
+    {
+      hasSoname = true;
+      break;
+    }
+  }
+  if (!hasSoname) {
     logger(LOG_DEBUG) << "DepthCameraLibrary: Could not find SONAME in " << _libName << std::endl;
     return 0;
   }