microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
13.7k stars 2.78k forks source link

TensorRT Windows build failed #5145

Closed xkszltl closed 3 years ago

xkszltl commented 3 years ago

Describe the bug

We got a lot of header-not-found errors when building with TensorRT on Windows. It works fine with just CUDA.

Here's the cmake arg for successful build: https://github.com/xkszltl/Roaster/blob/ca52bfccd4c49b2bcbe9526e2f0473ea810a5f48/win/pkgs/ort.ps1#L150-L190 It'll fail if I set -Donnxruntime_USE_TENSORRT=ON.

Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Checking File Globs
  Performing update step for 'project_dnnl'
  No patch step for 'project_dnnl'
  Performing configure step for 'project_dnnl'
  -- GPU support is disabled
  -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
  -- Configuring done
  -- Generating done
  -- Build files have been written to: D:/roaster-scratch/onnxruntime/build/dnnl/src/project_dnnl-build
  Performing build step for 'project_dnnl'
  Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework
  Copyright (C) Microsoft Corporation. All rights reserved.

    Checking Build System
    dnnl_common.vcxproj -> D:\roaster-scratch\onnxruntime\build\dnnl\src\project_dnnl-build\src\common\dnnl_common.dir\Release\dnnl_common.lib
    dnnl_cpu.vcxproj -> D:\roaster-scratch\onnxruntime\build\dnnl\src\project_dnnl-build\src\cpu\dnnl_cpu.dir\Release\dnnl_cpu.lib
    dnnl.vcxproj -> D:\roaster-scratch\onnxruntime\build\dnnl\src\project_dnnl-build\src\Release\dnnl.dll
    Building Custom Rule D:/roaster-scratch/onnxruntime/build/dnnl/src/dnnl/src/CMakeLists.txt
  Performing install step for 'project_dnnl'
  Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework
  Copyright (C) Microsoft Corporation. All rights reserved.

    dnnl_common.vcxproj -> D:\roaster-scratch\onnxruntime\build\dnnl\src\project_dnnl-build\src\common\dnnl_common.dir\Release\dnnl_common.lib
    dnnl_cpu.vcxproj -> D:\roaster-scratch\onnxruntime\build\dnnl\src\project_dnnl-build\src\cpu\dnnl_cpu.dir\Release\dnnl_cpu.lib
    dnnl.vcxproj -> D:\roaster-scratch\onnxruntime\build\dnnl\src\project_dnnl-build\src\Release\dnnl.dll
    -- Install configuration: "Release"
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/share/doc/dnnl/LICENSE
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/lib/dnnl.lib
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/bin/dnnl.dll
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/dnnl.h
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/dnnl.hpp
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/dnnl_debug.h
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/dnnl_types.h
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/mkldnn.h
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/mkldnn.hpp
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/mkldnn_config.h
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/mkldnn_debug.h
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/mkldnn_dnnl_mangling.h
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/mkldnn_types.h
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/mkldnn_version.h
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/dnnl_config.h
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/include/dnnl_version.h
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/lib/cmake/dnnl/dnnl-config.cmake
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/lib/cmake/dnnl/dnnl-config-version.cmake
    -- Up-to-date: D:/roaster-scratch/onnxruntime/build/dnnl/install/lib/cmake/dnnl/dnnl-targets.cmake
    -- Installing: D:/roaster-scratch/onnxruntime/build/dnnl/install/lib/cmake/dnnl/dnnl-targets-release.cmake
    -- Installing: D:/roaster-scratch/onnxruntime/build/dnnl/install/lib/mkldnn.lib
  Completed 'project_dnnl'
  Performing update step for 'pybind11'
  No patch step for 'pybind11'
  No configure step for 'pybind11'
  No build step for 'pybind11'
  No install step for 'pybind11'
  Completed 'pybind11'
  libprotobuf.vcxproj -> D:\roaster-scratch\onnxruntime\build\external\protobuf\cmake\Release\libprotobuf.lib
  libprotoc.vcxproj -> D:\roaster-scratch\onnxruntime\build\external\protobuf\cmake\Release\libprotoc.lib
  protoc.vcxproj -> D:\roaster-scratch\onnxruntime\build\external\protobuf\cmake\Release\protoc.exe
  onnx_proto.vcxproj -> D:\roaster-scratch\onnxruntime\build\onnx\Release\onnx_proto.lib
  NvOnnxParser.cpp
  ModelImporter.cpp
  builtin_op_importers.cpp
  onnx2trt_utils.cpp
  ShapedWeights.cpp
  ShapeTensor.cpp
  OnnxAttrs.cpp
D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\NvOnnxParser.h(26,10): fatal error C1083: Cannot open include file: 'NvInfer.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\NvOnnxParser.cpp) [D:\roaster-scratch\onnxruntime\build\external\onnx-tensorrt\nvonnxparser_static.vcxproj]
D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\NvOnnxParser.h(26,10): fatal error C1083: Cannot open include file: 'NvInfer.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\ModelImporter.cpp) [D:\roaster-scratch\onnxruntime\build\external\onnx-tensorrt\nvonnxparser_static.vcxproj]
D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\NvOnnxParser.h(26,10): fatal error C1083: Cannot open include file: 'NvInfer.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\builtin_op_importers.cpp) [D:\roaster-scratch\onnxruntime\build\external\onnx-tensorrt\nvonnxparser_static.vcxproj]
D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\ShapedWeights.hpp(25,10): fatal error C1083: Cannot open include file: 'NvInfer.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\onnx2trt_utils.cpp) [D:\roaster-scratch\onnxruntime\build\external\onnx-tensorrt\nvonnxparser_static.vcxproj]
D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\ShapedWeights.hpp(25,10): fatal error C1083: Cannot open include file: 'NvInfer.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\ShapedWeights.cpp) [D:\roaster-scratch\onnxruntime\build\external\onnx-tensorrt\nvonnxparser_static.vcxproj]
D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\ShapeTensor.hpp(25,10): fatal error C1083: Cannot open include file: 'NvInfer.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\ShapeTensor.cpp) [D:\roaster-scratch\onnxruntime\build\external\onnx-tensorrt\nvonnxparser_static.vcxproj]
D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\OnnxAttrs.hpp(25,10): fatal error C1083: Cannot open include file: 'NvInfer.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\OnnxAttrs.cpp) [D:\roaster-scratch\onnxruntime\build\external\onnx-tensorrt\nvonnxparser_static.vcxproj]
  onnx.vcxproj -> D:\roaster-scratch\onnxruntime\build\onnx\Release\onnx.lib
  onnxruntime_common.vcxproj -> D:\roaster-scratch\onnxruntime\build\Release\onnxruntime_common.lib
  onnxruntime_framework.vcxproj -> D:\roaster-scratch\onnxruntime\build\Release\onnxruntime_framework.lib
  onnxruntime_graph.vcxproj -> D:\roaster-scratch\onnxruntime\build\Release\onnxruntime_graph.lib
  pyop.cc
