Overview
Features
Download
Documentation
Community
Add-Ons & Services

Linking static library on Ubuntu

Please post support and help requests here.

Linking static library on Ubuntu

Postby irit » 18 Sep 2012, 03:35

Hello,

I'm using the latest version of the library and can't figure out why I can't link to the compiled static library. I've built the library without any issues except for a couple warnings about glibc.

glibc warning
Code: Select all
warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking


and this is a partial output when I build my application linking against the library...
Code: Select all
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::reinitialize(Poco::Util::Application&)':
Application.cpp:(.text+0x20d): undefined reference to `Poco::Message::Message(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority)'
Application.cpp:(.text+0x21f): undefined reference to `Poco::Message::~Message()'
Application.cpp:(.text+0x313): undefined reference to `Poco::Message::~Message()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::uninitialize()':
Application.cpp:(.text+0x44b): undefined reference to `Poco::Message::Message(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority)'
Application.cpp:(.text+0x45d): undefined reference to `Poco::Message::~Message()'
Application.cpp:(.text+0x564): undefined reference to `Poco::Message::~Message()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::initialize(Poco::Util::Application&)':
Application.cpp:(.text+0x68d): undefined reference to `Poco::Message::Message(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority)'
Application.cpp:(.text+0x69f): undefined reference to `Poco::Message::~Message()'
Application.cpp:(.text+0x799): undefined reference to `Poco::Message::~Message()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::run()':
Application.cpp:(.text+0x940): undefined reference to `Poco::Logger::log(Poco::Exception const&)'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::getApplicationPath(Poco::Path&) const':
Application.cpp:(.text+0xaae): undefined reference to `Poco::Path::Path(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Application.cpp:(.text+0xac4): undefined reference to `Poco::Path::operator=(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Application.cpp:(.text+0xad1): undefined reference to `Poco::Path::append(Poco::Path const&)'
Application.cpp:(.text+0xadb): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xb09): undefined reference to `Poco::Path::operator=(Poco::Path const&)'
Application.cpp:(.text+0xb3b): undefined reference to `Poco::Environment::get(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Application.cpp:(.text+0xb4e): undefined reference to `Poco::Path::find(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Path&)'
Application.cpp:(.text+0xb91): undefined reference to `Poco::Path::Path(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Application.cpp:(.text+0xba6): undefined reference to `Poco::Path::Path(Poco::Path const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Application.cpp:(.text+0xbb6): undefined reference to `Poco::Path::operator=(Poco::Path const&)'
Application.cpp:(.text+0xbc3): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xbcd): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xbd5): undefined reference to `Poco::Path::makeAbsolute()'
Application.cpp:(.text+0xc54): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xc5e): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xc83): undefined reference to `Poco::Path::~Path()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::findFile(Poco::Path&) const':
Application.cpp:(.text+0xd04): undefined reference to `Poco::Path::Path()'
Application.cpp:(.text+0xd1c): undefined reference to `Poco::Path::parent() const'
Application.cpp:(.text+0xd31): undefined reference to `Poco::Path::Path(Poco::Path const&, Poco::Path const&)'
Application.cpp:(.text+0xd46): undefined reference to `Poco::File::File(Poco::Path const&)'
Application.cpp:(.text+0xd53): undefined reference to `Poco::File::exists() const'
Application.cpp:(.text+0xd73): undefined reference to `Poco::Path::popDirectory()'
Application.cpp:(.text+0xd80): undefined reference to `Poco::File::~File()'
Application.cpp:(.text+0xd8d): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xdaf): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xdb7): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xddc): undefined reference to `Poco::Path::operator=(Poco::Path const&)'
Application.cpp:(.text+0xde9): undefined reference to `Poco::File::~File()'
Application.cpp:(.text+0xdf6): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xe08): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xe1d): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xe2f): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xe41): undefined reference to `Poco::File::~File()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::findAppConfigFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Path&) const':
Application.cpp:(.text+0xe85): undefined reference to `Poco::Path::Path(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Application.cpp:(.text+0xe90): undefined reference to `Poco::Path::setExtension(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Application.cpp:(.text+0xeac): undefined reference to `Poco::Path::operator=(Poco::Path const&)'
Application.cpp:(.text+0xeb4): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xef5): undefined reference to `Poco::Path::~Path()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::loadConfiguration(int)':
Application.cpp:(.text+0xf27): undefined reference to `Poco::Path::Path()'
Application.cpp:(.text+0xf3e): undefined reference to `Poco::Path::Path()'
Application.cpp:(.text+0xf6a): undefined reference to `Poco::Path::getBaseName() const'
Application.cpp:(.text+0xfc9): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xfd3): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0xff6): undefined reference to `Poco::Path::toString() const'
Application.cpp:(.text+0x105b): undefined reference to `Poco::Path::parent() const'
Application.cpp:(.text+0x1070): undefined reference to `Poco::Path::toString() const'
Application.cpp:(.text+0x10eb): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0x11ba): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0x11c4): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0x11ce): undefined reference to `Poco::Path::~Path()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::~Application()':
Application.cpp:(.text+0x13be): undefined reference to `Poco::Timestamp::~Timestamp()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::setArgs(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
Application.cpp:(.text+0x169c): undefined reference to `Poco::NumberFormatter::append(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int)'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::init()':
Application.cpp:(.text+0x1bd1): undefined reference to `Poco::Path::Path()'
Application.cpp:(.text+0x1bf0): undefined reference to `Poco::Path::toString() const'
Application.cpp:(.text+0x1cc2): undefined reference to `Poco::Path::getBaseName() const'
Application.cpp:(.text+0x1d3f): undefined reference to `Poco::Path::parent() const'
Application.cpp:(.text+0x1d51): undefined reference to `Poco::Path::toString() const'
Application.cpp:(.text+0x1dc9): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0x1ddb): undefined reference to `Poco::Path::parent() const'
Application.cpp:(.text+0x1df0): undefined reference to `Poco::Path::toString() const'
Application.cpp:(.text+0x1e6b): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0x1e7d): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0x1ed6): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0x1fc1): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0x2046): undefined reference to `Poco::Path::~Path()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::setup()':
Application.cpp:(.text+0x2486): undefined reference to `Poco::Path::current()'
Application.cpp:(.text+0x24af): undefined reference to `Poco::SignalHandler::install()'
Application.cpp:(.text+0x24cb): undefined reference to `Poco::ConsoleChannel::ConsoleChannel()'
Application.cpp:(.text+0x24ec): undefined reference to `Poco::Logger::setChannel(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Channel*)'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::Application()':
Application.cpp:(.text+0x26e6): undefined reference to `Poco::Logger::get(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Application.cpp:(.text+0x270b): undefined reference to `Poco::Timestamp::Timestamp()'
Application.cpp:(.text+0x27dc): undefined reference to `Poco::Timestamp::~Timestamp()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::init(int, wchar_t**)':
Application.cpp:(.text+0x287b): undefined reference to `Poco::UnicodeConverter::toUTF8(wchar_t const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::setArgs(int, char**)':
Application.cpp:(.text+0x2a8d): undefined reference to `Poco::NumberFormatter::append(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int)'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::Application(int, char**)':
Application.cpp:(.text+0x2ebd): undefined reference to `Poco::Logger::get(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Application.cpp:(.text+0x2ee1): undefined reference to `Poco::Timestamp::Timestamp()'
Application.cpp:(.text+0x2fd4): undefined reference to `Poco::Timestamp::~Timestamp()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Util::Application::loadConfiguration(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
Application.cpp:(.text+0x2ff2): undefined reference to `Poco::Path::Path(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Application.cpp:(.text+0x2fff): undefined reference to `Poco::Path::getExtension() const'
Application.cpp:(.text+0x302a): undefined reference to `Poco::Path::toString() const'
Application.cpp:(.text+0x3091): undefined reference to `Poco::Path::~Path()'
Application.cpp:(.text+0x3100): undefined reference to `Poco::Path::~Path()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoUtil.a(Application.o): In function `Poco::Logger::log(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority)':
Application.cpp:(.text._ZN4Poco6Logger3logERKSsNS_7Message8PriorityE[Poco::Logger::log(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority)]+0x36): undefined reference to `Poco::Message::Message(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority)'
Application.cpp:(.text._ZN4Poco6Logger3logERKSsNS_7Message8PriorityE[Poco::Logger::log(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority)]+0x47): undefined reference to `Poco::Message::~Message()'
Application.cpp:(.text._ZN4Poco6Logger3logERKSsNS_7Message8PriorityE[Poco::Logger::log(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority)]+0x61): undefined reference to `Poco::Message::~Message()'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoNet.a(MessageHeader.o): In function `Poco::Net::MessageHeader::quote(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)':
MessageHeader.cpp:(.text+0x196): undefined reference to `Poco::Ascii::CHARACTER_PROPERTIES'
MessageHeader.cpp:(.text+0x1d3): undefined reference to `Poco::Ascii::CHARACTER_PROPERTIES'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoNet.a(MessageHeader.o): In function `Poco::Net::MessageHeader::splitParameters(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, Poco::Net::NameValueCollection&)':
MessageHeader.cpp:(.text+0x3f9): undefined reference to `Poco::Ascii::CHARACTER_PROPERTIES'
MessageHeader.cpp:(.text+0x6b6): undefined reference to `Poco::Ascii::CHARACTER_PROPERTIES'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoNet.a(MessageHeader.o): In function `Poco::Net::MessageHeader::splitParameters(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, Poco::Net::NameValueCollection&)':
MessageHeader.cpp:(.text+0x8ac): undefined reference to `Poco::Ascii::CHARACTER_PROPERTIES'
../../../poco-1.4.4-all/lib/Linux/x86_64/libPocoNet.a(MessageHeader.o):MessageHeader.cpp:(.text+0xc69): more undefined references to `Poco::Ascii::CHARACTER_PROPERTIES' follow


-Thanks
irit
 
Posts: 9
Joined: 18 Sep 2012, 03:23

Re: Linking static library on Ubuntu

Postby alex » 18 Sep 2012, 07:08

Allegedly, there is a way to do get rid of the warnings but I haven't seen it.

Here's a couple of related resources:

http://sourceforge.net/mailarchive/mess ... d=29269444
http://fixunix.com/unix/84269-questions ... nking.html

To add insult to injury, on some platforms (eg Fedora) anything SSL related cannot be built statically:

http://sourceforge.net/mailarchive/mess ... d=29523982
alex
 
Posts: 1158
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Linking static library on Ubuntu

Postby irit » 18 Sep 2012, 09:15

ok...

I've done a clean --shared library build now on an ubuntu box, everything seemed to go well when building the app too, it all linked. No when I run my app I get this.

Code: Select all
error while loading shared libraries: libPocoFoundation.so.14: cannot open shared object file: No such file or directory


Do the same issues exist with the commercial product?

Thanks
irit
 
Posts: 9
Joined: 18 Sep 2012, 03:23

Re: Linking static library on Ubuntu

Postby irit » 18 Sep 2012, 09:19

irit wrote:ok...

I've done a clean --shared library build now on an ubuntu box, everything seemed to go well when building the app too, it all linked. No when I run my app I get this.

Code: Select all
error while loading shared libraries: libPocoFoundation.so.14: cannot open shared object file: No such file or directory


Do the same issues exist with the commercial product?

Thanks


Ok looks, like I needed to set the LD_LIBRARY_PATH there for the shared scenario.

So is it best to stick with the shared library then?

Thanks
irit
 
Posts: 9
Joined: 18 Sep 2012, 03:23

Re: Linking static library on Ubuntu

Postby alex » 21 Sep 2012, 03:01

irit wrote:Ok looks, like I needed to set the LD_LIBRARY_PATH there for the shared scenario.

If you do
Code: Select all
make install
you should not need LD_LIBRARY_PATH. See Shared Library Search Paths.
irit wrote:So is it best to stick with the shared library then?

That depends on your requirements and what the deployment environment looks like. Unless you must have static for some good reason, your life is likely to be easier with shared libraries.
alex
 
Posts: 1158
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Linking static library on Ubuntu

Postby irit » 27 Sep 2012, 07:13

Hi Alex,

Yeah, I'm making a little server application and just don't want the user to have to deal with the headache to make sure that poco is installed on their systems. My plan was to pre-build my app on some common OSs and just make it available for download. But I guess I can have them download a zip with the shared libraries and the app.

-Jacob
irit
 
Posts: 9
Joined: 18 Sep 2012, 03:23

Re: Linking static library on Ubuntu

Postby irit » 14 Jan 2013, 07:50

alex wrote:Allegedly, there is a way to do get rid of the warnings but I haven't seen it.

Here's a couple of related resources:

http://sourceforge.net/mailarchive/mess ... d=29269444
http://fixunix.com/unix/84269-questions ... nking.html

To add insult to injury, on some platforms (eg Fedora) anything SSL related cannot be built statically:

http://sourceforge.net/mailarchive/mess ... d=29523982



Just re-visiting this really quick... What about Ubuntu? That's my target OS.
irit
 
Posts: 9
Joined: 18 Sep 2012, 03:23


Return to Support

Who is online

Users browsing this forum: No registered users and 4 guests

cron