NVIDIA / NVIDIA/AMGX

Link error while building amgx_tests_launcher

Open
#249 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Cuda
Stars
692
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Hi,
I'm using VS2019 and cuda 11.3 to build this project.
My VS version is 14.29.30133, cmake version 3.26.3 and cuda version 11.3.0.

OpenMP could not be found so I set it manually on CMakeLists.txt.

set(OpenMP_CXX_FLAGS "-openmp")
set(OpenMP_C_LIB_NAMES "libomp")
set(OpenMP_C_FLAGS "-openmp")
set(OpenMP_CXX_LIB_NAMES "libomp")
set(OpenMP_libomp_LIBRARY "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/lib/x64/libomp.lib")

And solve the complile error with new version VS and cuda by add this row in src\CmakeLists.txt.

set(CMAKE_CUDA_STANDARD 11)

Then I built the whole project under VS. Link error happened while build amgx_tests_launcher

utest.obj : error LNK2019: 无法解析的外部符号 "public: static void __cdecl amgx::SignalHandler::hook(void)" (?hook@SignalHandler@amgx@@SAXXZ),函数 main 中引用了该符号 [D:\linear_solver\AMGX\cmake-build-release-visual-studio\src\amgx_tests_launcher.vcxproj]
utest.obj : error LNK2019: 无法解析的外部符号 "public: static class amgx::Cusparse & __cdecl amgx::Cusparse::get_instance(void)" (?get_instance@Cusparse@amgx@@SAAEAV12@XZ),函数 main 中引用了该符号 [D:\linear_solver\AMGX\cmake-build-release-visual-studio\src\amgx_tests_launcher.vcxproj]
utest.obj : error LNK2019: 无法解析的外部符号 "void (__cdecl* amgx::amgx_output)(char const *,int)" (?amgx_output@amgx@@3P6AXPEBDH@ZEA),函数 main 中引用了该符号 [D:\linear_solver\AMGX\cmake-build-release-visual-studio\src\amgx_tests_launcher.vcxproj]
utest.obj : error LNK2019: 无法解析的外部符号 "private: static struct cublasContext * amgx::Cublas::m_handle" (?m_handle@Cublas@amgx@@0PEAUcublasContext@@EA),函数 "public: static void __cdecl amgx::Cublas::destroy_handle(void)" (?destroy_handle@Cublas@amgx@@SAXXZ) 中引用了该符号 [D:\linear_solver\AMGX\cmake-build-release-visual-studio\src\amgx_tests_launcher.vcxproj]
testframework.obj : error LNK2019: 无法解析的外部符号 "enum amgx::AMGX_ERROR __cdecl amgx::initialize(void)" (?initialize@amgx@@YA?AW4AMGX_ERROR@1@XZ),函数 "public: int __cdecl amgx::UnitTestDriver::run_tests(class std::vector<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > const &,class std::basic_ostream<char,struct std::char_traits<char> > &)" (?run_tests@UnitTestDriver@amgx@@QEAAHAEBV?$vector@U?$pair@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@V?$allocator@U?$pair@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@std@@AEAV?$basic_ostream@DU?$char_traits@D@std@@@4@@Z) 中引用了该符号 [D:\linear_solver\AMGX\cmake-build-release-visual-studio\src\amgx_tests_launcher.vcxproj]
testframework.obj : error LNK2019: 无法解析的外部符号 "void __cdecl amgx::finalize(void)" (?finalize@amgx@@YAXXZ),函数 "public: int __cdecl amgx::UnitTestDriver::run_tests(class std::vector<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > const &,class std::basic_ostream<char,struct std::char_traits<char> > &)" (?run_tests@UnitTestDriver@amgx@@QEAAHAEBV?$vector@U?$pair@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@V?$allocator@U?$pair@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@std@@AEAV?$basic_ostream@DU?$char_traits@D@std@@@4@@Z) 中引用了该符号 [D:\linear_solver\AMGX\cmake-build-release-visual-studio\src\amgx_tests_launcher.vcxproj]

It seems that the config in Properties->Linker->Input->Additional dependencies is not correct and produce this error.
I need to manually set up the Additional dependencies for amgx.lib and amgxsh.lib.
Don't know if there is a update needed for cmake file ? I'm not very familiar with cmake file.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with CMakeLists.txt and src/CMakeLists.txt, then inspect the generated amgx_tests_launcher.vcxproj target and its linker dependencies. Reproduce the Windows build with the reported Visual Studio and CUDA versions, and verify whether the target links amgx.lib and amgxsh.lib without manually editing Additional Dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.