Re: [deal.II] Adding new obj target
Thanks Wolfgang, I think you are correct! I just tried to use petsc_full_matrix instead and it linked no problem! On Monday, November 9, 2020 at 5:25:30 PM UTC-6 Wolfgang Bangerth wrote: > On 11/9/20 2:49 PM, Daniel Arndt wrote: > > > > Undefined symbols for architecture x86_64: > > "dealii::PETScWrappers::SparseMatrix::SparseMatrix(int const&, > bool)", > > referenced from: > > There is no such function -- the linker tells you that, but it's unclear > to me > how it is referenced in test::Operator::Operator(int const &). > > I think that what is happening is that you are trying to call > template > explicit SparseMatrix(const SparsityPatternType _pattern, > const bool preset_nonzero_locations = true); > with an int instead of a sparsity pattern as first argument. That's not > going > to work. > > Best > W. > -- > > Wolfgang Bangerth email: bang...@colostate.edu > www: http://www.math.colostate.edu/~bangerth/ > > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/ab604e0a-80a7-48ce-a838-979037ef8eban%40googlegroups.com.
Re: [deal.II] Adding new obj target
On 11/9/20 2:49 PM, Daniel Arndt wrote: Undefined symbols for architecture x86_64: "dealii::PETScWrappers::SparseMatrix::SparseMatrix(int const&, bool)", referenced from: There is no such function -- the linker tells you that, but it's unclear to me how it is referenced in test::Operator::Operator(int const &). I think that what is happening is that you are trying to call template explicit SparseMatrix(const SparsityPatternType _pattern, const bool preset_nonzero_locations = true); with an int instead of a sparsity pattern as first argument. That's not going to work. Best W. -- Wolfgang Bangerth email: bange...@colostate.edu www: http://www.math.colostate.edu/~bangerth/ -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/3f32ee67-f971-7d89-676c-f43e7c6ebaf1%40colostate.edu.
Re: [deal.II] Adding new obj target
Ah sorry, yes I have done that already. Sorry for forgetting that detail... If it should work assuming I have added my new directory in source/CMakeLists.txt, maybe my implementation is the problem. Though, I wouldn't know why since it fails at linking. On Monday, November 9, 2020 at 3:49:21 PM UTC-6 d.arnd...@gmail.com wrote: > Zachary, > > You also need to make sure that CMake actually sees that your new source > directory. In particular, you should add a line saying > > ADD_SUBDIRECTORY(Test) > > to source/CMakeLists.txt. > > Best, > Daniel > > Am Mo., 9. Nov. 2020 um 11:35 Uhr schrieb Zachary 42! < > zachary...@gmail.com>: > >> Hi folks, >> >> I am trying to add another include/source directory and subsequent obj to >> dealii for potential future contributions to dealii. Though I am having >> linking errors because my new obj needs to link agains the lac_obj (need >> Trilinos and other interfaces). I thought the ADD_DEPENDICIES in the >> source/CMakeLists.txt file is where this is taking care of but apparently >> not. I am following the exact same CMakeLists.txt files as in the other >> source/dirs but I am still getting the undefined symbols error due to >> object targets not apparently linking together. >> >> [ 80%] Linking CXX shared library ../lib/libdealii.dylib >> Undefined symbols for architecture x86_64: >> "dealii::PETScWrappers::SparseMatrix::SparseMatrix(int const&, >> bool)", referenced from: >> test::Operator::Operator(int const&) in Operator.cc.o >> test::Operator::Operator(int const&, std::__1::basic_string> std::__1::char_traits, std::__1::allocator > const&) in >> Operator.cc.o >> ld: symbol(s) not found for architecture x86_64 >> >> So looks like the obj_lac needs to link with the obj_test and it doesn’t >> appear to be… >> >> Here is my source/Test/CMakeLists.txt file which builds fine: >> >> INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) >> >> SET(_src >> Operator.cc >> ) >> >> SET(_n_includes_per_unity_file 20) >> >> IF(DEAL_II_UNITY_BUILD) >> LIST(SORT _unity_include_src) >> ENDIF() >> >> SETUP_SOURCE_LIST("${_unity_include_src}" >> "${_separate_src}" >> ${_n_includes_per_unity_file} >> _src >> ) >> >> FILE(GLOB _header >> ${CMAKE_SOURCE_DIR}/include/test/*.h >> ) >> >> DEAL_II_ADD_LIBRARY(obj_test OBJECT ${_src} ${_header}) >> >> I didn’t change anything in the souce/CMakeLists.txt file. >> >> -- >> The deal.II project is located at http://www.dealii.org/ >> For mailing list/forum options, see >> https://groups.google.com/d/forum/dealii?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "deal.II User Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to dealii+un...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/dealii/DE13C37A-F916-4295-AE97-685F856C5291%40gmail.com >> . >> > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/2a6875d0-e597-46ad-9fd3-fa4b24e6ff0cn%40googlegroups.com.
Re: [deal.II] Adding new obj target
Zachary, You also need to make sure that CMake actually sees that your new source directory. In particular, you should add a line saying ADD_SUBDIRECTORY(Test) to source/CMakeLists.txt. Best, Daniel Am Mo., 9. Nov. 2020 um 11:35 Uhr schrieb Zachary 42! < zacharyloui...@gmail.com>: > Hi folks, > > I am trying to add another include/source directory and subsequent obj to > dealii for potential future contributions to dealii. Though I am having > linking errors because my new obj needs to link agains the lac_obj (need > Trilinos and other interfaces). I thought the ADD_DEPENDICIES in the > source/CMakeLists.txt file is where this is taking care of but apparently > not. I am following the exact same CMakeLists.txt files as in the other > source/dirs but I am still getting the undefined symbols error due to > object targets not apparently linking together. > > [ 80%] Linking CXX shared library ../lib/libdealii.dylib > Undefined symbols for architecture x86_64: > "dealii::PETScWrappers::SparseMatrix::SparseMatrix(int const&, > bool)", referenced from: > test::Operator::Operator(int const&) in Operator.cc.o > test::Operator::Operator(int const&, std::__1::basic_string std::__1::char_traits, std::__1::allocator > const&) in > Operator.cc.o > ld: symbol(s) not found for architecture x86_64 > > So looks like the obj_lac needs to link with the obj_test and it doesn’t > appear to be… > > Here is my source/Test/CMakeLists.txt file which builds fine: > > INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) > > SET(_src > Operator.cc > ) > > SET(_n_includes_per_unity_file 20) > > IF(DEAL_II_UNITY_BUILD) > LIST(SORT _unity_include_src) > ENDIF() > > SETUP_SOURCE_LIST("${_unity_include_src}" > "${_separate_src}" > ${_n_includes_per_unity_file} > _src > ) > > FILE(GLOB _header > ${CMAKE_SOURCE_DIR}/include/test/*.h > ) > > DEAL_II_ADD_LIBRARY(obj_test OBJECT ${_src} ${_header}) > > I didn’t change anything in the souce/CMakeLists.txt file. > > -- > The deal.II project is located at http://www.dealii.org/ > For mailing list/forum options, see > https://groups.google.com/d/forum/dealii?hl=en > --- > You received this message because you are subscribed to the Google Groups > "deal.II User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to dealii+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/dealii/DE13C37A-F916-4295-AE97-685F856C5291%40gmail.com > . > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/CAOYDWb%2Bt10X7z8k%3DyWj2yxMRAhDmdvhTOi1%2B9We%2B%2BAu4%3D-w-iw%40mail.gmail.com.