D:\roaster-scratch\onnxruntime\onnxruntime\core\language_interop_ops\pyop\pyop.h(2,10): fatal error C1083: Cannot open include file: 'core/platform/env.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_pyop.vcxproj]
  platform.cpp
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\platform.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
  threading.cpp
  dgemm.cpp
  sgemm.cpp
  qgemm.cpp
  convolve.cpp
  pooling.cpp
  reorder.cpp
  snchwc.cpp
  activate.cpp
  logistic.cpp
  tanh.cpp
  erf.cpp
  compute.cpp
  quantize.cpp
  qladd.cpp
  qladd_avx2.cpp
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\threading.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\dgemm.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\sgemm.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\convolve.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\qgemm.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\pooling.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\reorder.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\snchwc.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\activate.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\logistic.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\tanh.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\erf.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\intrinsics\avx2\../../mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\intrinsics\avx2\qladd_avx2.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\qladd.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\quantize.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\mlasi.h(20,10): fatal error C1083: Cannot open include file: 'mlas.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\mlas\lib\compute.cpp) [D:\roaster-scratch\onnxruntime\build\onnxruntime_mlas.vcxproj]
  attention_fusion.cc
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\attention_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/graph/graph_utils.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
  bias_gelu_fusion.cc
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\bias_gelu_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
  cast_elimination.cc
  computation_reduction.cc
  constant_folding.cc
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\computation_reduction.cc(4,10): fatal error C1083: Cannot open include file: 'core/common/safeint.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
  conv_activation_fusion.cc
  conv_add_fusion.cc
  conv_bn_fusion.cc
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\constant_folding.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/constant_folding.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
  conv_mul_fusion.cc
  dropout_elimination.cc
  dynamic_quantize_matmul_fusion.cc
  embed_layer_norm_fusion.cc
  expand_elimination.cc
  fast_gelu_fusion.cc
  free_dim_override_transformer.cc
  gelu_approximation.cc
  gelu_fusion.cc
  gemm_activation_fusion.cc
  graph_transformer.cc
  graph_transformer_mgr.cc
  graph_transformer_utils.cc
  identity_elimination.cc
  initializer.cc
  insert_cast_transformer.cc
  layer_norm_fusion.cc
  matmul_add_fusion.cc
  matmul_transpose_fusion.cc
  nchwc_transformer.cc
  optimizer_execution_frame.cc
  relu_clip_fusion.cc
  reshape_fusion.cc
  rule_based_graph_transformer.cc
  shape_to_initializer.cc
  skip_layer_norm_fusion.cc
  slice_elimination.cc
  transformer_memcpy.cc
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\conv_add_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/graph/graph_utils.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
  unsqueeze_elimination.cc
  utils.cc
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\conv_bn_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/graph/graph_utils.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\conv_mul_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/graph/graph_utils.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\embed_layer_norm_fusion.cc(3,10): fatal error C1083: Cannot open include file: 'core/optimizer/initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\fast_gelu_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\gelu_approximation.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\gemm_activation_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\gelu_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/optimizer/graph_transformer_utils.h(6,10): fatal error C1083: Cannot open include file: 'gsl/gsl': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\graph_transformer_utils.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\graph_transformer_mgr.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/graph_transformer_mgr.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\initializer.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\insert_cast_transformer.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/insert_cast_transformer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\layer_norm_fusion.cc(3,10): fatal error C1083: Cannot open include file: 'core/optimizer/initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\matmul_transpose_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\matmul_add_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\relu_clip_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/relu_clip_fusion.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\reshape_fusion.cc(4,10): fatal error C1083: Cannot open include file: 'core/graph/graph_utils.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\slice_elimination.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/slice_elimination.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\shape_to_initializer.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/shape_to_initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\unsqueeze_elimination.cc(4,10): fatal error C1083: Cannot open include file: 'core/optimizer/unsqueeze_elimination.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\skip_layer_norm_fusion.cc(3,10): fatal error C1083: Cannot open include file: 'core/optimizer/initializer.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\conv_activation_fusion.cc(5,10): fatal error C1083: Cannot open include file: 'core/graph/graph_utils.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\nchwc_transformer.cc(5,10): fatal error C1083: Cannot open include file: 'core/graph/graph_utils.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/common/logging/capture.h(7,10): fatal error C1083: Cannot open include file: 'gsl/gsl': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\cast_elimination.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/graph/graph.h(15,10): fatal error C1083: Cannot open include file: 'core/common/path.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\dynamic_quantize_matmul_fusion.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/common/logging/capture.h(7,10): fatal error C1083: Cannot open include file: 'gsl/gsl': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\expand_elimination.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/common/logging/capture.h(7,10): fatal error C1083: Cannot open include file: 'gsl/gsl': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\free_dim_override_transformer.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/common/logging/capture.h(7,10): fatal error C1083: Cannot open include file: 'gsl/gsl': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\dropout_elimination.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\cmake\external\onnx\onnx/onnx_pb.h(50,10): fatal error C1083: Cannot open include file: 'onnx/onnx-ml.pb.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\utils.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/graph/graph.h(15,10): fatal error C1083: Cannot open include file: 'core/common/path.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\graph_transformer.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/common/logging/capture.h(7,10): fatal error C1083: Cannot open include file: 'gsl/gsl': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\identity_elimination.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/graph/graph.h(15,10): fatal error C1083: Cannot open include file: 'core/common/path.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\rule_based_graph_transformer.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/common/logging/capture.h(7,10): fatal error C1083: Cannot open include file: 'gsl/gsl': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\optimizer_execution_frame.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/common/logging/capture.h(7,10): fatal error C1083: Cannot open include file: 'gsl/gsl': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\optimizer\transformer_memcpy.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_optimizer.vcxproj]
  onnxruntime_providers.vcxproj -> D:\roaster-scratch\onnxruntime\build\Release\onnxruntime_providers.lib
  onnxruntime_providers_cuda.vcxproj -> D:\roaster-scratch\onnxruntime\build\Release\onnxruntime_providers_cuda.lib
  onnxruntime_providers_dnnl.vcxproj -> D:\roaster-scratch\onnxruntime\build\Release\onnxruntime_providers_dnnl.dll
  pywrapper.cc
