[cfe-dev] Troubles building libcxx from svn source

Jonathan Roelofs via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 11 09:53:08 PDT 2017



On 10/11/17 7:36 AM, Derrick Johnson via cfe-dev wrote:
> up vote0down votefavorite 
> <https://stackoverflow.com/questions/46687323/linker-errors-building-libcxx-on-fresh-ubuntu-install#>
> <https://stackoverflow.com/questions/46687323/linker-errors-building-libcxx-on-fresh-ubuntu-install#>
> 	
> 
> The directions I followed are here: 
> https://clang.llvm.org/get_started.html (steps 1-7, including the 
> optional ones).
> 
> I was very careful to type everything EXACTLY as specified (so all 
> projects are in the correct directories).
> 
> After I ran 'cmake', everything looked fine, no error messages.
> 
> But when I try to build with 'make', when it gets to libcxx it has 
> linker errors:
> 
> |. . . [100%] Built target cxx_objects [100%] Linking CXX shared library 
> ../../../lib/libc++.so CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: 
> In function `std::__1::(anonymous 
> namespace)::__throw_runtime_error(std::__1::basic_string<char, 
> std::__1::char_traits<char>, std::__1::allocator<char> > const&)': 
> locale.cpp:(.text.unlikely._ZNSt3__112_GLOBAL__N_1L21__throw_runtime_errorERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+0xf): 
> undefined reference to `__cxa_allocate_exception' 
> locale.cpp:(.text.unlikely._ZNSt3__112_GLOBAL__N_1L21__throw_runtime_errorERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+0x33): 
> undefined reference to `__cxa_throw' 
> locale.cpp:(.text.unlikely._ZNSt3__112_GLOBAL__N_1L21__throw_runtime_errorERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+0x3e): 
> undefined reference to `__cxa_free_exception' 
> CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function 
> `std::__1::ctype_byname<wchar_t>::do_widen(char) const': 
> locale.cpp:(.text._ZNKSt3__112ctype_bynameIwE8do_widenEc+0x43): 
> undefined reference to `__cxa_call_unexpected' 
> CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function 
> `std::__1::ctype_byname<wchar_t>::do_widen(char const*, char const*, 
> wchar_t*) const': 
> locale.cpp:(.text._ZNKSt3__112ctype_bynameIwE8do_widenEPKcS3_Pw+0x7a): 
> undefined reference to `__cxa_call_unexpected' 
> CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function 
> `std::__1::ctype_byname<wchar_t>::do_narrow(wchar_t, char) const': 
> locale.cpp:(.text._ZNKSt3__112ctype_bynameIwE9do_narrowEwc+0x46): 
> undefined reference to `__cxa_call_unexpected' 
> CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function 
> `std::__1::ctype_byname<wchar_t>::do_narrow(wchar_t const*, wchar_t 
> const*, char, char*) const': 
> locale.cpp:(.text._ZNKSt3__112ctype_bynameIwE9do_narrowEPKwS3_cPc+0x8d): 
> undefined reference to `__cxa_call_unexpected' 
> CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function 
> `std::__1::locale::__imp::use_facet(long) const [clone .part.18]': 
> locale.cpp:(.text.unlikely._ZNKSt3__16locale5__imp9use_facetEl.part.18+0x7): 
> undefined reference to `__cxa_allocate_exception' 
> locale.cpp:(.text.unlikely._ZNKSt3__16locale5__imp9use_facetEl.part.18+0x28): 
> undefined reference to `__cxa_throw' 
> CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function 
> `std::__1::__time_get_c_storage<char>::__weeks() const': 
> locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE7__weeksEv+0x21): 
> undefined reference to `__cxa_guard_acquire' 
> locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE7__weeksEv+0x167): 
> undefined reference to `__cxa_guard_release' 
> locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE7__weeksEv+0x178): 
> undefined reference to `__cxa_guard_acquire' 
> locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE7__weeksEv+0x35a): 
> undefined reference to `__cxa_guard_release' 
> locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE7__weeksEv+0x383): 
> undefined reference to `__cxa_guard_abort' . . . |'

These missing symbols are things from the c++ abi library, i.e. either 
libcxxabi, libcxxrt, or libsupc++, depending on your platform.


Jon

> 
> Fresh Ubuntu 17.04 install (X86) with the preinstalled gcc being used to 
> build.
> 
> (neither clang nor libc++ are present in the default 17.04 release).
> 
> 
> ------------------------------------------------------------------------
> 
> This message is intended only for the use of the individual or entity to 
> which it is addressed, and may contain private and confidential 
> information. If you are not the intended recipient of this message you 
> are hereby notified that any review, dissemination, distribution or 
> copying of this message is strictly prohibited. If you have received 
> this e-mail in error, please immediately notify the sender by replying 
> to this e-mail and delete the message and any attachment(s) from your 
> system. This communication is for information purposes only and should 
> not be regarded as an offer to sell or as a solicitation of an offer to 
> buy any financial product, an official confirmation of any transaction, 
> or as an official statement of Trexquant Investment LP. All information 
> is subject to change without notice.
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> 

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded / Siemens



More information about the cfe-dev mailing list