# Multiple errors about SimpleITK, LibArchive, python when I build Slicer

**URL:** <https://discourse.slicer.org/t/multiple-errors-about-simpleitk-libarchive-python-when-i-build-slicer/17457>\
**Category:** Development\
**Tags:** build, python\
**Created:** [May 4, 2021, 8:55pm UTC](https://discourse.slicer.org/t/multiple-errors-about-simpleitk-libarchive-python-when-i-build-slicer/17457 "2021-05-04T20:55:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![moonchi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/moonchi/32/10784_2.png) [@moonchi](https://discourse.slicer.org/u/moonchi)\
**Post date:** [May 4, 2021, 8:55pm UTC](https://discourse.slicer.org/t/multiple-errors-about-simpleitk-libarchive-python-when-i-build-slicer/17457/1 "2021-05-04T20:55:54Z")

</div>

I used  
CMAKE 3.19.8  
Visual Studio 2019 x64 tool v142  
And refer to

> [@Building CLI Extension copies to wrong output directories (cmake issue)](https://discourse.slicer.org/t/building-cli-extension-copies-to-wrong-output-directories-cmake-issue/1024):
>
> I hope I might find some help here. I recently started working on the PkModeling extension an I am trying to get it to build on various continuous integration platforms (Appveyor for Win and Travis CI for Linux and Mac). [https://github.com/michaelschwier/PkModeling/tree/CI](https://github.com/michaelschwier/PkModeling/tree/CI) I got the build working on Appveyor but it copies some of the generated files to the wrong output. So the expected output would be “[pkmodeling-build]/bin/Release” (expected files there are: PkModeling.exe, PkModelingLib.dll…

I first installed and compiled  
ITK DCMTK SlicerExecutionModel ZLIB  
And join them in CMAKE-GUI  
The following is my CMAKE interface

 ![20210505CMAKE1](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/0/e0d1ec50177b8c1077e853480f80ed86e30056ef.png)  
 ![20210505CMAKE2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/a/aa280ee81f8c5652f1cd982ae83425cf871d92fa.png)  
 ![20210505CMAKE3](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/4/f43b25cd3ab84f379664bef8aa382f60f78bd14a.png)  
I used the Release mode to build  
Then here is my error list  
[errorlist-Release](https://drive.google.com/file/d/1tK6oYtSseKDhCYNAM-koLDZsOAcAd8_U/view?usp=sharing)  
[errorlog-Release](https://drive.google.com/file/d/1u_3nxnkU3-96-UK47vJ-g9H63gUOGML3/view?usp=sharing)  
I want to know what I should do to successfully build Slicer  
Thank you for your patience to read this

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [May 4, 2021, 11:21pm UTC](https://discourse.slicer.org/t/multiple-errors-about-simpleitk-libarchive-python-when-i-build-slicer/17457/2 "2021-05-04T23:21:02Z")

</div>

You previously posted on the following thread. Did the solution provided there solve the issue?

> [@Build Slicer failed on win10](https://discourse.slicer.org/t/build-slicer-failed-on-win10/15674/6):
>
> Probably the issue is that your system code page is set to 950 (Traditional Chinese) and c:\S4R\LibArchive\libarchive\archive\_read\_support\_format\_rar5.c contains characters that cannot be interpreted in this code page. The simplest is to remove the offending characters (remove entire line 74, it is just a comment): \* "Rar!→•☺·\x00" If you will keep running into similar errors then you may consider switching to Latin1 code page for the build.

I do see in one of the logs you posted that it warns the following:

> warning C4819: The file contains a character that cannot be represented in the current code page (950)

---

<div class="post-metadata">

**Author:** ![moonchi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/moonchi/32/10784_2.png) [@moonchi](https://discourse.slicer.org/u/moonchi)\
**Post date:** [May 4, 2021, 11:56pm UTC](https://discourse.slicer.org/t/multiple-errors-about-simpleitk-libarchive-python-when-i-build-slicer/17457/3 "2021-05-04T23:56:38Z")

</div>

Sorry this is my fault. I emptied the old folder before this construction, which caused the same error to reappear. I have fixed it, thank you  
This is the file I rebuilt, and the error is reduced to 9  
Below is the new list  
[errorlist-Release](https://drive.google.com/file/d/1jK9qMOc32kfXCP8VOraWFBdbWam2iHSG/view?usp=sharing)  
[errorlog-Release](https://drive.google.com/file/d/1nvKUOFiUDm9kjYgoKuq-m1jeJAkOEAHH/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 7, 2021, 1:41pm UTC](https://discourse.slicer.org/t/multiple-errors-about-simpleitk-libarchive-python-when-i-build-slicer/17457/4 "2021-05-07T13:41:51Z")

</div>

Most probably you have run into this issue:

> <https://github.com/Slicer/Slicer/issues/5498>
>
> When building latest master version on Windows, using Visual Studio, in debug mo…de, then build fails with this error:
> 
> \`\`\`
> -- Detecting CXX compiler ABI info - done
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
> Could NOT find Python3 (missing: Python3\_EXECUTABLE Interpreter) (found
> suitable version "3.7", minimum required is "3.6")
> Call Stack (most recent call first):
> C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (\_FPHSA\_FAILURE\_MESSAGE)
> C:/D/S4D/VTK-build/lib/cmake/vtk-9.0/patches/3.18/FindPython/Support.cmake:2578 (find\_package\_handle\_standard\_args)
> C:/D/S4D/VTK-build/lib/cmake/vtk-9.0/patches/3.18/FindPython3.cmake:348 (include)
> C:/D/S4D/VTK-build/lib/cmake/vtk-9.0/VTK-vtk-module-find-packages.cmake:303 (find\_package)
> C:/D/S4D/VTK-build/lib/cmake/vtk-9.0/vtk-config.cmake:138 (include)
> C:/D/S4D/VTK-build/vtk-config.cmake:1 (include)
> C:/D/S4D/ITK-build/lib/cmake/ITK-5.1/Modules/ITKVtkGlue.cmake:30 (find\_package)
> C:/D/S4D/ITK/CMake/ITKModuleAPI.cmake:76 (include)
> C:/D/S4D/ITK/CMake/ITKModuleAPI.cmake:31 (itk\_module\_load)
> C:/D/S4D/ITK/CMake/ITKModuleAPI.cmake:129 (\_itk\_module\_config\_recurse)
> C:/D/S4D/ITK-build/ITKConfig.cmake:77 (itk\_module\_config)
> SuperBuild.cmake:386 (find\_package)
> CMakeLists.txt:38 (include)
> 
> 
> -- Configuring incomplete, errors occurred!
> See also "C:/D/S4D/SimpleITK-build/CMakeFiles/CMakeOutput.log".
> See also "C:/D/S4D/SimpleITK-build/CMakeFiles/CMakeError.log".
> C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Microsoft\\VC\\v160\\Microsoft.CppCommon.targets(238
> ,5): error MSB8066: Custom build for 'C:\\D\\S4D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleITK-mkdir.rule;C:\\D\\S4
> D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleITK-download.rule;C:\\D\\S4D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde629
> 1e1\\SimpleITK-update.rule;C:\\D\\S4D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleITK-patch.rule;C:\\D\\S4D\\CMakeFiles
> \\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleITK-configure.rule;C:\\D\\S4D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleI
> TK-build.rule;C:\\D\\S4D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleITK-install.rule;C:\\D\\S4D\\CMakeFiles\\55773c0e5
> 810be009a8f38bd18c05739\\SimpleITK-complete.rule;C:\\D\\S4D\\CMakeFiles\\f5993a3ec64cf58c5707908b20f354e5\\SimpleITK.rule;C:\\
> D\\S4\\CMakeLists.txt' exited with code 1. \[C:\\D\\S4D\\SimpleITK.vcxproj\]
> \`\`\`
> 
> I don't know if it is related, but SimpleITK CMake cache (c:\\D\\S4D\\SimpleITK-build\\CMakeCache.txt) picks up pieces of anaconda, which is strange because my environment variables are clean (there is absolutely no mention of anaconda or python in any of the variables):
> 
> \`\`\`
> //Path to a program.
> \_Python3\_CONFIG:INTERNAL=\_Python3\_CONFIG-NOTFOUND
> \_Python3\_DEVELOPMENT\_EMBED\_SIGNATURE:INTERNAL=0993e8f7af6d2f88f03f3f71fd289925
> \_Python3\_DEVELOPMENT\_MODULE\_SIGNATURE:INTERNAL=0993e8f7af6d2f88f03f3f71fd289925
> //Path to a program.
> \_Python3\_EXECUTABLE:INTERNAL=\_Python3\_EXECUTABLE-NOTFOUND
> //Path to a file.
> \_Python3\_INCLUDE\_DIR:INTERNAL=C:/Users/andra/anaconda3/include
> //Path to a library.
> \_Python3\_LIBRARY\_DEBUG:INTERNAL=\_Python3\_LIBRARY\_DEBUG-NOTFOUND
> //Path to a library.
> \_Python3\_LIBRARY\_RELEASE:INTERNAL=C:/Users/andra/anaconda3/libs/python37.lib
> //Path to a library.
> \_Python3\_RUNTIME\_LIBRARY\_RELEASE:INTERNAL=C:/Users/andra/anaconda3/python37.dll
> //Result of TRY\_COMPILE
> project\_compiles:INTERNAL=FALSE
> \`\`\`
> 
> You can find the full logs here: https://1drv.ms/u/s!Arm\_AFxB9yqHxaN2aILYudYPjN5xdA?e=Fhpgcf

A workaround is to temporarily rename your other Python installation folder (anaconda, etc.). You can rename it back to the original name after Slicer build is complete.

---

<div class="post-metadata">

**Author:** ![moonchi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/moonchi/32/10784_2.png) [@moonchi](https://discourse.slicer.org/u/moonchi)\
**Post date:** [May 8, 2021, 12:36pm UTC](https://discourse.slicer.org/t/multiple-errors-about-simpleitk-libarchive-python-when-i-build-slicer/17457/5 "2021-05-08T12:36:55Z")

</div>

I tried the method you recommended, and successfully built the Release and Debug of Slicer. Thank you for your answers!
