Osman Zakir via llvm-dev
2018-Dec-11 20:01 UTC
[llvm-dev] Using LLD to link against third-party libraries? How?
I already mentioned what flag I tried. It's in the first email in this thread. And I want to link against Boost.System and the Jinja2Cpp library (the latter's documentation can be found here: https://github.com/flexferrum/Jinja2Cpp . And I also have some GUI applications using FLTK as well that I want to try to build using LLVM as well, so I'll have to know how to link against FLFK's libraries too. [https://avatars3.githubusercontent.com/u/1494258?s=400&v=4]<https://github.com/flexferrum/Jinja2Cpp> GitHub - flexferrum/Jinja2Cpp: Jinja2 C++ (and for C++) almost full-conformance template engine implementation<https://github.com/flexferrum/Jinja2Cpp> Join GitHub today. GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together. github.com ________________________________ From: blubee blubeeme <gurenchan at gmail.com> Sent: Wednesday, December 12, 2018 12:54 AM To: Osman Zakir Cc: llvm-dev Subject: Re: [llvm-dev] Using LLD to link against third-party libraries? How? That depends on the library that you'd like to link against, it's usually in the documentation of that project. What project are you trying to link and what linker flags have you tried so far? Best On Wed, Dec 12, 2018 at 3:49 AM Osman Zakir via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: I add the -fuse-ld=lld flag to the compiler command line itself. And I included LLD when I built LLVM (I checked out the mono repo and built that version). What command line arguments should I pass to LLD when I want to link against third-party libraries? That's what I'm asking. _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto: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/20181211/70e23e6e/attachment-0001.html>
blubee blubeeme via llvm-dev
2018-Dec-11 20:10 UTC
[llvm-dev] Using LLD to link against third-party libraries? How?
The documentation on that github page says c++14 make sure your CXXFLAGS have -std=c++14 LDFLAGS have -fuse-ld=lld -lc++ -lc++abi -lm -lc Going forward If the link fails u have to provide more information as to what errors ur getting. Best On Wed, Dec 12, 2018 at 4:02 AM Osman Zakir via llvm-dev < llvm-dev at lists.llvm.org> wrote:> I already mentioned what flag I tried. It's in the first email in this > thread. And I want to link against Boost.System and the Jinja2Cpp library > (the latter's documentation can be found here: > https://github.com/flexferrum/Jinja2Cpp . And I also have some GUI > applications using FLTK as well that I want to try to build using LLVM as > well, so I'll have to know how to link against FLFK's libraries too. > <https://github.com/flexferrum/Jinja2Cpp> > GitHub - flexferrum/Jinja2Cpp: Jinja2 C++ (and for C++) almost > full-conformance template engine implementation > <https://github.com/flexferrum/Jinja2Cpp> > Join GitHub today. GitHub is home to over 28 million developers working > together to host and review code, manage projects, and build software > together. > github.com > > ------------------------------ > *From:* blubee blubeeme <gurenchan at gmail.com> > *Sent:* Wednesday, December 12, 2018 12:54 AM > *To:* Osman Zakir > *Cc:* llvm-dev > *Subject:* Re: [llvm-dev] Using LLD to link against third-party > libraries? How? > > That depends on the library that you'd like to link against, it's usually > in the documentation of that project. > > What project are you trying to link and what linker flags have you tried > so far? > > Best > > On Wed, Dec 12, 2018 at 3:49 AM Osman Zakir via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > I add the -fuse-ld=lld flag to the compiler command line itself. And I > included LLD when I built LLVM (I checked out the mono repo and built that > version). > > What command line arguments should I pass to LLD when I want to link > against third-party libraries? That's what I'm asking. > > _______________________________________________ > 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/f9378a90/attachment.html>
Osman Zakir via llvm-dev
2018-Dec-11 20:43 UTC
[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) " [https://avatars0.githubusercontent.com/u/18173932?s=400&v=4]<https://github.com/DragonOsman/currency_converter> GitHub - DragonOsman/currency_converter: Application for Computer Science course<https://github.com/DragonOsman/currency_converter> 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181211/ff7dc1a1/attachment.html>