Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Problem with statically linking libmysql and libmysqlpp libraries

Posted on 2006-07-20
2
Medium Priority
?
415 Views
Last Modified: 2012-06-21
For some reason I'd like to statically link some mysql libraries. I am using the following compiler options:
g++ <<blah blah>> -static -lmysqlclient -lmysqlpp

I am not sure I am using the right compiler options. Anyhow I get the following errors:

/usr/lib/mysql/libmysqlclient.a(mf_pack.o)(.text+0x623): In function `unpack_dirname':
: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.text+0x3113): In function `.L481':
: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/mysql/libmysqlclient.a(mf_pack.o)(.text+0x637): In function `unpack_dirname':
: warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
miscfunc.o(.text+0x1e48): In function `GetIPAddress()':
: warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/mysql/libmysqlclient.a(my_gethostbyname.o)(.text+0x3c): In function `my_gethostbyname_r':
: warning: Using 'gethostbyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.text+0x11f2): In function `mysql_once_init':
: warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/mysql/libmysqlclient.a(my_compress.o)(.text+0x66): In function `my_uncompress':
: undefined reference to `uncompress'
/usr/lib/mysql/libmysqlclient.a(my_compress.o)(.text+0x11c): In function `my_compress_alloc':
: undefined reference to `compress'
collect2: ld returned 1 exit status


0
Comment
Question by:sandeep_th
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 800 total points
ID: 17148349
Regarding 'compress()' and 'uncompress()': It seems that you're missing 'zlib' - try to add '-lz' to your linker options.
0
 
LVL 17

Assisted Solution

by:rstaveley
rstaveley earned 200 total points
ID: 17148883
The other warnings are just warnings. If your program is going to run on the same system you built on you'll be fine, but presumably you are linking statically because you want to be able to distribute your binary. The problem is that the glibc runtime invokes shared libraries. You'll need to find an alternative C runtime, if that's no good for you.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question