D:\roaster-scratch\onnxruntime\onnxruntime\core\language_interop_ops\pyop\pywrapper.cc(9,10): fatal error C1083: Cannot open include file: 'Python.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_pywrapper.vcxproj]
  IOBinding.cc
D:\roaster-scratch\onnxruntime\onnxruntime\core\session\IOBinding.cc(4,10): fatal error C1083: Cannot open include file: 'core/session/IOBinding.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_session.vcxproj]
  abi_session_options.cc
  custom_ops.cc
  default_cpu_allocator_c_api.cc
  environment.cc
  inference_session.cc
  inference_session_utils.cc
  onnxruntime_c_api.cc
  ort_env.cc
D:\roaster-scratch\onnxruntime\onnxruntime\core\session\inference_session_utils.cc(4,10): fatal error C1083: Cannot open include file: 'core/session/inference_session_utils.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_session.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\session\onnxruntime_c_api.cc(5,10): fatal error C1083: Cannot open include file: 'core/session/allocator_impl.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_session.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\core\session\default_cpu_allocator_c_api.cc(5,10): fatal error C1083: Cannot open include file: 'core/framework/utils.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_session.vcxproj]
D:\roaster-scratch\onnxruntime\cmake\external\onnx\onnx/onnx_pb.h(50,10): fatal error C1083: Cannot open include file: 'onnx/onnx-ml.pb.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\session\abi_session_options.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_session.vcxproj]
D:\roaster-scratch\onnxruntime\cmake\external\onnx\onnx/onnx_pb.h(50,10): fatal error C1083: Cannot open include file: 'onnx/onnx-ml.pb.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\session\custom_ops.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_session.vcxproj]
D:\roaster-scratch\onnxruntime\cmake\external\onnx\onnx/onnx_pb.h(50,10): fatal error C1083: Cannot open include file: 'onnx/onnx-ml.pb.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\session\inference_session.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_session.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/platform/threadpool.h(24,10): fatal error C1083: Cannot open include file: 'core/platform/env.h': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\session\environment.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_session.vcxproj]
D:\roaster-scratch\onnxruntime\include\onnxruntime\core/common/logging/capture.h(7,10): fatal error C1083: Cannot open include file: 'gsl/gsl': No such file or directory (compiling source file D:\roaster-scratch\onnxruntime\onnxruntime\core\session\ort_env.cc) [D:\roaster-scratch\onnxruntime\build\onnxruntime_session.vcxproj]
  gmock.vcxproj -> D:\roaster-scratch\onnxruntime\build\lib\Release\gmock.lib
  gtest.vcxproj -> D:\roaster-scratch\onnxruntime\build\lib\Release\gtest.lib
  compare_ortvalue.cc
  default_providers.cc
  file_util.cc
  temp_dir.cc
  test_allocator.cc
  test_environment.cc
  test_random_seed.cc
D:\roaster-scratch\onnxruntime\onnxruntime\test\util\compare_ortvalue.cc(4,10): fatal error C1083: Cannot open include file: 'test/compare_ortvalue.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_test_utils.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\test\util\temp_dir.cc(4,10): fatal error C1083: Cannot open include file: 'test/util/include/temp_dir.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_test_utils.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\test\util\test_environment.cc(4,10): fatal error C1083: Cannot open include file: 'test/test_environment.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_test_utils.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\test\util\test_random_seed.cc(4,10): fatal error C1083: Cannot open include file: 'test/util/include/test_random_seed.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_test_utils.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\test\util\file_util.cc(1,10): fatal error C1083: Cannot open include file: 'file_util.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_test_utils.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\test\util\default_providers.cc(4,10): fatal error C1083: Cannot open include file: 'default_providers.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_test_utils.vcxproj]
D:\roaster-scratch\onnxruntime\onnxruntime\test\util\test_allocator.cc(4,10): fatal error C1083: Cannot open include file: 'test_allocator.h': No such file or directory [D:\roaster-scratch\onnxruntime\build\onnxruntime_test_utils.vcxproj]
  onnxruntime_util.vcxproj -> D:\roaster-scratch\onnxruntime\build\Release\onnxruntime_util.lib
  re2.vcxproj -> D:\roaster-scratch\onnxruntime\build\external\re2\Release\re2.lib

System information

jywu-msft commented 3 years ago

Thanks for reporting. we'll have to investigate why this pure cmake build fails vs using build.bat (which just invokes cmake internally)

