• 3D Slicer 4.7.0 VS 2010 Compile 编译


    花了将近一周的时间的,终于在VS2010成功的编译了最新版的3D Slicer 4.7.0,感觉快要崩溃了。Slicer用了20多个外部的库,全都要一起编译,完整编译一次起码要七八个小时,光VS的Output输出窗口有十万多行,复制到txt中,文本内容居然有26MB之多,可怕!经过台式机和笔记本分别进行多次编译,出错,改错,再编译,再出错,再改错。。。总共编译了有二三十次,终于在台式机上成功了编译了Slicer,感觉眼泪都要掉下来了,下面整理下成功编译的心得,希望给他人开路,不要再像博主这样无数次尝试:

    1. 下载Slicer的最新代码 (https://github.com/Slicer/Slicer)

    2. 下载Qt 4.8.6 (https://download.qt.io/archive/qt/4.8/4.8.6/),博主编译的是32位的,所以这里下载的是x86-vs2010版本的

    3. 下载最新版的CMake 3.7.2, 注意这里一定要下载最新版本的,因为用老版本很可能会出错!

    4. Slicer的编译路径要尽可能的短,最好就放在某个盘的根目录,比如code放在 C:/Slicer,编译的文件放在C:/build。(血与泪的教训啊,如果路径名太长,会在编译的时候可能会找不到某些头文件)

    5. 在用Cmake配置的时候,取消 Unselect Slicer_USE_NUMPY, 因为编译这个很有可能会出错,而且一般情况下我们用不上,所以不用选。

    6. 然后就是在打开Slicer.sln后,选择Release模式,进行编译。

    下面是楼主在编译的过程中遇到的错误,以及改正方法:

    Error 1:

    44>C:SlicerlibsvtkitkitkMorphologicalContourInterpolator.hxx(150): error C2668: 'pow' : ambiguous call to overloaded function [C:uildSlicer-buildLibsvtkITKvtkITK.vcxproj]
    44>C:SlicerlibsvtkitkitkMorphologicalContourInterpolator.hxx(153): fatal error C1903: unable to recover from previous error(s); stopping compilation [C:uildSlicer-buildLibsvtkITKvtkITK.vcxproj]

    Change:

    m_MinAlignIters( pow( 2, TImage::ImageDimension ) ), // smaller of this and pixel count of the search image

    to:

    m_MinAlignIters( pow( 2, (double)TImage::ImageDimension ) ), // smaller of this and pixel count of the search image

    Change:

    m_MaxAlignIters( pow( 6, TImage::ImageDimension ) ), // bigger of this and root of pixel count of the search image

    to:

    m_MaxAlignIters( pow( 6, (double)TImage::ImageDimension ) ), // bigger of this and root of pixel count of the search image

    Error 2:

    4>........SlicerLibsvtkAddonvtkAddonMathUtilities.cxx(264): error C2668: 'sqrt' : ambiguous call to overloaded function [C:uildSlicer-buildLibsvtkAddonvtkAddon.vcxproj]
    44>            c:Program Files (x86)Microsoft Visual Studio 10.0VCincludemath.h(127): could be 'double sqrt(double)'
    44>            c:Program Files (x86)Microsoft Visual Studio 10.0VCincludemath.h(541): or       'float sqrt(float)'
    44>            c:Program Files (x86)Microsoft Visual Studio 10.0VCincludemath.h(589): or       'long double sqrt(long double)'
    44>            while trying to match the argument list '(unsigned __int64)'

    Change:

    int dimension = std::sqrt(elements.size()) + 0.5; // Since conversion to int just truncates

    to:

    int dimension = std::sqrt((double)elements.size()) + 0.5; // Since conversion to int just truncates

    Error 3:

    44>C:SlicerlibsvtkitkitkMorphologicalContourInterpolator.hxx(1284): error C2668: 'sqrt' : ambiguous call to overloaded function [C:uildSlicer-buildLibsvtkITKvtkITK.vcxproj]
    44>            c:Program Files (x86)Microsoft Visual Studio 10.0VCincludemath.h(589): could be 'long double sqrt(long double)'
    44>            c:Program Files (x86)Microsoft Visual Studio 10.0VCincludemath.h(541): or       'float sqrt(float)'
    44>            c:Program Files (x86)Microsoft Visual Studio 10.0VCincludemath.h(127): or       'double sqrt(double)'
    44>            while trying to match the argument list '(unsigned long)'
    44>            C:SlicerlibsvtkitkitkMorphologicalContourInterpolator.hxx(1243) : while compiling class template member function 'itk::Index<VIndexDimension> itk::MorphologicalContourInterpolator<TImage>::Align(itk::SmartPointer<TObjectType> &,long,itk::SmartPointer<TObjectType> &,const std::vector<_Ty> &)'

    Change:

    IdentifierType maxIter = std::max( m_MaxAlignIters, (IdentifierType)sqrt( searchRegion.GetNumberOfPixels() ) );

    to:

    IdentifierType maxIter = std::max( m_MaxAlignIters, (IdentifierType)sqrt( (double)searchRegion.GetNumberOfPixels() ) );

    Error 4:

    44>............SlicerLibsMRMLCoreTestingvtkMRMLSceneTest2.cxx(41): error C2039: 'back_inserter' : is not a member of 'std' [C:uildSlicer-buildLibsMRMLCoreTestingMRMLCoreCxxTests.vcxproj]
    44>............SlicerLibsMRMLCoreTestingvtkMRMLSceneTest2.cxx(41): error C3861: 'back_inserter': identifier not found [C:uildSlicer-buildLibsMRMLCoreTestingMRMLCoreCxxTests.vcxproj]

    Add:

    #include <iterator>

    Error 5:

    44>............SlicerModulesLoadableSegmentationsEditorEffectsqSlicerSegmentEditorScissorsEffect.cxx(389): error C2668: 'sqrt' : ambiguous call to overloaded function [C:uildSlicer-buildModulesLoadableSegmentationsEditorEffectsqSlicerSegmentationsEditorEffects.vcxproj]
    44>            c:Program Files (x86)Microsoft Visual Studio 10.0VCincludemath.h(589): could be 'long double sqrt(long double)'
    44>            c:Program Files (x86)Microsoft Visual Studio 10.0VCincludemath.h(541): or       'float sqrt(float)'
    44>            c:Program Files (x86)Microsoft Visual Studio 10.0VCincludemath.h(127): or       'double sqrt(double)'
    44>            while trying to match the argument list '(int)'

    Change:

    double radius = sqrt((eventPosition[0] - this->DragStartPosition[0])*(eventPosition[0] - this->DragStartPosition[0])
              + (eventPosition[1] - this->DragStartPosition[1])*(eventPosition[1] - this->DragStartPosition[1]));

    to:

    double radius = sqrt((double)(eventPosition[0] - this->DragStartPosition[0])*(eventPosition[0] - this->DragStartPosition[0])
              + (eventPosition[1] - this->DragStartPosition[1])*(eventPosition[1] - this->DragStartPosition[1]));

    Error 6:

    'ACPCTransformCLP.h': No such file or directory
    'AddScalarVolumesCLP.h': No such file or directory
    'BRAINSDWICleanupCLP.h': No such file or directory
    'BRAINSDemonWarpCLP.h': No such file or directory
    'BRAINSFitCLP.h': No such file or directory
    'BRAINSLabelStatsCLP.h': No such file or directory
    'BRAINSROIAutoCLP.h': No such file or directory
    'BRAINSResampleCLP.h': No such file or directory
    'BRAINSResizeCLP.h': No such file or directory
    'BRAINSStripRotationCLP.h': No such file or directory
    'BRAINSTransformConvertCLP.h': No such file or directory
    'BSplineToDeformationFieldCLP.h': No such file or directory
    'CLIModule4TestCLP.h': No such file or directory
    'CLIROITestCLP.h': No such file or directory
    'CastScalarVolumeCLP.h': No such file or directory
    'CheckerBoardFilterCLP.h': No such file or directory
    'CreateDICOMSeriesCLP.h': No such file or directory
    'CurvatureAnisotropicDiffusionCLP.h': No such file or directory
    'DWIConvertCLP.h': No such file or directory
    'DiffusionTensorTestCLP.h': No such file or directory
    'EMSegmentCommandLineCLP.h': No such file or directory
    'EMSegmentTransformToNewFormatCLP.h': No such file or directory
    'ExecutionModelTourCLP.h': No such file or directory
    'ExpertAutomatedRegistrationCLP.h': No such file or directory
    'ExtractSkeletonCLP.h': No such file or directory
    'FiducialRegistrationCLP.h': No such file or directory
    'GaussianBlurImageFilterCLP.h': No such file or directory
    'GradientAnisotropicDiffusionCLP.h': No such file or directory
    'GrayscaleFillHoleImageFilterCLP.h': No such file or directory
    'GrayscaleGrindPeakImageFilterCLP.h': No such file or directory
    'GrayscaleModelMakerCLP.h': No such file or directory
    'HistogramMatchingCLP.h': No such file or directory
    'ImageLabelCombineCLP.h': No such file or directory
    'IslandRemovalCLP.h': No such file or directory
    'LabelMapSmoothingCLP.h': No such file or directory
    'MaskScalarVolumeCLP.h': No such file or directory
    'MedianImageFilterCLP.h': No such file or directory
    'MergeModelsCLP.h': No such file or directory
    'ModelMakerCLP.h': No such file or directory
    'ModelToLabelMapCLP.h': No such file or directory
    'MultiplyScalarVolumesCLP.h': No such file or directory
    'N4ITKBiasFieldCorrectionCLP.h': No such file or directory
    'OrientScalarVolumeCLP.h': No such file or directory
    'OtsuThresholdImageFilterCLP.h': No such file or directory
    'PETStandardUptakeValueComputationCLP.h': No such file or directory
    'PerformMetricTestCLP.h': No such file or directory
    'ProbeVolumeWithModelCLP.h': No such file or directory
    'ResampleDTIVolumeCLP.h': No such file or directory
    'ResampleScalarVectorDWIVolumeCLP.h': No such file or directory
    'ResampleScalarVolumeCLP.h': No such file or directory
    'RobustStatisticsSegmenterCLP.h': No such file or directory
    'SimpleRegionGrowingSegmentationCLP.h': No such file or directory
    'SubtractScalarVolumesCLP.h': No such file or directory
    'TestGridTransformRegistrationCLP.h': No such file or directory
    'ThresholdScalarVolumeCLP.h': No such file or directory
    'VBRAINSDemonWarpCLP.h': No such file or directory
    'VotingBinaryHoleFillingImageFilterCLP.h': No such file or directory

    Solution:

    Make the path short for CMake! For example, put Slicer source code at C:/Slicer, put the build files at C:/build

    成功编译后得到如图所示的界面:

  • 相关阅读:
    top命令
    MySQL基准测试(三)--开源工具与实例演示
    MySQLdump之single-transaction详解
    牛刀小试MySQL--日志文件
    MySQL基准测试(二)--方法
    MySQL基准测试(一)--原因,策略,思路
    MySQL实验准备(二)--Python模拟数据(MySQL数据库)
    MySQL实验准备(一)--环境准备
    InnoDB存储引擎概览
    单机多实例mysq 8.0l部署安装
  • 原文地址:https://www.cnblogs.com/grandyang/p/6517661.html
Copyright © 2020-2023  润新知