harvard-acc / LLVM-Tracer

An LLVM pass to profile dynamic LLVM IR instructions and runtime values
Other
135 stars 35 forks source link

error in running triad example (from docker) #36

Closed bigglasses93 closed 4 years ago

bigglasses93 commented 4 years ago

Hello, could you help me with this issue? I pulled the docker image and tried to run the triad test until step e, I put -no-pie into the command but got this error:

root@bddd47a827c8:/workspace/LLVM-Tracer/example/triad# gcc -fno-inline -o triad-instrumented full.s -no-pie /tmp/ccnhs4ab.o: In function create_trace(char const*)': llvm-link:(.text+0x3867): undefined reference tooperator new(unsigned long)' llvm-link:(.text+0x38a0): undefined reference to operator delete(void*)' /tmp/ccnhs4ab.o: In functionwrite_labelmap()': llvm-link:(.text+0x38f8): undefined reference to gzwrite' llvm-link:(.text+0x390e): undefined reference tostd::cxx11::basic_string<char, std::char_traits, std::allocator >::c_str() const' llvm-link:(.text+0x391b): undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::length() const' llvm-link:(.text+0x392c): undefined reference togzwrite' /tmp/ccnhs4ab.o: In function open_trace_file()': llvm-link:(.text+0x39ef): undefined reference tostd::cxx11::basic_string<char, std::char_traits, std::allocator >::c_str() const' llvm-link:(.text+0x3a01): undefined reference to gzopen' /tmp/ccnhs4ab.o: In functionfin_main()': llvm-link:(.text+0x3b7e): undefined reference to gzclose' /tmp/ccnhs4ab.o: In functionfin_toplevel()': llvm-link:(.text+0x3be8): undefined reference to operator delete(void*)' /tmp/ccnhs4ab.o: In functionllvmtracer_set_trace_name': llvm-link:(.text+0x3c2f): undefined reference to `std::cxx11::basic_string<char, std::char_traits, std::allocator >::operator=(char const)' /tmp/ccnhs4ab.o: In function `log_or_not(bool, bool, int, char)': llvm-link:(.text+0x3caf): undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::length() const' llvm-link:(.text+0x3cf1): undefined reference tostd::cxx11::basic_string<char, std::char_traits, std::allocator >::c_str() const' /tmp/ccnhs4ab.o: In function trace_logger_update_status': llvm-link:(.text+0x3ec3): undefined reference tostd::cxx11::basic_string<char, std::char_traits, std::allocator >::c_str() const' llvm-link:(.text+0x3f18): undefined reference to `std::cxx11::basic_string<char, std::char_traits, std::allocator >::c_str() const' llvm-link:(.text+0x3f64): undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::length() const' llvm-link:(.text+0x3f90): undefined reference tostd::cxx11::basic_string<char, std::char_traits, std::allocator >::operator=(char const*)' llvm-link:(.text+0x3fc2): undefined reference to `std::cxx11::basic_string<char, std::char_traits, std::allocator >::operator=(char const)' /tmp/ccnhs4ab.o: In function trace_logger_log_entry': llvm-link:(.text+0x4075): undefined reference togzprintf' /tmp/ccnhs4ab.o: In function trace_logger_log0': llvm-link:(.text+0x4108): undefined reference togzprintf' /tmp/ccnhs4ab.o: In function trace_logger_log_int': llvm-link:(.text+0x41bc): undefined reference togzprintf' llvm-link:(.text+0x41e1): undefined reference to gzprintf' llvm-link:(.text+0x4209): undefined reference togzprintf' /tmp/ccnhs4ab.o:llvm-link:(.text+0x422d): more undefined references to gzprintf' follow /tmp/ccnhs4ab.o: In functionwrite_labelmap()': llvm-link:(.text+0x3949): undefined reference to gzwrite' /tmp/ccnhs4ab.o: In functiontrace_logger_register_labelmap': llvm-link:(.text+0x3aa3): undefined reference to `std::__cxx11::basic_string<char, std::char_traits, std::allocator >::assign(char const, unsigned long)' /tmp/ccnhs4ab.o: In function __cxx_global_var_init.1': llvm-link:(.text.startup+0x3c): undefined reference tostd::cxx11::basic_string<char, std::char_traits, std::allocator >::basic_string()' /tmp/ccnhs4ab.o: In function __dtor__Z12labelmap_strB5cxx11': llvm-link:(.text.startup+0x5d): undefined reference tostd::cxx11::basic_string<char, std::char_traits, std::allocator >::~basic_string()' /tmp/ccnhs4ab.o: In function __clang_call_terminate': llvm-link:(.text.__clang_call_terminate[__clang_call_terminate]+0x9): undefined reference tocxa_begin_catch' llvm-link:(.text.clang_call_terminate[clang_call_terminate]+0x12): undefined reference to std::terminate()' /tmp/ccnhs4ab.o: In functiongnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s*> > >::deallocate(std::_Rb_tree_node<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s> >, unsigned long)': llvm-link:(.text._ZN9gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEEE10deallocateEPSD_m[_ZN9gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEEE10deallocateEPSD_m]+0x11): undefined reference to operator delete(void*)' /tmp/ccnhs4ab.o: In functionstd::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s>::~pair()': llvm-link:(.text._ZNSt4pairIKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sED2Ev[_ZNSt4pairIKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sED2Ev]+0x6): undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' /tmp/ccnhs4ab.o: In functiontrace_info::trace_info(char const)': llvm-link:(.text._ZN10trace_infoC2EPKc[_ZN10trace_infoC2EPKc]+0x1c): undefined reference to std::allocator<char>::allocator()' llvm-link:(.text._ZN10trace_infoC2EPKc[_ZN10trace_infoC2EPKc]+0x2d): undefined reference tostd::cxx11::basic_string<char, std::char_traits, std::allocator >::basic_string(char const*, std::allocator const&)' llvm-link:(.text._ZN10trace_infoC2EPKc[_ZN10trace_infoC2EPKc]+0x38): undefined reference to std::allocator<char>::~allocator()' llvm-link:(.text._ZN10trace_infoC2EPKc[_ZN10trace_infoC2EPKc]+0x4d): undefined reference tostd::__cxx11::basic_string<char, std::char_traits, std::allocator >::basic_string()' llvm-link:(.text._ZN10trace_infoC2EPKc[_ZN10trace_infoC2EPKc]+0x70): undefined reference to std::allocator<char>::~allocator()' /tmp/ccnhs4ab.o: In functionstd::map<std::cxx11::basic_string<char, std::char_traits, std::allocator >, gzFile_s, std::less<std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s> > >::at(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)': llvm-link:(.text._ZNSt3mapINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sSt4lessIS5_ESaISt4pairIKS5_S7EEE2atERSB[_ZNSt3mapINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sSt4lessIS5_ESaISt4pairIKS5_S7EEE2atERSB]+0x7a): undefined reference to `std::throw_out_of_range(char const)' /tmp/ccnhs4ab.o: In function `std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s> > std::_Rb_tree<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s> >, std::less<std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s> > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<std::cxx11::basic_string<char, std::char_traits, std::allocator > const&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s> >, std::piecewise_construct_t const&, std::tuple<std::cxx11::basic_string<char, std::char_traits, std::allocator > const&>&&, std::tuple<>&&)': llvm-link:(.text._ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEESt17_Rb_tree_iteratorISA_ESt23_Rb_tree_const_iteratorISAEDpOT[_ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEESt17_Rb_tree_iteratorISA_ESt23_Rb_tree_const_iteratorISAEDpOT]+0xbc): undefined reference to __cxa_begin_catch' llvm-link:(.text._ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEESt17_Rb_tree_iteratorISA_ESt23_Rb_tree_const_iteratorISA_EDpOT_[_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEESt17_Rb_tree_iteratorISA_ESt23_Rb_tree_const_iteratorISA_EDpOT_]+0xd2): undefined reference tocxa_rethrow' llvm-link:(.text._ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEESt17_Rb_tree_iteratorISA_ESt23_Rb_tree_const_iteratorISAEDpOT[_ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE22_M_emplace_hint_uniqueIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEESt17_Rb_tree_iteratorISA_ESt23_Rb_tree_const_iteratorISAEDpOT]+0x114): undefined reference to `cxa_end_catch' /tmp/ccnhs4ab.o: In function std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, gzFile_s*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, gzFile_s*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, gzFile_s*> > >::_M_insert_node(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, gzFile_s*> >*)': llvm-link:(.text._ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE14_M_insert_nodeEPSt18_Rb_tree_node_baseSI_PSt13_Rb_tree_nodeISA_E[_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE14_M_insert_nodeEPSt18_Rb_tree_node_baseSI_PSt13_Rb_tree_nodeISA_E]+0x78): undefined reference tostd::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base, std::_Rb_tree_node_base, std::_Rb_tree_node_base&)' /tmp/ccnhs4ab.o: In function std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, gzFile_s*> >::operator--()': llvm-link:(.text._ZNSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEEmmEv[_ZNSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEEmmEv]+0x13): undefined reference tostd::_Rb_tree_decrement(std::_Rb_tree_node_base)' /tmp/ccnhs4ab.o: In function `std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s> >::operator++()': llvm-link:(.text._ZNSt17_Rb_tree_iteratorISt4pairIKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEEppEv[_ZNSt17_Rb_tree_iteratorISt4pairIKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEEppEv]+0x13): undefined reference to std::_Rb_tree_increment(std::_Rb_tree_node_base*)' /tmp/ccnhs4ab.o: In functionvoid std::_Rb_tree<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s*>, std::_Select1st<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s*> >, std::less<std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s*> > >::_M_construct_node<std::piecewise_construct_t const&, std::tuple<std::cxx11::basic_string<char, std::char_traits, std::allocator > const&>, std::tuple<> >(std::_Rb_tree_node<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s> >, std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&>&&, std::tuple<>&&)': llvm-link:(.text._ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEEvPSt13_Rb_tree_nodeISAEDpOT[_ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEEvPSt13_Rb_tree_nodeISAEDpOT]+0x77): undefined reference to `cxa_begin_catch' llvm-link:(.text._ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEEvPSt13_Rb_tree_nodeISAEDpOT[_ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEEvPSt13_Rb_tree_nodeISAEDpOT]+0x8d): undefined reference to `cxa_rethrow' llvm-link:(.text._ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEEvPSt13_Rb_tree_nodeISAEDpOT[_ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P8gzFile_sESt10_Select1stISA_ESt4lessIS5_ESaISA_EE17_M_construct_nodeIJRKSt21piecewise_construct_tSt5tupleIJRS7_EESL_IJEEEEEvPSt13_Rb_tree_nodeISAEDpOT]+0x9d): undefined reference to __cxa_end_catch' /tmp/ccnhs4ab.o: In functionstd::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s*>::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, 0ul>(std::tuple<std::cxx11::basic_string<char, std::char_traits, std::allocator > const&>&, std::tuple<>&, std::_Index_tuple<0ul>, std::_Index_tuple<>)': llvm-link:(.text._ZNSt4pairIKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEC2IJRS6_EJLm0EEJEJEEERSt5tupleIJDpT_EERSC_IJDpT1_EESt12_Index_tupleIJXspT0_EEESL_IJXspT2_EEE[_ZNSt4pairIKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEC2IJRS6_EJLm0EEJEJEEERSt5tupleIJDpT_EERSC_IJDpT1_EESt12_Index_tupleIJXspT0_EEESL_IJXspT2_EEE]+0x28): undefined reference to `std::cxx11::basic_string<char, std::char_traits, std::allocator >::basic_string(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)' /tmp/ccnhs4ab.o: In function `gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, gzFile_s> > >::allocate(unsigned long, void const)': llvm-link:(.text._ZN9gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEEE8allocateEmPKv[_ZN9gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEEE8allocateEmPKv]+0x1f): undefined reference to `std::__throw_bad_alloc()' llvm-link:(.text._ZN9gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEEE8allocateEmPKv[_ZN9gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP8gzFile_sEEE8allocateEmPKv]+0x35): undefined reference to operator new(unsigned long)' /tmp/ccnhs4ab.o: In functionbool std::operator< <char, std::char_traits, std::allocator >(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)': llvm-link:(.text._ZStltIcSt11char_traitsIcESaIcEEbRKNSt7cxx1112basic_stringIT_T0_T1EESA[_ZStltIcSt11char_traitsIcESaIcEEbRKNSt7cxx1112basic_stringIT_T0_T1EESA]+0x9): undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' /tmp/ccnhs4ab.o: In functiontrace_info::~trace_info()': llvm-link:(.text._ZN10trace_infoD2Ev[_ZN10trace_infoD2Ev]+0x17): undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' llvm-link:(.text._ZN10trace_infoD2Ev[_ZN10trace_infoD2Ev]+0x28): undefined reference tostd::cxx11::basic_string<char, std::char_traits, std::allocator >::~basic_string()' /tmp/ccnhs4ab.o:(.eh_frame+0x137): undefined reference to `__gxx_personality_v0' collect2: error: ld returned 1 exit status

xyzsam commented 4 years ago

Did you get this resolved? If so, could you post your resolution for future users? I was going to look into this if it was still an issue.

bigglasses93 commented 4 years ago

From the docker image that I pulled, I still got the above issue and could not resolve. Then I tried to build from github source code and could see the generated output files.

xyzsam commented 4 years ago

So the solution was just that you needed to pull the latest source code? That is an expected step - the docker image only provides you the dependencies needed, but it's not practical for us to update the image on every commit.

bigglasses93 commented 4 years ago

yes, however I suppose docker should be a stable version, but it seems to contain some bugs.

pengfeix commented 4 years ago

Maybe you can use g++ -fno-inline -o triad-instrumented full.s -lm -lz -no-pie to resolve it.