mlc-ai / mlc-llm

Universal LLM Deployment Engine with ML Compilation
https://llm.mlc.ai/
Apache License 2.0
19.08k stars 1.56k forks source link

[Bug] Meet error: 'path' is unavailable: introduced in macOS 10.15 on Macbook M2 #964

Closed Utkarsh305 closed 1 year ago

Utkarsh305 commented 1 year ago

🐛 Bug

We follow the instruction of CLI and C++ API (https://mlc.ai/mlc-llm/docs/deploy/cli.html) and run 'cmake'

There are several errors: erro: 'XXX' is unavailable: introduced in macOS 10.15

To Reproduce

Steps to reproduce the behavior:

  1. Follow the instruction of CLI and C++ API (https://mlc.ai/mlc-llm/docs/deploy/cli.html)
  2. Build from source, not using prebuilt
  3. Run the step: cmake .. && cmake --build . --parallel $(nproc) && cd ..

Expected behavior

Expect the building is successful

Environment

Additional context

TVM Unity Hash Tag: USE_GTEST: AUTO SUMMARIZE: OFF USE_IOS_RPC: ON USE_ETHOSU: OFF CUDA_VERSION: NOT-FOUND USE_LIBBACKTRACE: AUTO DLPACK_PATH: 3rdparty/dlpack/include USE_TENSORRT_CODEGEN: OFF USE_THRUST: OFF USE_TARGET_ONNX: OFF USE_AOT_EXECUTOR: ON BUILD_DUMMY_LIBTVM: OFF USE_CUDNN: OFF USE_TENSORRT_RUNTIME: OFF USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR: OFF USE_CCACHE: AUTO USE_ARM_COMPUTE_LIB: OFF USE_CPP_RTVM: OFF USE_OPENCL_GTEST: /path/to/opencl/gtest USE_MKL: OFF USE_PT_TVMDSOOP: OFF MLIR_VERSION: NOT-FOUND USE_CLML: OFF USE_STACKVM_RUNTIME: OFF USE_GRAPH_EXECUTOR_CUDA_GRAPH: OFF ROCM_PATH: /opt/rocm USE_DNNL: OFF USE_VITIS_AI: OFF USE_MLIR: OFF USE_RCCL: OFF USE_LLVM: ON USE_VERILATOR: OFF USE_TF_TVMDSOOP: OFF USE_THREADS: ON USE_MSVC_MT: OFF BACKTRACE_ON_SEGFAULT: OFF USE_GRAPH_EXECUTOR: ON USE_NCCL: OFF USE_ROCBLAS: OFF GIT_COMMIT_HASH: 17adc1e7223142b63fd07b99fcc5c1e6d388ed1e USE_VULKAN: OFF USE_RUST_EXT: OFF USE_CUTLASS: OFF USE_CPP_RPC: OFF USE_HEXAGON: OFF USE_CUSTOM_LOGGING: OFF USE_UMA: OFF USE_FALLBACK_STL_MAP: OFF USE_SORT: ON USE_RTTI: ON GIT_COMMIT_TIME: 2023-09-20 07:16:41 -0700 USE_HEXAGON_SDK: /path/to/sdk USE_BLAS: none USE_ETHOSN: OFF USE_LIBTORCH: OFF USE_RANDOM: ON USE_CUDA: OFF USE_COREML: OFF USE_AMX: OFF BUILD_STATIC_RUNTIME: OFF USE_CMSISNN: OFF USE_KHRONOS_SPIRV: OFF USE_CLML_GRAPH_EXECUTOR: OFF USE_TFLITE: OFF USE_HEXAGON_GTEST: /path/to/hexagon/gtest PICOJSON_PATH: 3rdparty/picojson USE_OPENCL_ENABLE_HOST_PTR: OFF INSTALL_DEV: OFF USE_PROFILER: ON USE_NNPACK: OFF LLVM_VERSION: 16.0.6 USE_OPENCL: OFF COMPILER_RT_PATH: 3rdparty/compiler-rt RANG_PATH: 3rdparty/rang/include USE_SPIRV_KHR_INTEGER_DOT_PRODUCT: OFF USE_OPENMP: none USE_BNNS: OFF USE_CUBLAS: OFF USE_METAL: ON USE_MICRO_STANDALONE_RUNTIME: OFF USE_HEXAGON_EXTERNAL_LIBS: OFF USE_ALTERNATIVE_LINKER: AUTO USE_BYODT_POSIT: OFF USE_HEXAGON_RPC: OFF USE_MICRO: OFF DMLC_PATH: 3rdparty/dmlc-core/include INDEX_DEFAULT_I64: ON USE_RELAY_DEBUG: OFF USE_RPC: ON USE_TENSORFLOW_PATH: none TVM_CLML_VERSION: USE_MIOPEN: OFF USE_ROCM: OFF USE_PAPI: OFF USE_CURAND: OFF TVM_CXX_COMPILER_PATH: /Library/Developer/CommandLineTools/usr/bin/c++ HIDE_PRIVATE_SYMBOLS: OFF

JimmyLi-Network commented 1 year ago

Hi guys,

I have fixed this error on a Macbook M2 laptop.

You need to modify the CMakeLists.txt file in /mlc-llm folder.

Add the Cmake flag of "cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=xx.xx", that "xx.xx" indicates your own system version, e.g., 12.14

junrushao commented 1 year ago

Thanks a bunch! @JimmyLi-Network Would you mind sharing more details how you patch this issue? Are you using:

cd /path/to/mlc-llm/
mkdir build/ && cd build/
cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=xxx ..

Thanks again!

JimmyLi-Network commented 1 year ago

@junrushao Hi, I just modified the 'CMakelists.txt' file and added the flag. That works.

Change

cmake_minimum_required(VERSION 3.18)
project(mlc_llm C CXX)

include(CheckCXXCompilerFlag)
if(NOT MSVC)
  check_cxx_compiler_flag("-std=c++17" SUPPORT_CXX17)
  set(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}")
  set(CMAKE_CUDA_STANDARD 17)
else()
  check_cxx_compiler_flag("/std:c++17" SUPPORT_CXX17)
  set(CMAKE_CXX_FLAGS "/std:c++17 ${CMAKE_CXX_FLAGS}")
  set(CMAKE_CUDA_STANDARD 17)
endif()

to

cmake_minimum_required(VERSION 3.18)
project(mlc_llm C CXX)

set(CMAKE_OSX_DEPLOYMENT_TARGET "xx.xx" CACHE STRING "Minimum OS X deployment version" FORCE)

include(CheckCXXCompilerFlag)
if(NOT MSVC) %I'm using Macbook so it is not MSVC
  check_cxx_compiler_flag("-std=c++17" SUPPORT_CXX17)
  set(CMAKE_CXX_FLAGS "-std=c++17 -DCMAKE_OSX_DEPLOYMENT_TARGET=xx.xx ${CMAKE_CXX_FLAGS}")
  set(CMAKE_CUDA_STANDARD 17)
else()
  check_cxx_compiler_flag("/std:c++17" SUPPORT_CXX17)
  set(CMAKE_CXX_FLAGS "/std:c++17 ${CMAKE_CXX_FLAGS}")
  set(CMAKE_CUDA_STANDARD 17)
endif()

I think you directly use this in cmake command, it would work as well.

junrushao commented 1 year ago

Thanks for the pointer! We will update the tutorials properly later