Unable to build any application that uses yaml-cpp, linker errors
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cmake, cpp
- Domain
- build-system
Research direction
Start by reading the CMakeLists.txt in the issue and checking how yaml-cpp is found and linked against the application. Reproduce the undefined references with the shown linker output, then verify that the application links the matching yaml-cpp library; done when the build completes without those unresolved symbols.
Written by the indexing model from the issue text.
Description
I am building an application that uses yaml-cpp but I get these errors:
/usr/bin/ld: CMakeFiles/transcribe.dir/transcribe.cpp.o: in function `returnVocabulary(std::string const&)':
transcribe.cpp:(.text+0x55786): undefined reference to `YAML::LoadFile(std::string const&)'
/usr/bin/ld: CMakeFiles/transcribe.dir/transcribe.cpp.o: in function `YAML::detail::node_ref::set_scalar(std::string const&)':
transcribe.cpp:(.text._ZN4YAML6detail8node_ref10set_scalarERKSs[_ZN4YAML6detail8node_ref10set_scalarERKSs]+0x2e): undefined reference to `YAML::detail::node_data::set_scalar(std::string const&)'
/usr/bin/ld: CMakeFiles/transcribe.dir/transcribe.cpp.o: in function `YAML::Node::Scalar() const':
transcribe.cpp:(.text._ZNK4YAML4Node6ScalarEv[_ZNK4YAML4Node6ScalarEv]+0x7d): undefined reference to `YAML::detail::node_data::empty_scalar()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/transcribe.dir/build.make:113: transcribe] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/transcribe.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
My CMakeLists.txt is as follows:
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(transcribe)
include_directories(
${CMAKE_SOURCE_DIR}
/home/divyansh/Documents/onnxruntime-linux-x64-gpu-1.15.1/include
${CMAKE_SOURCE_DIR}/yaml-cpp/include/yaml-cpp
)
link_directories(/home/divyansh/Documents/onnxruntime-linux-x64-gpu-1.15.1/lib
${CMAKE_SOURCE_DIR}/yaml-cpp/build
)
set(Torch_DIR /home/divyansh/.local/lib/python3.10/site-packages/torch/share/cmake/Torch)
find_package(Torch REQUIRED)
find_package(yaml-cpp REQUIRED)
link_libraries(${CMAKE_SOURCE_DIR}/yaml-cpp/build/libyaml-cpp.a)
add_executable(transcribe transcribe.cpp)
target_link_libraries(transcribe PRIVATE "${TORCH_LIBRARIES}" onnxruntime yaml-cpp)
set_property(TARGET transcribe PROPERTY CXX_STANDARD 17)
- Dominant language
- C++
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 22h 2m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jbeder/yaml-cpp
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
-
Difficulty 3/5 Half a day Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
NVIDIA-RTX/NRI#307 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
eclipse-score/lifecycle#929 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day