Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jarviszeng-zjc opened this issue May 10, 2024 · 8 comments

Comments

@jarviszeng-zjc
Copy link

jarviszeng-zjc commented May 10, 2024

Code

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
@JohannesGaessler
Copy link
Collaborator

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

@jarviszeng-zjc
Copy link
Author

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

It's the same error.

@Jamal-Alkelani
Copy link

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

Thanks it worked! you saved my day!

@JohannesGaessler
Copy link
Collaborator

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

@jarviszeng-zjc
Copy link
Author

jarviszeng-zjc commented May 13, 2024

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

@slaren
Copy link
Collaborator

slaren commented May 13, 2024

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

@Jamal-Alkelani
Copy link

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

@jarviszeng-zjc
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants