Solved

Problem with statically linking libmysql and libmysqlpp libraries

Posted on 2006-07-20
2
362 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 200 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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

914 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now