如何在Windows下编译出x86静态库以便Win32客户端使用
Created by: youngcube
目前位于 release/v2.6.0 分支
我先是依照文档,运行了 \lite\tools\build_windows.bat 输入正确的vs command prompt以及python路径后,运行后报错,没有产出,以下是日志
Please input the path of visual studio command Prompt, such as C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat =======> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
Please input the path of python.exe, such as C:\Python35\python.exe, C:\Python35\python3.exe =======>C:\Program Files\Python35\python.exe
"The directory of third_party exists, the third-party-05b862.tar.gz not exists."
1 file(s) copied.
-- Found Paddle host system: win32, version:
-- Found Paddle host system's CPU: 8 cores
-- Selecting Windows SDK version to target Windows 10.0.19041.
-- The CXX compiler identification is MSVC 19.0.24215.1
-- The C compiler identification is MSVC 19.0.24215.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe, version: MSVC 19.0.24215.1
-- C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe, version: MSVC 19.0.24215.1
-- AR tools: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/lib.exe
-- Using parallel compiling (/MP)
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.27.0.windows.1")
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Performing Test MMX_FOUND
-- Performing Test MMX_FOUND - Failed
-- Performing Test SSE2_FOUND
-- Performing Test SSE2_FOUND - Success
-- Performing Test SSE3_FOUND
-- Performing Test SSE3_FOUND - Success
-- Performing Test AVX_FOUND
-- Performing Test AVX_FOUND - Success
-- Performing Test AVX2_FOUND
-- Performing Test AVX2_FOUND - Success
-- Performing Test AVX512F_FOUND
-- Performing Test AVX512F_FOUND - Failed
-- CMAKE_BUILD_TYPE: Release
-- Found PythonInterp: C:/Program Files/Python35/python.exe (found version "3.5.3")
-- Found PythonLibs: C:/Program Files/Python35/libs/python35.lib (found version "3.5.3")
-- Found PY_pip: C:\Program Files\Python35\lib\site-packages\pip\__init__.py
-- MKLML_VER: mklml_win_2019.0.1.20181227, MKLML_URL: https://paddlepaddledeps.bj.bcebos.com/mklml_win_2019.0.1.20181227.zip
-- Looking for C++ include shlwapi.h
-- Looking for C++ include shlwapi.h - found
CMake Warning at cmake/external/protobuf.cmake:155 (message):
Cannot find protobuf library in
D:/SourceTree/Paddle-Lite/build.lite.x86/third_party/install/protobuf
Call Stack (most recent call first):
CMakeLists.txt:232 (include)
-- Protobuf protoc executable: D:/SourceTree/Paddle-Lite/build.lite.x86/third_party/install/protobuf/bin/protoc.exe
-- Protobuf-lite library: D:/SourceTree/Paddle-Lite/build.lite.x86/third_party/install/protobuf/lib/libprotobuf-lite.lib
-- Protobuf library: D:/SourceTree/Paddle-Lite/build.lite.x86/third_party/install/protobuf/lib/libprotobuf.lib
-- Protoc library: D:/SourceTree/Paddle-Lite/build.lite.x86/third_party/install/protobuf/lib/libprotoc.lib
-- Protobuf version: 3.1.0
-- Found cblas and lapack in MKLML (include: D:/SourceTree/Paddle-Lite/build.lite.x86/third_party/install/mklml/include, library: D:/SourceTree/Paddle-Lite/build.lite.x86/third_party/install/mklml/lib/mklml.lib)
-- BLAS library: D:/SourceTree/Paddle-Lite/build.lite.x86/third_party/install/mklml/lib/mklml.lib
-- BLAS Include: D:/SourceTree/Paddle-Lite/build.lite.x86/third_party/install/mklml/include
-- Enable Intel OpenMP with D:/SourceTree/Paddle-Lite/build.lite.x86/third_party/install/mklml/lib/libiomp5md.lib
CMake Warning (dev) in cmake/configure.cmake:
A logical block opening on the line
D:/SourceTree/Paddle-Lite/cmake/configure.cmake:82 (if)
closes on the line
D:/SourceTree/Paddle-Lite/cmake/configure.cmake:87 (endif)
with mis-matching arguments.
Call Stack (most recent call first):
CMakeLists.txt:239 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Paddle version is 0.0.0
-- Looking for UINT64_MAX
-- Looking for UINT64_MAX - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of pthread_spinlock_t
-- Check size of pthread_spinlock_t - failed
-- Check size of pthread_barrier_t
-- Check size of pthread_barrier_t - failed
CMake Warning at lite/CMakeLists.txt:3 (message):
Lite enabled!
-- LIGHT_FRAMEWORK: OFF
-- LITE_WITH_CUDA: OFF
-- LITE_WITH_X86: ON
-- LITE_WITH_ARM: OFF
-- LITE_WITH_OPENCL: OFF
-- LITE_WITH_NPU: OFF
-- LITE_WITH_RKNPU: OFF
-- LITE_WITH_XPU: OFF
-- LITE_WITH_APU: OFF
-- LITE_WITH_XTCL:
-- LITE_WITH_FPGA: OFF
-- LITE_WITH_MLU: OFF
-- LITE_WITH_BM: OFF
-- LITE_WITH_PROFILE: OFF
-- LITE_WITH_CV: OFF
-- LITE_WITH_ARM_LANG:
-- add lite kernels
-- compile with lite host kernels
-- compile with lite ARM kernels
-- compile with lite CUDA kernels
fatal: no tag exactly matches '3137f18b0154e6faf4d79288c1dde3c501392dda'
-- tag:
-- branch: release/v2.6.0
-- commit: 3137f18b
-- ----> mir_subgraphs: subgraph_pass
-- ----> Ops lite: ;conv_op;pool_op;fc_op;mul_op;matmul_op;scale_op;softmax_op;reshape_op;batch_norm_op;feed_op;fetch_op;activation_basic_ops;elementwise_ops;box_coder_op_lite;multiclass_nms_op_lite;fill_constant_op;fill_constant_batch_size_like_op;shuffle_channel_op;yolo_box_op;interpolate_op;argmax_op;prior_box_op;concat_op;pad2d_op;calib_op;split_op;transpose_op;fake_quant;fake_dequant;conv_transpose_op;expand_op_lite;squeeze_op_lite;unsqueeze_op_lite;stack_op;cast_op_lite;affine_channel_op;range_op;reduce_mean_op;relu_op;io_copy_op;fusion_elementwise_activation_ops;io_copy_once_op;dropout_op;layout_op;instance_norm_op;subgraph_op;grid_sampler_op;flatten_op;negative_op;crop_op;assign_op;power_op;norm_op;activation_extra_ops;search_group_padding;lrn_op_lite;decode_bboxes_op_lite;uniform_random_op;axpy_op;gru_unit_op;gru_op;layout_once_op;density_prior_box_op;calib_once_op;reduce_max_op_lite;shape_op_lite;sequence_expand_op_lite;sequence_unpad_op_lite;im2sequence_op;gather_op;anchor_generator_op;generate_proposals_op;roi_align_op;box_clip_op;fake_quantize_range_abs_max_op;sequence_expand_as_op_lite;assign_value_op;fake_quantize_dequantize_moving_avg_abs_max_op;fake_channel_wise_dequantize_max_abs_op;split_lod_tensor_op_lite;merge_lod_tensor_op_lite;reduce_prod_op_lite;sequence_reshape_op_lite;sequence_reverse_op_lite;sequence_pool;sequence_conv;sequence_pool_concat;reduce_sum_op_lite;match_matrix_tensor_op_lite;search_seq_depadding_op_lite;search_grnn_op_lite;search_seq_softmax_op_lite;sequence_concat_op_lite;var_conv_2d_op_lite;attention_padding_mask_op_lite;sequence_arithmetic_op_lite;conditional_block_op_lite;collect_fpn_proposals_op_lite;distribute_fpn_proposals_op_lite;crf_decoding_op_lite;ctc_align_op_lite;while_op;lookup_table_op;lookup_table_dequant_op;lookup_table_v2_op;beam_search_decode_op;logical_xor;logical_and;logical_or;logical_not;less_than;equal;not_equal;less_equal;greater_than;greater_equal;read_from_array_op;beam_search_op;lod_reset_op;is_empty;slice_op_lite;write_to_array_op;topk_op;increment_op;layer_norm_op;sequence_softmax_op;search_aligned_mat_mul_op;search_seq_fc_op;sequence_topk_avg_pooling_op;search_fc_op;lstm_op;mean_op;__xpu__resnet50_op;__xpu__multi_encoder_op;__xpu__embedding_with_eltwise_add_op;__xpu__fc_op
-- ----> Host kernels: ;feed_compute_host;fetch_compute_host;reshape_compute_host;multiclass_nms_compute_host;shape_compute_host;is_empty_compute_host;crf_decoding_compute_host;compare_compute_host;logical_compute_host;ctc_align_compute_host;write_to_array_compute_host;read_from_array_compute_host;assign_compute_host
-- ----> X86 kernels: ;activation_compute_x86;scale_compute_x86;cast_compute_x86;slice_compute_x86;squeeze_compute_x86;fill_constant_batch_size_like_compute_x86;reshape_compute_x86;conv_compute_x86;pool_compute_x86;stack_compute_x86;dropout_compute_x86;transpose_compute_x86;layer_norm_compute_x86;fc_compute_x86;gru_compute_x86;sequence_expand_as_compute_x86;sequence_unpad_compute_x86;sequence_conv_compute_x86;gather_compute_x86;mul_compute_x86;concat_compute_x86;shape_compute_x86;sequence_pool_compute_x86;search_group_padding_compute_x86;sequence_reverse_compute_x86;softmax_compute_x86;elementwise_compute_x86;batch_norm_compute_x86;reduce_sum_compute_x86;lookup_table_compute_x86;sequence_reshape_compute_x86;match_matrix_tensor_compute_x86;search_seq_depadding_compute_x86;search_grnn_compute_x86;sequence_concat_compute_x86;var_conv_2d_compute_x86;attention_padding_mask_compute_x86;sequence_arithmetic_compute_x86;search_aligned_mat_mul_compute_x86;search_seq_fc_compute_x86;sequence_topk_avg_pooling_compute_x86;search_fc_compute_x86;matmul_compute_x86
CMake Warning (dev) in lite/api/CMakeLists.txt:
A logical block opening on the line
D:/SourceTree/Paddle-Lite/lite/api/CMakeLists.txt:1 (if)
closes on the line
D:/SourceTree/Paddle-Lite/lite/api/CMakeLists.txt:5 (endif)
with mis-matching arguments.
This warning is for project developers. Use -Wno-dev to suppress it.
-- get ops ;conv_op;pool_op;fc_op;mul_op;matmul_op;scale_op;softmax_op;reshape_op;batch_norm_op;feed_op;fetch_op;activation_basic_ops;elementwise_ops;box_coder_op_lite;multiclass_nms_op_lite;fill_constant_op;fill_constant_batch_size_like_op;shuffle_channel_op;yolo_box_op;interpolate_op;argmax_op;prior_box_op;concat_op;pad2d_op;calib_op;split_op;transpose_op;fake_quant;fake_dequant;conv_transpose_op;expand_op_lite;squeeze_op_lite;unsqueeze_op_lite;stack_op;cast_op_lite;affine_channel_op;range_op;reduce_mean_op;relu_op;io_copy_op;fusion_elementwise_activation_ops;io_copy_once_op;dropout_op;layout_op;instance_norm_op;subgraph_op;grid_sampler_op;flatten_op;negative_op;crop_op;assign_op;power_op;norm_op;activation_extra_ops;search_group_padding;lrn_op_lite;decode_bboxes_op_lite;uniform_random_op;axpy_op;gru_unit_op;gru_op;layout_once_op;density_prior_box_op;calib_once_op;reduce_max_op_lite;shape_op_lite;sequence_expand_op_lite;sequence_unpad_op_lite;im2sequence_op;gather_op;anchor_generator_op;generate_proposals_op;roi_align_op;box_clip_op;fake_quantize_range_abs_max_op;sequence_expand_as_op_lite;assign_value_op;fake_quantize_dequantize_moving_avg_abs_max_op;fake_channel_wise_dequantize_max_abs_op;split_lod_tensor_op_lite;merge_lod_tensor_op_lite;reduce_prod_op_lite;sequence_reshape_op_lite;sequence_reverse_op_lite;sequence_pool;sequence_conv;sequence_pool_concat;reduce_sum_op_lite;match_matrix_tensor_op_lite;search_seq_depadding_op_lite;search_grnn_op_lite;search_seq_softmax_op_lite;sequence_concat_op_lite;var_conv_2d_op_lite;attention_padding_mask_op_lite;sequence_arithmetic_op_lite;conditional_block_op_lite;collect_fpn_proposals_op_lite;distribute_fpn_proposals_op_lite;crf_decoding_op_lite;ctc_align_op_lite;while_op;lookup_table_op;lookup_table_dequant_op;lookup_table_v2_op;beam_search_decode_op;logical_xor;logical_and;logical_or;logical_not;less_than;equal;not_equal;less_equal;greater_than;greater_equal;read_from_array_op;beam_search_op;lod_reset_op;is_empty;slice_op_lite;write_to_array_op;topk_op;increment_op;layer_norm_op;sequence_softmax_op;search_aligned_mat_mul_op;search_seq_fc_op;sequence_topk_avg_pooling_op;search_fc_op;lstm_op;mean_op;__xpu__resnet50_op;__xpu__multi_encoder_op;__xpu__embedding_with_eltwise_add_op;__xpu__fc_op
-- get X86 kernels ;activation_compute_x86;scale_compute_x86;cast_compute_x86;slice_compute_x86;squeeze_compute_x86;fill_constant_batch_size_like_compute_x86;reshape_compute_x86;conv_compute_x86;pool_compute_x86;stack_compute_x86;dropout_compute_x86;transpose_compute_x86;layer_norm_compute_x86;fc_compute_x86;gru_compute_x86;sequence_expand_as_compute_x86;sequence_unpad_compute_x86;sequence_conv_compute_x86;gather_compute_x86;mul_compute_x86;concat_compute_x86;shape_compute_x86;sequence_pool_compute_x86;search_group_padding_compute_x86;sequence_reverse_compute_x86;softmax_compute_x86;elementwise_compute_x86;batch_norm_compute_x86;reduce_sum_compute_x86;lookup_table_compute_x86;sequence_reshape_compute_x86;match_matrix_tensor_compute_x86;search_seq_depadding_compute_x86;search_grnn_compute_x86;sequence_concat_compute_x86;var_conv_2d_compute_x86;attention_padding_mask_compute_x86;sequence_arithmetic_compute_x86;search_aligned_mat_mul_compute_x86;search_seq_fc_compute_x86;sequence_topk_avg_pooling_compute_x86;search_fc_compute_x86;matmul_compute_x86
-- get CUDA kernels
-- get Host kernels ;feed_compute_host;fetch_compute_host;reshape_compute_host;multiclass_nms_compute_host;shape_compute_host;is_empty_compute_host;crf_decoding_compute_host;compare_compute_host;logical_compute_host;ctc_align_compute_host;write_to_array_compute_host;read_from_array_compute_host;assign_compute_host
-- get ARM kernels
-- get OpenCL kernels
-- get NPU kernels
-- get APU kernels
-- get XPU kernels
-- get RKNPU kernels
-- get FPGA kernels
-- get BM kernels
-- get MLU kernels
-- bundled_tgt_full_name: D:/SourceTree/Paddle-Lite/build.lite.x86/libpaddle_api_full_bundled.lib
-- bundled_tgt_full_name: D:/SourceTree/Paddle-Lite/build.lite.x86/libpaddle_api_light_bundled.lib
fatal: no tag exactly matches '3137f18b0154e6faf4d79288c1dde3c501392dda'
-- publish inference lib to D:/SourceTree/Paddle-Lite/build.lite.x86/inference_lite_lib
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
WITH_GPU
-- Build files have been written to: D:/SourceTree/Paddle-Lite/build.lite.x86
后来我直接使用release编译好的 inference_lite_lib.win.x86.MSVC.C++_static.py37.full_publish.zip
内的 /cxx/lib ,但这个库是x64的,而不是x86的,直接接入原有x86项目会提示 Error | LNK2001 | unresolved external symbol "public: class std::vector<__int64,class std::allocator<__int64> > __thiscall paddle::lite_api::Tensor::shape(void)const " (?shape@Tensor@lite_api@paddle@@QBE?AV?$vector@_JV?$allocator@_J@std@@@std@@XZ)
请问如何才能编译出正确的x86静态库以便Win32客户端使用?