[llvm-dev] Using LLD to link against third-party libraries? How?

blubee blubeeme via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 11 19:24:14 PST 2018


I couldn't get it to build libcxx...
You need c++ and c++abi to compile c++ code.

On Wed, Dec 12, 2018, 07:01 Osman Zakir via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> LLVM on a Developer Command Prompt.  The ones I want to fix first are the
> ones from Boost and Jinja2Cpp.  I saw some from those as well.
>
> If there any standard library ones missing, could it be because I couldn't
> get it to build libcxx?  I did try to include that, but it seems to be
> missing.  What should I do?
> ------------------------------
> *From:* David Greene <dag at cray.com>
> *Sent:* Wednesday, December 12, 2018 3:30 AM
> *To:* Osman Zakir
> *Cc:* blubee blubeeme; llvm-dev at lists.llvm.org
>
> *Subject:* Re: [llvm-dev] Using LLD to link against third-party
> libraries? How?
>
> Are you linking with a C++ compiler?  A lot of those missing symbols
> look like they come from the C++ standard library.
>
>                           -David
>
> Osman Zakir via llvm-dev <llvm-dev at lists.llvm.org> writes:
>
> > @blubee blubeeme So what do you think? Got any ideas?
> > ----------------------------------------------------------------------
> > From: Osman Zakir <osmanzakir90 at hotmail.com>
> > Sent: Wednesday, December 12, 2018 1:43 AM
> > To: llvm-dev at lists.llvm.org
> > Subject: Re: [llvm-dev] Using LLD to link against third-party
> > libraries? How?
> > In my code here https://github.com/DragonOsman/currency_converter , I
> > used C++17 and managed to get it to work (though I'm only using
> > std::map::insert_or_assign() from C++17). And I'm using Windows, so I
> > shouldn't use LDFLAGS or CXXFLAGS as environment variables. I'll use
> > them directly on the compiler command line instead. The libraries I
> > need to link against are
> > C:/boost_1_68_0/stage/lib/libboost_system-vc141-mt-x64-1_68.lib and
> > C:/Jinja2Cpp/install_x64/lib/static/jinja2cpp.lib.
> >
> > I tried to build it with this flag:
> > "
> > clang++ -std=c++17 -Wall -pedantic -
> > D_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING -
> > Dvariant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD -
> > D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING -
> > D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32 -
> > D_WIN32_WINDOWS -D_NDEBUG -fexceptions -
> > IC:/Jinja2Cpp/install_x64/include -IC:/json/single_include -
> > IC:/boost_1_68_0 -
> > LC:/boost_1_68_0/stage/lib/libboost_system-vc141-mt-x64-1_68.lib -
> > LC:/Jinja2Cpp/install_x64/lib/static/jinja2cpp.lib
> > currency_converter.cpp -o currency_converter.exe
> > "
> > And I got these warnings and errors from LLD:
> >
> > "
> > lld-link: warning:
> > C:\Users\Osman\AppData\Local\Temp\currency_converter-264ae1.o: locally
> > defined symbol imported: __std_terminate (defined in libvcruntime.lib
> > (ehhelpers.obj)) [LNK4217]
> > lld-link: error: undefined symbol: "public: __cdecl
> > jinja2::Template::Template(class jinja2::TemplateEnv *)"
> > (??0Template at jinja2@@QEAA at PEAVTemplateEnv@1@@Z)​
> >>>> referenced by
> > C:\Users\Osman\AppData\Local\Temp\currency_converter-264ae1.o:("void _
> > _cdecl handle_request<struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > std::allocator<char>, struct server_session::send_lambda &>(class
> > boost::basic_string_view<char, struct std::char_traits<char>>, struct
> > boost::beast::http::message<1, struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > boost::beast::http::basic_fields<class std::allocator<char>>> &&,
> > struct server_session::send_lambda &, char const *, char const *)"
> > (??$handle_request at U?$basic_string_body at DU?$char_traits at D@std@
> @V?$allocator at D@2@@http at beast@boost@@V?
> > $allocator at D@std@@AEAUsend_lambda at server_session@@@@YAXV?$basic_string_
> > view at DU?$char_traits at D@std@@@boost@@$$QEAU?$message@$00U?$basic_string_
> > body at DU?$char_traits at D@std@@V?$allocator at D@2@@http at beast@boost@
> @V?$basic_
> > fields at V?$allocator at D@std@@@234@@http at beast@1 at AEAUsend_lambda
> @server_session@@PEBD3 at Z)
> > )​
> > ​
> > lld-link: error: undefined symbol: "public: class
> > nonstd::expected_lite::expected<void, class
> > jinja2::ErrorInfoTpl<char>> __cdecl jinja2::Template::LoadFromFile
> > (class std::basic_string<char, struct std::char_traits<char>, class
> > std::allocator<char>> const &)"
> > (?LoadFromFile at Template@jinja2@@QEAA?AV?$expected at XV?$ErrorInfoTpl at D
> @jinja2@@@expected_
> > lite at nonstd@@AEBV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@
> @std@@@Z)
> > ​
> >>>> referenced by
> > C:\Users\Osman\AppData\Local\Temp\currency_converter-264ae1.o:("void _
> > _cdecl handle_request<struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > std::allocator<char>, struct server_session::send_lambda &>(class
> > boost::basic_string_view<char, struct std::char_traits<char>>, struct
> > boost::beast::http::message<1, struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > boost::beast::http::basic_fields<class std::allocator<char>>> &&,
> > struct server_session::send_lambda &, char const *, char const *)"
> > (??$handle_request at U?$basic_string_body at DU?$char_traits at D@std@
> @V?$allocator at D@2@@http at beast@boost@@V?
> > $allocator at D@std@@AEAUsend_lambda at server_session@@@@YAXV?$basic_string_
> > view at DU?$char_traits at D@std@@@boost@@$$QEAU?$message@$00U?$basic_string_
> > body at DU?$char_traits at D@std@@V?$allocator at D@2@@http at beast@boost@
> @V?$basic_
> > fields at V?$allocator at D@std@@@234@@http at beast@1 at AEAUsend_lambda
> @server_session@@PEBD3 at Z)
> > )​
> > ​
> > lld-link: error: undefined symbol: "public: class
> > std::basic_string<char, struct std::char_traits<char>, class
> > std::allocator<char>> __cdecl jinja2::Template::RenderAsString(class
> > std::unordered_map<class std::basic_string<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > jinja2::Value, struct std::hash<class std::basic_string<char, struct
> > std::char_traits<char>, class std::allocator<char>>>, struct
> > std::equal_to<class std::basic_string<char, struct
> > std::char_traits<char>, class std::allocator<char>>>, class
> > std::allocator<struct std::pair<class std::basic_string<char, struct
> > std::char_traits<char>, class std::allocator<char>> const, class
> > jinja2::Value>>> const &)"
> > (?RenderAsString at Template@jinja2@@QEAA?AV?$basic_string at DU
> ?$char_traits at D@std@@V?
> > $allocator at D@2@@std@@AEBV?$unordered_map at V?$basic_string at DU
> ?$char_traits at D@std@@V?
> > $allocator at D@2@@std@@VValue at jinja2@@U?$hash at V?$basic_string at DU
> ?$char_traits at D@std@@V?
> > $allocator at D@2@@std@@@2 at U?$equal_to at V?$basic_string at DU?$char_traits at D
> @std@@V?
> > $allocator at D@2@@std@@@2 at V?$allocator at U?$pair@$$CBV?$basic_string at DU
> ?$char_
> > traits at D@std@@V?$allocator at D@2@@std@@VValue at jinja2@@@std@@@2@@4@@Z)​
> >>>> referenced by
> > C:\Users\Osman\AppData\Local\Temp\currency_converter-264ae1.o:("void _
> > _cdecl handle_request<struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > std::allocator<char>, struct server_session::send_lambda &>(class
> > boost::basic_string_view<char, struct std::char_traits<char>>, struct
> > boost::beast::http::message<1, struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > boost::beast::http::basic_fields<class std::allocator<char>>> &&,
> > struct server_session::send_lambda &, char const *, char const *)"
> > (??$handle_request at U?$basic_string_body at DU?$char_traits at D@std@
> @V?$allocator at D@2@@http at beast@boost@@V?
> > $allocator at D@std@@AEAUsend_lambda at server_session@@@@YAXV?$basic_string_
> > view at DU?$char_traits at D@std@@@boost@@$$QEAU?$message@$00U?$basic_string_
> > body at DU?$char_traits at D@std@@V?$allocator at D@2@@http at beast@boost@
> @V?$basic_
> > fields at V?$allocator at D@std@@@234@@http at beast@1 at AEAUsend_lambda
> @server_session@@PEBD3 at Z)
> > )​
> >>>> referenced by
> > C:\Users\Osman\AppData\Local\Temp\currency_converter-264ae1.o:("void _
> > _cdecl handle_request<struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > std::allocator<char>, struct server_session::send_lambda &>(class
> > boost::basic_string_view<char, struct std::char_traits<char>>, struct
> > boost::beast::http::message<1, struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > boost::beast::http::basic_fields<class std::allocator<char>>> &&,
> > struct server_session::send_lambda &, char const *, char const *)"
> > (??$handle_request at U?$basic_string_body at DU?$char_traits at D@std@
> @V?$allocator at D@2@@http at beast@boost@@V?
> > $allocator at D@std@@AEAUsend_lambda at server_session@@@@YAXV?$basic_string_
> > view at DU?$char_traits at D@std@@@boost@@$$QEAU?$message@$00U?$basic_string_
> > body at DU?$char_traits at D@std@@V?$allocator at D@2@@http at beast@boost@
> @V?$basic_
> > fields at V?$allocator at D@std@@@234@@http at beast@1 at AEAUsend_lambda
> @server_session@@PEBD3 at Z)
> > )​
> > ​
> > lld-link: error: undefined symbol: "public: __cdecl
> > jinja2::Template::~Template(void)" (??1Template at jinja2@@QEAA at XZ)​
> >>>> referenced by
> > C:\Users\Osman\AppData\Local\Temp\currency_converter-264ae1.o:("void _
> > _cdecl handle_request<struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > std::allocator<char>, struct server_session::send_lambda &>(class
> > boost::basic_string_view<char, struct std::char_traits<char>>, struct
> > boost::beast::http::message<1, struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > boost::beast::http::basic_fields<class std::allocator<char>>> &&,
> > struct server_session::send_lambda &, char const *, char const *)"
> > (??$handle_request at U?$basic_string_body at DU?$char_traits at D@std@
> @V?$allocator at D@2@@http at beast@boost@@V?
> > $allocator at D@std@@AEAUsend_lambda at server_session@@@@YAXV?$basic_string_
> > view at DU?$char_traits at D@std@@@boost@@$$QEAU?$message@$00U?$basic_string_
> > body at DU?$char_traits at D@std@@V?$allocator at D@2@@http at beast@boost@
> @V?$basic_
> > fields at V?$allocator at D@std@@@234@@http at beast@1 at AEAUsend_lambda
> @server_session@@PEBD3 at Z)
> > )​
> >>>> referenced by
> > C:\Users\Osman\AppData\Local\Temp\currency_converter-264ae1.o:("int
> > `void __cdecl handle_request<struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > std::allocator<char>, struct server_session::send_lambda &>(class
> > boost::basic_string_view<char, struct std::char_traits<char>>, struct
> > basic_string_view<char, struct
> > std::char_traits<char>>::beast::http::message<1, struct
> > boost::beast::http::basic_string_body<char, struct
> > std::char_traits<char>, class std::allocator<char>>, class
> > boost::beast::http::basic_fields<class std::allocator<char>>> &&,
> > struct server_session::send_lambda &, char const *, char const *)'::
> > `1'::dtor$114"
> > (?dtor$114@?0???$handle_request at U?$basic_string_body at DU?$char_traits at D
> @std@@V?
> > $allocator at D@2@@http at beast@boost@@V?$allocator at D@std@
> @AEAUsend_lambda at server_
> > session@@@@YAXV?$basic_string_view at DU?$char_traits at D@std@@@boost@
> @$$QEAU?
> > $message@$00U?$basic_string_body at DU?$char_traits at D@std@@V?$allocator at D
> @2@@http at beast@boost@@V?
> > $basic_fields at V?$allocator at D@std@@@234@@http at beast@1 at AEAUsend_lambda
> @server_
> > session@@PEBD3 at Z@4HA))​
> > ​
> > lld-link: warning:
> > C:\Users\Osman\AppData\Local\Temp\currency_converter-264ae1.o: locally
> > defined symbol imported: _CxxThrowException (defined in
> > libvcruntime.lib(throw.obj)) [LNK4217]​
> > lld-link: error: undefined symbol: "class
> > boost::system::error_category const & __cdecl
> > boost::system::detail::system_category_ncx(void)"
> > (?system_category_ncx at detail@system at boost@@YAAEBVerror_category at 23@XZ)​
> >>>> referenced by
> > C:\Users\Osman\AppData\Local\Temp\currency_converter-264ae1.o:("class
> > boost::system::error_category const & __cdecl
> > boost::system::system_category(void)"
> > (?system_category at system@boost@@YAAEBVerror_category at 12@XZ))​
> > ​
> > lld-link: warning:
> > C:\Users\Osman\AppData\Local\Temp\currency_converter-264ae1.o: locally
> > defined symbol imported: __RTDynamicCast (defined in libvcruntime.lib
> > (rtti.obj)) [LNK4217]​
> > lld-link: error: undefined symbol: "class
> > boost::system::error_category const & __cdecl
> > boost::system::detail::generic_category_ncx(void)"
> > (?generic_category_ncx at detail@system at boost@@YAAEBVerror_category at 23@XZ)
> > ​
> >>>> referenced by
> > C:\Users\Osman\AppData\Local\Temp\currency_converter-264ae1.o:("class
> > boost::system::error_category const & __cdecl
> > boost::system::generic_category(void)"
> > (?generic_category at system@boost@@YAAEBVerror_category at 12@XZ))​
> > clang++: error: linker command failed with exit code 1 (use -v to see
> > invocation)
> > "
> >
> >
> >  * GitHub - DragonOsman/currency_converter: Application for Computer
> >    Science course
> >    Google Maps + Currency Converter Web Application. Application for
> >    Computer Science course. This is a currency converter web
> >    application with the frontend and a backend.
> >    github.com
> >
> > *
> >
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > llvm-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181212/b64b9d24/attachment.html>


More information about the llvm-dev mailing list