ggerganov / whisper.cpp

Port of OpenAI's Whisper model in C/C++
MIT License
35.38k stars 3.61k forks source link

Addon.node build failed on m1 macOS with error "include could not find requested file: DefaultTargetOptions" #2435

Open danielchim opened 1 month ago

danielchim commented 1 month ago

Description

I have tried to build the addon.node example in the repository, what I did is clone this repository and try to compile the main sample app by running make, once finished I head to the addon.node folder in example folder, I have installed the dependencies and run the npx cmake-js compile -c 'xxx/cmake' -T addon.node -B Release, but it will throw an error saying

CMake Error at CMakeLists.txt:13 (include):
  include could not find requested file:

    DefaultTargetOptions

Beforehand I have installed cmake with homebrew. Is there anything I can do to work around this issue or why is it causing this issue?

System information

Device: Apple Macbook Pro 16-inch (2021) SoC: M1 Pro RAM: 16GB Memory OS Version: macOS 14.6

XCode Version: 15.4 Cmake version: 3.30.4 NodeJS version: 20.16.0

Full Log

npx cmake-js compile -T addon.node -B Release
info TOOL Using Unix Makefiles generator.
info TOOL Building only the addon.node target, as specified from the command line.
info CMD BUILD
info RUN [
info RUN   'cmake',
info RUN   '--build',
info RUN   '/Users/herself66/IdeaProjects/whisper.cpp/examples/addon.node/build',
info RUN   '--config',
info RUN   'Release',
info RUN   '--target',
info RUN   'addon.node'
info RUN ]
make: Makefile: No such file or directory
make: *** No rule to make target `Makefile'.  Stop.
info REP Build has been failed, trying to do a full rebuild.
info CMD CLEAN
info RUN [
info RUN   'cmake',
info RUN   '-E',
info RUN   'remove_directory',
info RUN   '/Users/herself66/IdeaProjects/whisper.cpp/examples/addon.node/build'
info RUN ]
info CMD CONFIGURE
info TOOL Building only the addon.node target, as specified from the command line.
info RUN [
info RUN   'cmake',
info RUN   '/Users/herself66/IdeaProjects/whisper.cpp/examples/addon.node',
info RUN   '--no-warn-unused-cli',
info RUN   '-G',
info RUN   'Unix Makefiles',
info RUN   '-DCMAKE_JS_VERSION=7.3.0',
info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/herself66/IdeaProjects/whisper.cpp/examples/addon.node/build/Release',
info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
info RUN   '-DCMAKE_JS_INC=/Users/herself66/.cmake-js/node-arm64/v20.16.0/include/node',
info RUN   '-DCMAKE_JS_SRC=',
info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=20.16.0',
info RUN   '-DNODE_ARCH=arm64',
info RUN   '-DCMAKE_OSX_ARCHITECTURES=arm64',
info RUN   '-DCMAKE_JS_LIB=',
info RUN   '-DCMAKE_CXX_FLAGS=-D_DARWIN_USE_64_BIT_INODE=1 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILDING_NODE_EXTENSION',
info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=-undefined dynamic_lookup'
info RUN ]
Not searching for unused variables given on the command line.
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:13 (include):
  include could not find requested file:

    DefaultTargetOptions

CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.30)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
ERR! OMG Process terminated: 1