stevenlix commented 3 years ago

According to the error message, D:\roaster-scratch\onnxruntime\cmake\external\onnx-tensorrt\NvOnnxParser.h(26,10): fatal error C1083: Cannot open include file: 'NvInfer.h' It seems TensorRT is not found. Could you check your TensorRT installation path?

xkszltl commented 3 years ago

TRT is installed. Scroll down and you'll see fatal error C1083: Cannot open include file: 'mlas.h'. So most likely -I is broken.

jywu-msft commented 3 years ago

with latest master, I was able to build successfully on Windows using purely cmake. can you please try again with latest master? in the last 5 days, there were a couple PR's that could have affected this. specifically https://github.com/microsoft/onnxruntime/pull/5167 and https://github.com/microsoft/onnxruntime/pull/5218

I used below batch file which has all the cmake build options you referenced above.

mkdir build\Windows\Release && cd build\Windows\Release
cmake                                                                                   ^
        -A x64                                                                          ^
        -DBOOST_ROOT="${Env:ProgramFiles}/boost"                                        ^
        -DBUILD_SHARED_LIBS=OFF                                                         ^
        -DCMAKE_C_FLAGS="/GL /MP /Zi /arch:AVX2"                                        ^
        -DCMAKE_CUDA_FLAGS="-gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_37,code=sm_37"    ^
        -DCMAKE_CXX_FLAGS="/EHsc /GL /MP /Zi /arch:AVX2"                                ^
        -DCMAKE_EXE_LINKER_FLAGS="/DEBUG:FASTLINK /LTCG:incremental"                    ^
        -DCMAKE_INSTALL_PREFIX="${Env:ProgramFiles}/onnxruntime"                        ^
        -DCMAKE_PDB_OUTPUT_DIRECTORY="${PWD}/pdb"                                       ^
        -DCMAKE_SHARED_LINKER_FLAGS="/DEBUG:FASTLINK /LTCG:incremental"                 ^
        -DCMAKE_STATIC_LINKER_FLAGS="/LTCG:incremental"                                 ^
        -DCUDA_VERBOSE_BUILD=ON                                                         ^
        -Deigen_SOURCE_PATH="${Env:ProgramFiles}/Eigen3/include/eigen3"                 ^
        -Donnxruntime_BUILD_CSHARP=OFF                                                  ^
        -Donnxruntime_BUILD_SHARED_LIB=ON                                               ^
        -Donnxruntime_CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0"    ^
        -Donnxruntime_CUDNN_HOME="C:\cudnn8\cuda"   ^
        -Donnxruntime_ENABLE_PYTHON=ON                                                  ^
        -Donnxruntime_RUN_ONNX_TESTS=ON                                                 ^
        -Donnxruntime_ENABLE_LANGUAGE_INTEROP_OPS=ON                                    ^
        -Donnxruntime_ENABLE_LTO=OFF                                                    ^
        -Donnxruntime_PREFER_SYSTEM_LIB=OFF                                             ^
        -Donnxruntime_TENSORRT_HOME="C:\tensorrt\TensorRT-7.1.3.4"                      ^
        -Donnxruntime_USE_CUDA=ON                                                       ^
        -Donnxruntime_USE_DNNL=ON                                                       ^
        -Donnxruntime_USE_EIGEN_FOR_BLAS=ON                                             ^
        -Donnxruntime_USE_FULL_PROTOBUF=ON                                              ^
        -Donnxruntime_USE_JEMALLOC=OFF                                                  ^
        -Donnxruntime_USE_LLVM=OFF                                                      ^
        -Donnxruntime_USE_MKLML=OFF                                                     ^
        -Donnxruntime_USE_NGRAPH=OFF                                                    ^
        -Donnxruntime_USE_NUPHAR=OFF                                                    ^
        -Donnxruntime_USE_OPENBLAS=OFF                                                  ^
        -Donnxruntime_USE_OPENMP=OFF                                                    ^
        -Donnxruntime_USE_PREINSTALLED_EIGEN=OFF                                        ^
        -Donnxruntime_USE_TENSORRT=ON                                                   ^
        -Donnxruntime_USE_TVM=OFF                                                       ^
        -G"Visual Studio 16 2019"                                                       ^
        -T"host=x64"                                                                    ^
..\..\..\cmake
cmake --build . --config Release -- -maxcpucount
xkszltl commented 3 years ago

Great, now it works! Thanks for the help ^_^