Skip to content

build and ggml_print_backtrace issue #3204

@SubodhSenpai

Description

@SubodhSenpai

I am encountering linker errors when building the project using Visual Studio 2022 on Windows. The errors are:

text
Error LNK2019: unresolved external symbol ggml_print_backtrace referenced in function ggml_uncaught_exception
Error LNK1120: 1 unresolved externals

Steps to reproduce:

Clone the repository fresh.

Configure the build with CMake (e.g., cmake -B build -DGGML_CUDA=1).

Open the generated .sln file.

These are my terminal screenshots

C:\Users\Subhodh\Downloads\whisper>git clone https://github.com/ggml-org/whisper.cpp.git
Cloning into 'whisper.cpp'...
remote: Enumerating objects: 19538, done.
remote: Counting objects: 100% (627/627), done.
remote: Compressing objects: 100% (275/275), done.
remote: Total 19538 (delta 459), reused 353 (delta 351), pack-reused 18911 (from 5)
Receiving objects: 100% (19538/19538), 24.81 MiB | 11.80 MiB/s, done.
Resolving deltas: 100% (13437/13437), done.

C:\Users\Subhodh\Downloads\whisper>cd whisper.cpp

C:\Users\Subhodh\Downloads\whisper\whisper.cpp>cmake -B build -DGGML_CUDA=1
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.26100.
-- The C compiler identification is MSVC 19.41.34120.0
-- The CXX compiler identification is MSVC 19.41.34120.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - 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: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.46.0.windows.1")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Warning: ccache not found - consider installing it for faster compilation or disable this warning with GGML_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: AMD64
-- CMAKE_GENERATOR_PLATFORM:
-- Including CPU backend
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")
-- x86 detected
-- Performing Test HAS_AVX_1
-- Performing Test HAS_AVX_1 - Success
-- Performing Test HAS_AVX2_1
-- Performing Test HAS_AVX2_1 - Success
-- Performing Test HAS_FMA_1
-- Performing Test HAS_FMA_1 - Success
-- Performing Test HAS_AVX512_1
-- Performing Test HAS_AVX512_1 - Failed
-- Performing Test HAS_AVX512_2
-- Performing Test HAS_AVX512_2 - Failed
-- Adding CPU backend variant ggml-cpu: /arch:AVX2 GGML_AVX2;GGML_FMA;GGML_F16C
-- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/include (found version "12.6.85")
-- CUDA Toolkit found
-- Using CUDA architectures: native
-- The CUDA compiler identification is NVIDIA 12.6.85
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Including CUDA backend
-- Configuring done (33.7s)
-- Generating done (0.6s)
-- Build files have been written to: C:/Users/Subhodh/Downloads/whisper/whisper.cpp/build

C:\Users\Subhodh\Downloads\whisper\whisper.cpp>cmake --build build -j --config Release
MSBuild version 17.11.2+c078802d4 for .NET Framework

1>Checking Build System
Building Custom Rule C:/Users/Subhodh/Downloads/whisper/whisper.cpp/examples/deprecation-warning/CMakeLists.txt
deprecation-warning.cpp
Building Custom Rule C:/Users/Subhodh/Downloads/whisper/whisper.cpp/ggml/src/CMakeLists.txt
Building Custom Rule C:/Users/Subhodh/Downloads/whisper/whisper.cpp/examples/deprecation-warning/CMakeLists.txt
ggml.c
deprecation-warning.cpp
bench.vcxproj -> C:\Users\Subhodh\Downloads\whisper\whisper.cpp\build\bin\Release\bench.exe
main.vcxproj -> C:\Users\Subhodh\Downloads\whisper\whisper.cpp\build\bin\Release\main.exe
ggml.cpp
ggml-alloc.c
ggml-quants.c
Generating Code...
ggml-backend.cpp
ggml-opt.cpp
ggml-threading.cpp
gguf.cpp
Generating Code...
Creating library C:/Users/Subhodh/Downloads/whisper/whisper.cpp/build/ggml/src/Release/ggml-base.lib and object C:
/Users/Subhodh/Downloads/whisper/whisper.cpp/build/ggml/src/Release/ggml-base.exp
ggml.cpp.obj : error LNK2019: unresolved external symbol ggml_print_backtrace referenced in function "void __cdecl ggml
_uncaught_exception(void)" (?ggml_uncaught_exception@@yaxxz) [C:\Users\Subhodh\Downloads\whisper\whisper.cpp\build\ggml
\src\ggml-base.vcxproj]
C:\Users\Subhodh\Downloads\whisper\whisper.cpp\build\bin\Release\ggml-base.dll : fatal error LNK1120: 1 unresolved exte
rnals [C:\Users\Subhodh\Downloads\whisper\whisper.cpp\build\ggml\src\ggml-base.vcxproj]

Could you please advise if this is a known issue or if there is a recommended fix/workaround? Is there a missing source file or a CMake configuration adjustment needed to properly include the implementation of ggml_print_backtrace?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions