llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

Build error at server.cpp: undefined reference to `json_schema_to_grammar

Open zengjice opened this issue 2 years ago • 8 comments

Code

  • tag: b2835
  • commit: eaf4bd8b399a6ed4b834f91d22409d2a05c4d266

Build command:

cmake -DLLAMA_CUDA=on -DCMAKE_CXX_COMPILER_WORKS=TRUE -DCMAKE_C_COMPILER_WORKS=TRUE -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. && cmake --build . --config Release -t server

Log

-- The C compiler identification is GNU 8.5.0
-- The CXX compiler identification is GNU 8.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/app/anaconda3/envs/jarvis-humming/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: /home/app/anaconda3/envs/jarvis-humming/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "1.8.3.1") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Found CUDAToolkit: /usr/local/cuda/include (found version "12.2.91") 
-- CUDA found
-- The CUDA compiler identification is NVIDIA 12.2.91
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Using CUDA architectures: 52;61;70
-- CUDA host compiler is GNU 8.5.0

-- Warning: ccache not found - consider installing it for faster compilation or disable this warning with LLAMA_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected

...

[ 65%] Built target ggml
[ 65%] Building CXX object CMakeFiles/llama.dir/llama.cpp.o
[ 68%] Building CXX object CMakeFiles/llama.dir/unicode.cpp.o
[ 68%] Building CXX object CMakeFiles/llama.dir/unicode-data.cpp.o
[ 72%] Linking CXX static library libllama.a
[ 72%] Built target llama
[ 75%] Building CXX object common/CMakeFiles/common.dir/common.cpp.o
[ 75%] Building CXX object common/CMakeFiles/common.dir/sampling.cpp.o
[ 79%] Building CXX object common/CMakeFiles/common.dir/console.cpp.o
[ 82%] Building CXX object common/CMakeFiles/common.dir/grammar-parser.cpp.o
[ 82%] Building CXX object common/CMakeFiles/common.dir/json-schema-to-grammar.cpp.o
[ 86%] Building CXX object common/CMakeFiles/common.dir/train.cpp.o
[ 86%] Building CXX object common/CMakeFiles/common.dir/ngram-cache.cpp.o
[ 89%] Linking CXX static library libcommon.a
[ 89%] Built target common
[ 93%] Generating json-schema-to-grammar.mjs.hpp
[ 93%] Generating completion.js.hpp
[ 93%] Generating index.html.hpp
[ 96%] Generating index.js.hpp
[100%] Building CXX object examples/server/CMakeFiles/server.dir/server.cpp.o
[100%] Linking CXX executable ../../bin/server
/data/home/app/anaconda3/envs/jarvis-humming/bin/../lib/gcc/x86_64-conda-linux-gnu/8.5.0/../../../../x86_64-conda-linux-gnu/bin/ld: CMakeFiles/server.dir/server.cpp.o: in function `server_context::launch_slot_with_task(server_slot&, server_task const&)':
server.cpp:(.text._ZN14server_context21launch_slot_with_taskER11server_slotRK11server_task[_ZN14server_context21launch_slot_with_taskER11server_slotRK11server_task]+0x15de): undefined reference to `json_schema_to_grammar(nlohmann::json_abi_v3_11_2::basic_json<nlohmann::json_abi_v3_11_2::ordered_map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&)'
collect2: error: ld returned 1 exit status
gmake[3]: *** [bin/server] Error 1
gmake[2]: *** [examples/server/CMakeFiles/server.dir/all] Error 2
gmake[1]: *** [examples/server/CMakeFiles/server.dir/rule] Error 2
gmake: *** [server] Error 2

zengjice avatar May 10 '24 01:05 zengjice

Can you compile the commit tagged b2820 successfully? If yes the issue is likely caused by https://github.com/ggerganov/llama.cpp/pull/7143 .

JohannesGaessler avatar May 10 '24 06:05 JohannesGaessler

Can you compile the commit tagged b2820 successfully? If yes the issue is likely caused by #7143 .

It's the same error.

zengjice avatar May 10 '24 11:05 zengjice

Can you compile the commit tagged b2820 successfully? If yes the issue is likely caused by #7143 .

Thanks it worked! you saved my day!

Jamal-Alkelani avatar May 13 '24 00:05 Jamal-Alkelani

@slaren do you know what could be causing the build issues?

JohannesGaessler avatar May 13 '24 07:05 JohannesGaessler

by the way, the error in question occurred during the build process on a v100. the build would be successful if conducted on a Mac

zengjice avatar May 13 '24 07:05 zengjice

Probably a toolchain issue that could be fixed by using a more recent version.

slaren avatar May 13 '24 09:05 slaren

By the way, it appears an issue in the following modules @slaren @JohannesGaessler

  • llama.o:llama.cpp
  • common.o:common.cpp
  • json-schema-to-grammar.o:json-schema-to-grammar.cpp

All of them show the following error

C:/w64devkit/bin/ld.exe: {MODULE_NAME}:(.text$_ZNSt23_Sp_counted_ptr_inplaceIN8nlohmann16json_abi_v3_11_36detail21output_string_adapterIcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaIvELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceIN8nlohmann16json_abi_v3_11_36detail21output_string_adapterIcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaIvELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0x23): more undefined references to `std::type_info::operator==(std::type_info const&) const' follow collect2.exe: error: ld returned 1 exit status

Following are the command execution params

c++ -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -Xassembler -muse-unaligned-vector-move -march=native -mtune=native -Wno-array-bounds -Wno-format-truncation -Wextra-semi -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -D_WIN32_WINNT=0x602 -DGGML_USE_LLAMAFILE ggml.o llama.o common.o sampling.o grammar-parser.o build-info.o json-schema-to-grammar.o console.o sgemm.o ggml-alloc.o ggml-backend.o ggml-quants.o unicode.o unicode-data.o examples/main/main.o -o main

Jamal-Alkelani avatar May 13 '24 09:05 Jamal-Alkelani

The issue has been resolved. It was due to my use of rsync to synchronize code files, but there were some residual files that led to a compilation error. Thank you all.

zengjice avatar May 13 '24 13:05 zengjice