LibArchive build errors

I’m trying to compile the most recent preview version of Slicer on Windows 10. In debug mode, the LibArchive project is failing with the errors below. Does anyone have an idea what might cause this? Release mode is building without these errors.

Error	C4061	enumerator 'WT_NONE' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_INFO' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_META' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_REQ' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_RVIS' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_CONV' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_CONT' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'LAST_WT' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_NONE' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_INFO' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_META' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_REQ' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_RVIS' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_CONV' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_CONT' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'LAST_WT' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'ENCRYPTION_NONE' in switch of enum 'encryption' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_write_set_format_zip.c	588	
Error	C4061	enumerator 'ENCRYPTION_NONE' in switch of enum 'encryption' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_write_set_format_zip.c	714	
Error	C4061	enumerator 'ENCRYPTION_NONE' in switch of enum 'encryption' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_write_set_format_zip.c	766	
Error	C4061	enumerator 'ENCRYPTION_NONE' in switch of enum 'encryption' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_write_set_format_zip.c	1033	
Error	C4061	enumerator 'COMPRESSION_UNSPECIFIED' in switch of enum 'compression' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_write_set_format_zip.c	1123	
Error	C4061	enumerator 'WT_NONE' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_INFO' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_META' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_REQ' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_RVIS' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_CONV' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_CONT' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'LAST_WT' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	344	
Error	C4061	enumerator 'WT_NONE' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_INFO' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_META' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_REQ' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_RVIS' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_CONV' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'WT_CONT' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'LAST_WT' in switch of enum 'warc_type_t' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_read_support_format_warc.c	368	
Error	C4061	enumerator 'ENCRYPTION_NONE' in switch of enum 'encryption' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_write_set_format_zip.c	588	
Error	C4061	enumerator 'ENCRYPTION_NONE' in switch of enum 'encryption' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_write_set_format_zip.c	714	
Error	C4061	enumerator 'ENCRYPTION_NONE' in switch of enum 'encryption' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_write_set_format_zip.c	766	
Error	C4061	enumerator 'ENCRYPTION_NONE' in switch of enum 'encryption' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_write_set_format_zip.c	1033	
Error	C4061	enumerator 'COMPRESSION_UNSPECIFIED' in switch of enum 'compression' is not explicitly handled by a case label [C:\Slicer_LMU\LibArchive-build\libarchive\archive_static.vcxproj]	LibArchive	C:\Slicer_LMU\LibArchive\libarchive\archive_write_set_format_zip.c	1123

I’ve rebuilt Slicer on Windows 10 from scratch in debug and release modes yesterday without any problem. Is it a completely clean build? Which Visual Studio build tool version and Qt version do you use?

Thanks @lassoan, it’s a clean build and I recently updated to VS 16 2019 and Qt 5.15.0

Did you use x64 v142 toolset version?

Yes, that’s correct.

What is the exact toolset version? There seems to be incompatibility between certain v142 toolset and libarchive versions (https://github.com/microsoft/vcpkg/issues/11481).

I am using the v14.27 toolset, which doesn’t appear in the thread, but I’ll keep looking.

Hi @smrolfe - looks like you’ve hit this issue: https://github.com/libarchive/libarchive/pull/1395

1 Like

i guess we haven’t migrated this to the Slicer fork of LibArchive. For my windoiws builds I pointed to the upstream LibArchive as a workaround.

Here was the initial fix in the slicer fork of LibArchive: https://github.com/Slicer/libarchive/pull/2

Since we fixed it upstream, now, I guess the right thing to do is go through the steps documented here: https://github.com/Slicer/libarchive. Does anyone have time to do that?

@pieper Currently the only commit in the branch we are using that isn’t in the upstream is the following slicer: Disable LHA support · Slicer/libarchive@92ad4c7 · GitHub. It mentions

“After we transition the Slicer build to a newer version macOS, we will be able to use the unmodified LibArchive sources”

Can we use a direct version of the upstream now since we have updated to use newer versions of macOS?

Good question - I’m not sure if we’re still using the older clang compiler on the macOS factory. it’s likely that the patch is out of date now. @jcfr or @Sam_Horvath?

Seems like that patch was originally committed in August 2017 so it is likely no longer needed, but we can wait on confirmation. I know we are using XCode 10.1, which has clang version 10.0.0, since it is the latest XCode version we can have on macOS 10.13.6

In case @smrolfe or anyone else needs to build on visual studio 2019 before we sort out the Slicer/LibArchive fork issue, here’s the workaround I use.

$ git diff
diff --git a/SuperBuild/External_LibArchive.cmake b/SuperBuild/External_LibArchive.cmake
index 2107ba9..02d8cdf 100644
--- a/SuperBuild/External_LibArchive.cmake
+++ b/SuperBuild/External_LibArchive.cmake
@@ -38,7 +38,8 @@ if((NOT DEFINED LibArchive_INCLUDE_DIR

   ExternalProject_SetIfNotDefined(
     Slicer_${proj}_GIT_REPOSITORY
-    "${EP_GIT_PROTOCOL}://github.com/Slicer/LibArchive.git"
+    # "${EP_GIT_PROTOCOL}://github.com/Slicer/LibArchive.git"
+    "${EP_GIT_PROTOCOL}://github.com/libarchive/LibArchive.git"
     QUIET
     )

@@ -46,7 +47,8 @@ if((NOT DEFINED LibArchive_INCLUDE_DIR
   # - disabling LHA (See #4407)
   ExternalProject_SetIfNotDefined(
     Slicer_${proj}_GIT_TAG
-    "92ad4c79e46805ce2dfbc46746e10d204108655e" # slicer-v3.4.0-2019-06-11-614110e7
+    # "92ad4c79e46805ce2dfbc46746e10d204108655e" # slicer-v3.4.0-2019-06-11-614110e7
+    "master"
     QUIET
     )

Could we just try to update to latest LibArchive and see if it builds fine on all platforms? I’ve submitted a pull request for this: https://github.com/Slicer/Slicer/pull/5170

Thanks @pieper, I will give this a try.

@smrolfe please try the pull request that I linked above (cherry pick the commit that updates libarchive version).

Thanks @lassoan I will try that now.

Thanks everyone for working on this :pray:

After checking that the updated LibArchive build on macOS and Linux, I integrated.

2 Likes

Did this resolve the issue for you? I’m receiving the same errors