Unable to build any application that uses yaml-cpp, linker errors

オープン
#1,219 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cmake, cpp
領域
build-system

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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)
主要言語
C++
スター
6.1k
フォーク
2.2k
平均マージ
22時間 2分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

jbeder/yaml-cpp のほかの issue

jbeder/yaml-cpp の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。