lsils / mockturtle

C++ logic network library
MIT License
210 stars 139 forks source link

multiple definition #525

Closed Flians closed 2 years ago

Flians commented 2 years ago

When I use mockturtle as a library in my project, I meet a problem about "multiple definition", can you help me?

../aqfp/libscflow.a(MajOpt.cpp.o): In function `mockturtle::generate_aqfp_dags(mockturtle::dag_generator_params const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)':
~/SCFlow/third-party/mockturtle/include/mockturtle/algorithms/aqfp_resynthesis/detail/db_utils.hpp:51: multiple definition of `mockturtle::generate_aqfp_dags(mockturtle::dag_generator_params const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'
../aqfp/libscflow.a(Synthesis.cpp.o):~/SCFlow/third-party/mockturtle/include/mockturtle/algorithms/aqfp_resynthesis/detail/db_utils.hpp:51: first defined here
../aqfp/libscflow.a(MajOpt.cpp.o): In function `mockturtle::compute_aqfp_dag_costs(std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)':
~/SCFlow/third-party/mockturtle/include/mockturtle/algorithms/aqfp_resynthesis/detail/db_utils.hpp:95: multiple definition of `mockturtle::compute_aqfp_dag_costs(std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'
../aqfp/libscflow.a(Synthesis.cpp.o):~/SCFlow/third-party/mockturtle/include/mockturtle/algorithms/aqfp_resynthesis/detail/db_utils.hpp:95: first defined here
../aqfp/libscflow.a(MajOpt.cpp.o): In function `mockturtle::generate_aqfp_db(std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)':
~/SCFlow/third-party/mockturtle/include/mockturtle/algorithms/aqfp_resynthesis/detail/db_utils.hpp:155: multiple definition of `mockturtle::generate_aqfp_db(std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'
../aqfp/libscflow.a(Synthesis.cpp.o):~/SCFlow/third-party/mockturtle/include/mockturtle/algorithms/aqfp_resynthesis/detail/db_utils.hpp:155: first defined here
../aqfp/libscflow.a(MajOpt.cpp.o): In function `mockturtle::generate_aqfp_db(mockturtle::dag_generator_params const&, std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)':
~/SCFlow/third-party/mockturtle/include/mockturtle/algorithms/aqfp_resynthesis/detail/db_utils.hpp:264: multiple definition of `mockturtle::generate_aqfp_db(mockturtle::dag_generator_params const&, std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::unordered_map<unsigned int, double, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'
../aqfp/libscflow.a(Synthesis.cpp.o):~/SCFlow/third-party/mockturtle/include/mockturtle/algorithms/aqfp_resynthesis/detail/db_utils.hpp:264: first defined here
../aqfp/libscflow.a(MajOpt.cpp.o): In function `mockturtle::self_dualize_aig(mockturtle::aig_network const&)':
~/SCFlow/third-party/mockturtle/include/mockturtle/generators/self_dualize.hpp:57: multiple definition of `mockturtle::self_dualize_aig(mockturtle::aig_network const&)'
../aqfp/libscflow.a(Synthesis.cpp.o):~/SCFlow/third-party/mockturtle/include/mockturtle/generators/self_dualize.hpp:57: first defined here
collect2: error: ld returned 1 exit status
hriener commented 2 years ago

There is an inline missing on these functions.

Flians commented 2 years ago

There is an inline missing on these functions.

Thank you. The program can work normally after adding inline. But why dont you add inline into mockturtle?

hriener commented 2 years ago

It's a bug on our side that we will fix. Thank you for reporting it!

These errors slip through because in mockturlte's build process we do not use multiple object files such that we often do not notice this type of problem until someone reports it.

Flians commented 2 years ago

Thank you very much for your contribution to logic synthesis, which has brought us a lot of conveniences.