[cfe-dev] Troubles building libcxx from svn source

Derrick Johnson via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 11 10:07:54 PDT 2017


After digging through makefiles, the issue is that on a new Linux install
there is only libstdc++, and the CMakeLists file was sticking
-nodefaultlibs in the link instructions.

So no c++ abi was present as you pointed out Jon (and that you for taking
the time to respond, I appreciate it!)

Adding -DLIBCXX_CXX_ABI=libstdc++ to the top-level cmake invocation seems
to have fixed the problem; I'm building now so we'll see.

On Wed, Oct 11, 2017 at 12:53 PM, Jonathan Roelofs <
jonathan at codesourcery.com> wrote:

>
>
> On 10/11/17 7:36 AM, Derrick Johnson via cfe-dev wrote:
>
>> up vote0down votefavorite <https://stackoverflow.com/que
>> stions/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_sta
>> rted.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_er
>> ror(std::__1::basic_string<char, std::__1::char_traits<char>,
>> std::__1::allocator<char> > const&)': locale.cpp:(.text.unlikely._ZN
>> St3__112_GLOBAL__N_1L21__throw_runtime_errorERKNS_12basic_
>> stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+0xf): undefined
>> reference to `__cxa_allocate_exception' locale.cpp:(.text.unlikely._ZN
>> St3__112_GLOBAL__N_1L21__throw_runtime_errorERKNS_12basic_
>> stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+0x33): undefined
>> reference to `__cxa_throw' locale.cpp:(.text.unlikely._ZN
>> St3__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__112
>> ctype_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__112
>> ctype_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
>

-- 

------------------------------

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171011/4f2c7c07/attachment.html>


More information about the cfe-dev mailing list