Bug #924 compilation fails for mysqlbinlog (ugly workaround included)
Submitted: 25 Jul 2003 3:56 Modified: 10 Sep 2003 2:59
Reporter: Martin Lindhe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.0.14 OS:Cygwin
Assigned to: Greg Weir CPU Architecture:Any

[25 Jul 2003 3:56] Martin Lindhe
Description:
I use the client library under cygwin, but from (i think) 4.0.13, compilation fails for mysqlbinlog:

$ ./configure --without-server && make
[snip]......
g++ -O3 -DDBUG_OFF -fno-implicit-templates -fno-exceptions -fno-rtti -o mysqlbinlog.exe mysqlbinlog.o  ../libmysql/.libs/libmysqlclient.a -lz -lcrypt
/usr/lib/mingw/libstdc++.a(eh_personality.o)(.text$__cxa_call_unexpected+0xe8): undefined reference to `__Unwind_Resume'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text$_ZSt9terminatev+0x7): undefined reference to `___w32_sharedptr_terminate'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text$_ZSt10unexpectedv+0x7): undefined reference to `___w32_sharedptr_unexpected'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text$_ZSt13set_terminatePFvvE+0x3): undefined reference to `___w32_sharedptr_terminate'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text$_ZSt14set_unexpectedPFvvE+0x3): undefined reference to `___w32_sharedptr_unexpected'
/usr/lib/mingw/libstdc++.a(vterminate.o)(.text$_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x63): undefined reference to `__imp___iob'
/usr/lib/mingw/libstdc++.a(vterminate.o)(.text$_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0xae): undefined reference to `__imp___iob'
/usr/lib/mingw/libstdc++.a(eh_throw.o)(.text$__cxa_throw+0x1b): undefined reference to `___w32_sharedptr_unexpected'
/usr/lib/mingw/libstdc++.a(eh_throw.o)(.text$__cxa_throw+0x25): undefined reference to `___w32_sharedptr_terminate'
/usr/lib/mingw/libstdc++.a(eh_throw.o)(.text$__cxa_throw+0x54): undefined reference to `__Unwind_RaiseException'
/usr/lib/mingw/libstdc++.a(eh_throw.o)(.text$__cxa_rethrow+0x1b): undefined reference to `__Unwind_RaiseException'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text$__cxa_allocate_exception+0x46): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text$__cxa_allocate_exception+0xd6): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text$__cxa_free_exception+0x1a): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text$__cxa_free_exception+0x77): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text$__gthread_once+0x2): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_globals.o)(.text$_Z16get_globals_initv+0x1d): undefined reference to `___mingwthr_key_dtor'
/usr/lib/mingw/libstdc++.a(eh_globals.o)(.text$__gthread_once+0x2): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(cxa_demangle.o)(.text$demangle_v3_with_details+0x82): undefined reference to `__imp___iob'
/usr/lib/mingw/libstdc++.a(cxa_demangle.o)(.text$demangle_v3_with_details+0x9e): undefined reference to `__imp___iob'
collect2: ld returned 1 exit status

How to repeat:
./configure --without-server && make

Suggested fix:
When the above errors occurs, I edited client/Makefile, and removed mysqlbinlog from the following lines

bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
 mysqldump mysqlimport mysqltest mysqlbinlog mysqlmanagerc mysqlmanager-pwgen

bin_PROGRAMS = mysql$(EXEEXT) mysqladmin$(EXEEXT) mysqlcheck$(EXEEXT) \
	mysqlshow$(EXEEXT) mysqldump$(EXEEXT) mysqlimport$(EXEEXT) \
	mysqltest$(EXEEXT) mysqlmanagerc$(EXEEXT) \
	mysqlmanager-pwgen$(EXEEXT)

then ran "make" again, and everything else compiled and I could install the client library

I'm sorry I cant supply a proper fix for this :(
[10 Sep 2003 2:59] Greg Weir
The problem is not observed with 4.0.15, using gcc 3.2 and all latest cygwin updates.
[15 Sep 2003 1:45] Martin Lindhe
The problem still occurs for me with 4.0.15, as shown below:

(i use gcc 3.3.1 btw)

g++ -DUNDEF_THREADS_HACK -I. -I. -I.. -I./../include -I../include -I./.. -I.. -I..
 -O3 -DDBUG_OFF   -fno-implicit-templates -fno-exceptions -fno-rtti -c -o mysqlbinlog.
o `test -f mysqlbinlog.cc || echo './'`mysqlbinlog.cc
/bin/bash ../libtool --mode=link g++  -O3 -DDBUG_OFF   -fno-implicit-templates -fno-exceptions -fno-rtti   -o mysqlbinlog.exe mysqlbinlog.o ../libmysql/libmysqlclient.la -lz -lcrypt -lm
g++ -O3 -DDBUG_OFF -fno-implicit-templates -fno-exceptions -fno-rtti -o mysqlbinlog.exe mysqlbinlog.o  ../libmysql/.libs/libmysqlclient.a -lz -lcrypt
/usr/lib/mingw/libstdc++.a(eh_personality.o)(.text$__cxa_call_unexpected+0xe8): undefined reference to `__Unwind_Resume'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text$_ZSt9terminatev+0x7): undefined reference to `___w32_sharedptr_terminate'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text$_ZSt10unexpectedv+0x7): undefined reference to `___w32_sharedptr_unexpected'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text$_ZSt13set_terminatePFvvE+0x3): undefined reference to `___w32_sharedptr_terminate'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text$_ZSt14set_unexpectedPFvvE+0x3): undefined reference to `___w32_sharedptr_unexpected'
/usr/lib/mingw/libstdc++.a(vterminate.o)(.text$_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x63): undefined reference to `__imp___iob'
/usr/lib/mingw/libstdc++.a(vterminate.o)(.text$_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0xae): undefined reference to `__imp___iob'
/usr/lib/mingw/libstdc++.a(eh_throw.o)(.text$__cxa_throw+0x1b): undefined reference to `___w32_sharedptr_unexpected'
/usr/lib/mingw/libstdc++.a(eh_throw.o)(.text$__cxa_throw+0x25): undefined reference to `___w32_sharedptr_terminate'
/usr/lib/mingw/libstdc++.a(eh_throw.o)(.text$__cxa_throw+0x54): undefined reference to `__Unwind_RaiseException'
/usr/lib/mingw/libstdc++.a(eh_throw.o)(.text$__cxa_rethrow+0x1b): undefined reference to `__Unwind_RaiseException'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text$__cxa_allocate_exception+0x46): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text$__cxa_allocate_exception+0xd6): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text$__cxa_free_exception+0x1a): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text$__cxa_free_exception+0x77): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text$__gthread_once+0x2): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_globals.o)(.text$_Z16get_globals_initv+0x1d): undefined reference to `___mingwthr_key_dtor'
/usr/lib/mingw/libstdc++.a(eh_globals.o)(.text$__gthread_once+0x2): undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(cxa_demangle.o)(.text$demangle_v3_with_details+0x82): undefined reference to `__imp___iob'
/usr/lib/mingw/libstdc++.a(cxa_demangle.o)(.text$demangle_v3_with_details+0x9e): undefined reference to `__imp___iob'
collect2: ld returned 1 exit status
make[2]: *** [mysqlbinlog.exe] Error 1
make[2]: Leaving directory `/home/martin/mysql-4.0.15/client'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/martin/mysql-4.0.15'
make: *** [all] Error 2
[15 Sep 2003 9:50] Lenz Grimmer
Have you tried compiling with "CXX=gcc"?
[16 Sep 2003 6:46] Martin Lindhe
Thank you Lenz!

GXX=gcc ./configure --without-server && make

Did fix the problem :)