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

Link error while building amgx_tests_launcher #249

Open
KagamineLenOffical opened this issue May 18, 2023 · 2 comments
Open

Link error while building amgx_tests_launcher #249

KagamineLenOffical opened this issue May 18, 2023 · 2 comments

Comments

@KagamineLenOffical
Copy link

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.

@wanjunling168
Copy link

wanjunling168 commented Jul 27, 2023

just add amgx here(L112) in src/CMakeLists.txt:

target_link_libraries(amgx_tests_launcher amgx amgxsh ${libs_all} OpenMP::OpenMP_C)

and everything is OK (at least for my no-MPI build)

@NBickford-NV
Copy link
Contributor

Hi @KagamineLenOffical! I think I've integrated a version of @wanjunling168's fix in 1470501 -- could you pull the latest version and see if it works? Thanks!

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

No branches or pull requests

3 participants