From c9d87418db366bc4ac1f1c1c0649d457198da57b Mon Sep 17 00:00:00 2001 From: tqchen Date: Sat, 28 Feb 2026 13:43:36 +0000 Subject: [PATCH] [CMAKE] Remove unused Libbacktrace.cmake Libbacktrace is now built through tvm-ffi's own cmake infrastructure (3rdparty/tvm-ffi/cmake/Utils/AddLibbacktrace.cmake). The legacy cmake/libs/Libbacktrace.cmake is no longer referenced. --- cmake/libs/Libbacktrace.cmake | 66 ----------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 cmake/libs/Libbacktrace.cmake diff --git a/cmake/libs/Libbacktrace.cmake b/cmake/libs/Libbacktrace.cmake deleted file mode 100644 index 2746c846fa5c..000000000000 --- a/cmake/libs/Libbacktrace.cmake +++ /dev/null @@ -1,66 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# On MacOS, the default C compiler (/usr/bin/cc) is actually a small script that dispatches to a -# compiler the default SDK (usually /Library/Developer/CommandLineTools/usr/bin/ or -# /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/). CMake -# automatically detects what is being dispatched and uses it instead along with all the flags it -# needs. CMake makes this second compiler available through the CMAKE_C_COMPILER variable, but it -# does not make the necessary flags available. This leads to configuration errors in libbacktrace -# because it can't find system libraries. Our solution is to detect if CMAKE_C_COMPILER lives in -# /Library or /Applications and switch to the default compiler instead. -include(ExternalProject) - - -if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND (CMAKE_C_COMPILER MATCHES "^/Library" - OR CMAKE_C_COMPILER MATCHES "^/Applications")) - set(c_compiler "/usr/bin/cc") - else() - set(c_compiler "${CMAKE_C_COMPILER}") -endif() - -ExternalProject_Add(project_libbacktrace - PREFIX libbacktrace - SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../3rdparty/libbacktrace - BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libbacktrace - CONFIGURE_COMMAND "${CMAKE_CURRENT_LIST_DIR}/../../3rdparty/libbacktrace/configure" - "--prefix=${CMAKE_CURRENT_BINARY_DIR}/libbacktrace" - --with-pic - "CC=${c_compiler}" - "CFLAGS=${CMAKE_C_FLAGS}" - "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS}" - "CPP=${c_compiler} -E" - "NM=${CMAKE_NM}" - "STRIP=${CMAKE_STRIP}" - "--host=${MACHINE_NAME}" - INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/libbacktrace" - BUILD_COMMAND make - INSTALL_COMMAND make install - BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/libbacktrace/lib/libbacktrace.a" - "${CMAKE_CURRENT_BINARY_DIR}/libbacktrace/include/backtrace.h" - ) - -# Custom step to rebuild libbacktrace if any of the source files change -tvm_file_glob(GLOB LIBBACKTRACE_SRCS "${CMAKE_CURRENT_LIST_DIR}/../../3rdparty/libbacktrace/*.c") -ExternalProject_Add_Step(project_libbacktrace checkout - DEPENDERS configure - DEPENDEES download - DEPENDS ${LIBBACKTRACE_SRCS} -) - -# create include directory so CMake doesn't complain -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libbacktrace/include)