Project link error with Wave on OSX
I've just updated a project that was working under XCode 4 with boost 1.48 to XCode 5 and boost 1.55 (installed with MacPorts). Now I have a link error with Wave which wasn't the case before. This somehow baffles me as I thought everything was template based. I am also linking with libboost-wave.mt.a but that doesn't solve the problem. The linker errors are, among 6 others: Undefined symbols for architecture x86_64: "boost::wave::cpplexer::new_lexer_gen<__gnu_cxx::__normal_iterator<char*, std::string>, boost::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<char, std::allocator<char> >, char*> > >, boost::wave::cpplexer::lex_token<boost::wave::util::file_position< boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<char, std::allocator<char> >, char*> > > >
::new_lexer(__gnu_cxx::__normal_iterator<char*, std::string> const&, __gnu_cxx::__normal_iterator<char*, std::string> const&, boost::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<char, std::allocator<char> >, char*> > > const&, boost::wave::language_support)", referenced from:
I've tried forcing std::string as the BOOST_WAVE_STRINGTYPE, but that just changes the signatures of the undefined symbols. I fail to see what has changed and I am completely stuck. I would have understood if I had a compiler error but this is a link error. Is this something to do with the standard C++ library? For my project, C++ dialect is C++98 and the standard library is libstdc++. Thanks in advance, Olivier
I've just updated a project that was working under XCode 4 with boost 1.48 to XCode 5 and boost 1.55 (installed with MacPorts). Now I have a link error with Wave which wasn't the case before. This somehow baffles me as I thought everything was template based.
The wave libraries contain code for pre-instantiated templates only. If you instantiate the templates yourself you will not need to link with the libraries. Also, do the examples/the wave driver tool compile and link properly?
I am also linking with libboost-wave.mt.a but that doesn't solve the problem. The linker errors are, among 6 others:
Undefined symbols for architecture x86_64: "boost::wave::cpplexer::new_lexer_gen<__gnu_cxx::__normal_iterator<char*, std::string>, boost::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<cha r,
std::allocator<char> >, char*> > >, boost::wave::cpplexer::lex_token<boost::wave::util::file_position< boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<cha r,
std::allocator<char> >, char*> > > >
::new_lexer(__gnu_cxx::__normal_iterator<char*, std::string> const&, __gnu_cxx::__normal_iterator<char*, std::string> const&, boost::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<cha r, std::allocator<char> >, char*> > > const&, boost::wave::language_support)", referenced from:
I've tried forcing std::string as the BOOST_WAVE_STRINGTYPE, but that just changes the signatures of the undefined symbols. I fail to see what has changed and I am completely stuck. I would have understood if I had a compiler error but this is a link error. Is this something to do with the standard C++ library? For my project, C++ dialect is C++98 and the standard library is libstdc++.
If you change BOOST_WAVE_STRINGTYPE it has to be done while compiling the wave libraries and while compiling your code. Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu
Le 25/02/2014 18:52, Hartmut Kaiser a écrit :>
The wave libraries contain code for pre-instantiated templates only. If you instantiate the templates yourself you will not need to link with the libraries.
Yes that seems logical. I've removed the library from the linker and tried to explicitely instantiate the problematic templates in my cpp file. Either I am not using the right syntax or something else is going on, but this has had no effect whatsoever. For instance, the first linker error is an undefined symbol for: boost::wave::cpplexer::new_lexer_gen<__gnu_cxx::__normal_iterator<char*, std::string>, boost::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<char, std::allocator<char> >, char*> > >, boost::wave::cpplexer::lex_token<boost::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<char, std::allocator<char> >, char*> > > >
::new_lexer(__gnu_cxx::__normal_iterator<char*, std::string> const&, __gnu_cxx::__normal_iterator<char*, std::string> const&, boost::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<char, std::allocator<char> >, char*> > > const&, boost::wave::language_support)
So I tried to explicitly instantiate the template, the whole new_lexer_gen struct, for instance (even though implicite instantiation should work...) by typing: template struct boost::wave::cpplexer::new_lexer_gen<__gnu_cxx::__normal_iterator<char*, std::string>, boost::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<char, std::allocator<char> >, char*> > >, boost::wave::cpplexer::lex_token<boost::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<char, std::allocator<char> >, char*> > > > >; I'm pretty sure this is the right syntax, and that doesn't really give an explanation on why this specific implicit instantiation doesn't work (I'm also using other boost templates in this project with success, tokenizer for instance). Something tells me this has something do to with my project configuration but it's hard to see where.
Also, do the examples/the wave driver tool compile and link properly?
Hmmm, I'll have to take some time to do that as the boost libraries have been download "prebuild" from a packaging system. Anyway this was my task of the morning, take some time to do my own custom build of boost and see if that fixes the issue. Thanks for your time.
I've just created on XCode 5 a new command line executable project with the boost/wave quickstart example, leaving everything by default, only linking with filesystem, thread and wave (as required by the linker). It works. After comparing all the project settings I've switched to C+11 dialect and GNU-C++11 standard libraries. It seems to have worked but now I have a link problem en filesystem: Undefined symbol boost::filesystem::detail::copy_file(boost::filesystem::path const&, boost::filesystem::path const&, boost::filesystem::copy_option, boost::system::error_code*) Sigh.
participants (2)
-
Hartmut Kaiser
-
Olivier Prat