CMake Error: Problem with archive_write_finish_entry(): Can't restore time

2.7k Views Asked by At

I am getting this problem when trying to cross compile OpenCV with VisualGDB following this tutorial https://visualgdb.com/tutorials/raspberry/opencv/build/

I also get the same error when typing tar -xf b624b995ec9c439cbc2e9e6ee940d3a2-v0.1.1f.zip from command line.

Where in CMakeList is it using the command tar.exe? Is it possible to replace it with something that does not error out like 7zip? Or can this be fixed by updating tar?

I have not been able to remove or replace tar.exe from C:\windows\System32 even as administrator

Is there a workaround to this problem?

Looking around online, tar does not even support zip files, why is it trying to unzip a zip file?

Thanks

Performing Test HAVE_CXX_WNO_ENUM_COMPARE_SWITCH
Performing Test HAVE_CXX_WNO_ENUM_COMPARE_SWITCH - Failed
Performing Test HAVE_CXX_WNO_SUGGEST_OVERRIDE
Performing Test HAVE_CXX_WNO_SUGGEST_OVERRIDE - Success
Performing Test HAVE_CXX_WNO_INCONSISTENT_MISSING_OVERRIDE
Performing Test HAVE_CXX_WNO_INCONSISTENT_MISSING_OVERRIDE - Failed
Performing Test HAVE_CXX_WNO_IMPLICIT_FALLTHROUGH
Performing Test HAVE_CXX_WNO_IMPLICIT_FALLTHROUGH - Success
Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS
Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS - Success
Performing Test HAVE_CXX_WNO_CLASS_MEMACCESS
Performing Test HAVE_CXX_WNO_CLASS_MEMACCESS - Success
ADE: Download: v0.1.1f.zip
CMake Error: Problem with archive_write_finish_entry(): Can't restore time
CMake Error: Problem extracting tar: E:/Projects/temp/OpenCV/opencv/.cache/ade/b624b995ec9c439cbc2e9e6ee940d3a2-v0.1.1f.zip
CMake Error at cmake/OpenCVDownload.cmake:240 (message):
  ADE: Unpack failed: 1
Call Stack (most recent call first):
  modules/gapi/cmake/DownloadADE.cmake:5 (ocv_download)
  modules/gapi/cmake/init.cmake:19 (include)
  cmake/OpenCVModule.cmake:312 (include)
  cmake/OpenCVModule.cmake:375 (_add_modules_1)
  modules/CMakeLists.txt:7 (ocv_glob_modules)

Configuring incomplete, errors occurred!
See also "E:/Projects/temp/OpenCV/opencv/VisualGDB/Debug/CMakeFiles/CMakeOutput.log".
See also "E:/Projects/temp/OpenCV/opencv/VisualGDB/Debug/CMakeFiles/CMakeError.log".
CMake Deprecation Warning:
  The 'cmake-server(7)' is deprecated.  Please port clients to use the
  'cmake-file-api(7)' instead.

Exception reported by CMake server: Configuration failed.
wh1+x: Exception reported by CMake server: Configuration failed.
   at wh1.c2[_InType,_OutType](_InType a)
   at g61.x(String[] a)
   at g61.l_2(Hello a)
   at wh1.m1()
1

There are 1 best solutions below

0
On
...
Performing Test HAVE_CXX_WNO_CLASS_MEMACCESS - Success
ADE: Download: v0.1.1f.zip
CMake Error: Problem with archive_write_finish_entry(): Can't restore time
CMake Error: Problem extracting tar: E:/Projects/opencv/.cache/ade/b624b995ec9c439cbc2e9e6ee940d3a2-v0.1.1f.zip
CMake Error at cmake/OpenCVDownload.cmake:240 (message):

I traced the problem to cmake\opencvdownload.cmake where on line 236

execute_process(COMMAND "${CMAKE_COMMAND}" -E tar xzf "${CACHE_CANDIDATE}" WORKING_DIRECTORY "${DL_DESTINATION_DIR}" RESULT_VARIABLE res)

Where if I run the same command line I get this error:

opencv\.cache\ade>cmake -E tar xzf b624b995ec9c439cbc2e9e6ee940d3a2-v0.1.1f.zip
CMake Error: Problem with archive_write_finish_entry(): Can't restore time
CMake Error: Problem extracting tar: b624b995ec9c439cbc2e9e6ee940d3a2-v0.1.1f.zip

Whereas if I replace it with 7zip, it works fine 7z x b624b995ec9c439cbc2e9e6ee940d3a2-v0.1.1f.zip

However, CMake won't allow me to execute a 7zip command from command line using "Cmake -E ..."

So the temporary solution until they either fix this in OpenCV or Cmake

Modify file cmake\opencvdownload.cmake on Line 236 change

execute_process(COMMAND "${CMAKE_COMMAND}" -E tar xzf "${CACHE_CANDIDATE}"

to

execute_process(COMMAND 7z x "${CACHE_CANDIDATE}"