List:MySQL++« Previous MessageNext Message »
From:Vincent Date:October 15 2008 1:22am
Subject:Build error under Cygwin
View as plain text  
Hi,

I came across 2 errors when compiling MySQL++ on a fresh Cygwin install.
The good news is that I solved them :)

I'm using :
 - MySQL 5.0.67
 - MySQL++ 3.0.6
 - GCC 3.4.4

Here is the first error :

/home/Bab/mysql++-3.0.6/bk-deps g++ -c -o mysqlpp_tcp_connection.o -I.
-I/usr/local/include/mysql
-g -O2 ./lib/tcp_connection.cpp
./lib/tcp_connection.cpp: In static member function `static bool
mysqlpp::TCPConnection::parse_addre
ss(std::string&, unsigned int&, std::string&)':
./lib/tcp_connection.cpp:133: error: `ntohs' undeclared (first use this
function)
./lib/tcp_connection.cpp:133: error: (Each undeclared identifier is reported
only once for each func
tion it appears in.)
make: *** [mysqlpp_tcp_connection.o] Error 1

To fix this I've just added this line in tcp_connection.cpp :
#include <arpa/inet.h>


The second one is a linker error :

g++ -shared -o cygmysqlpp-3.dll mysqlpp_beemutex.o mysqlpp_connection.o
mysqlpp_cpool.o mysqlpp_date
time.o mysqlpp_dbdriver.o mysqlpp_field_names.o mysqlpp_field_types.o
mysqlpp_manip.o mysqlpp_myset.
o mysqlpp_mysql++.o mysqlpp_mystring.o mysqlpp_null.o mysqlpp_options.o
mysqlpp_qparms.o mysqlpp_que
ry.o mysqlpp_result.o mysqlpp_row.o mysqlpp_sql_buffer.o mysqlpp_stadapter.o
mysqlpp_tcp_connection.
o mysqlpp_transaction.o mysqlpp_type_info.o mysqlpp_uds_connection.o
mysqlpp_vallist.o mysqlpp_wnp_c
onnection.o -L/usr/local/lib/mysql -Wl,--enable-auto-import
-Wl,--out-implib=libmysqlpp.dll.a
-lz  -lintl  -lmysqlclient
/usr/local/lib/mysql/libmysqlclient.a(my_compress.o):my_compress.c:(.text+0x5e):
undefined reference
 to `_compress'
/usr/local/lib/mysql/libmysqlclient.a(my_compress.o):my_compress.c:(.text+0x116):
undefined referenc
e to `_compress'
/usr/local/lib/mysql/libmysqlclient.a(my_compress.o):my_compress.c:(.text+0x1d1):
undefined referenc
e to `_uncompress'
Creating library file: libmysqlpp.dll.a
collect2: ld returned 1 exit status
make: *** [cygmysqlpp-3.dll] Error 1

compress and uncompress are supposed to be in zlib and the -lz switch is
here so this sounds weird.
After some search on the internet I decided to put the -lz at the end of the
command line, after -lmysqlclient and ... it worked !
Maybe a compiler bug ? So I tried with GCC 4.3.2 witch is in alpha under
cygwin but got the same result...

Any ideas ?

Anyway I hope those 2 little fix can be usefull.

Thread
Build error under CygwinVincent15 Oct
  • Re: Build error under CygwinWarren Young15 Oct