Bug #1107 Compile Error - LEX
Submitted: 20 Aug 2003 8:52 Modified: 22 Sep 2003 9:05
Reporter: Yunho Kang Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.0.14 OS:Linux (RedHat Lunix 7.3)
Assigned to: Lenz Grimmer CPU Architecture:Any

[20 Aug 2003 8:52] Yunho Kang
uname -a
Linux peoplenjob.com 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 unknown

gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ./configure
Thread model: posix
gcc version 3.3

config command
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtt
i" ./configure --prefix=/usr/local/mysql4 --with-charset=euc_kr --with-client-ld
flags=-all-static --with-mysqld-ldflags=-all-static

--- when make ---
gcc -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/usr/local/mysql4\"" -DDATADIR="\"/usr/local/mysql4/var\"" -DSHAREDIR="\"/usr/local/mysql4/share/mysql\"" -DHAVE_CONFIG_H -I. -I. -I.. -I../innobase/include -I./../include -I./../regex -I. -I../include -I.     -O3 -DDBUG_OFF -O3 -felide-constructors -fno-exceptions -fno-rtti  -fno-implicit-templates -fno-exceptions -fno-rtti -DUSE_MYSYS_NEW -DDEFINE_CXA_PURE_VIRTUAL -c -o sql_lex.o `test -f sql_lex.cc || echo './'`sql_lex.cc
sql_lex.cc: In function `void lex_init()':
sql_lex.cc:85: error: `symbols' undeclared (first use this function)
sql_lex.cc:85: error: (Each undeclared identifier is reported only once for
   each function it appears in.)
sql_lex.cc:87: error: `sql_functions' undeclared (first use this function)
sql_lex.cc: In function `int find_keyword(LEX*, unsigned int, bool)':
sql_lex.cc:171: error: `get_hash_symbol' undeclared (first use this function)
make[4]: *** [sql_lex.o] ¿À·ù 1
make[4]: exit `/home/SRC/mysql-4.0.14/sql' error
make[3]: *** [all-recursive] ¿À·ù 1
make[3]: exit `/home/SRC/mysql-4.0.14/sql' error
make[2]: *** [all] ¿À·ù 2
make[2]: exit `/home/SRC/mysql-4.0.14/sql' error
make[1]: *** [all-recursive] ¿À·ù 1
make[1]: exit `/home/SRC/mysql-4.0.14' error
make: *** [all] error 2
[ exit, error message was written in Korean-character, so I translate...]

How to repeat:
I have two Linux Box almost the same configuration except kernel version ...

[ compile error ]
Linux peoplenjob.com 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 unknown

[ compile good ]
Linux dongprise.com 2.4.18-27.7.x #1 Fri Mar 14 06:44:53 EST 2003 i686 unknown
[27 Aug 2003 10:03] Michael Widenius
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

The problem you have is that somehow the file lex_hash.h, which is created by
gen_lex_hash, has been destroyed (it's probably empty).

Simple fix:

Generate a new one by doing:

cd sql
rm lex_hash.h gen_lex_hash
make lex_hash.h

This should recompile gen_lex_hash which should output something that
ends with something like:

./gen_lex_hash > lex_hash.h
Symbols: 345  Functions: 141;  Total: 486
Shifts per char: 1,  Array size: 4943

If the above fails, it's either a bug in gen_lex_hash or your compiler
can't generate a working gen_lex_hash binary.

If the above still fails, I recommend you to download and use a binary from

[29 Aug 2003 16:23] Yunho Kang
Thanks. I resolve the problem. I don't know why that file has the problem.
[11 Sep 2003 4:12] Yunho Kang
I want to upgrate to 4.0.15 ... But still have problems like ...
make lex_hash.h
make gen_lex_hash
make[1]: µé¾î°¨ `/home/mnaschool/SRC/mysql-4.0.15/sql' µð·ºÅ丮
/bin/sh ../libtool --mode=link g++  -O3 -DDBUG_OFF   -fno-implicit-templates -fno-exceptions -fno-rtti  -rdynamic  -o gen_lex_hash  gen_lex_hash.o ../isam/libnisam.a ../merge/libmerge.a ../myisam/libmyisam.a ../myisammrg/libmyisammrg.a ../heap/libheap.a ../vio/libvio.a ../mysys/libmysys.a ../dbug/libdbug.a ../regex/libregex.a ../strings/libmystrings.a  -lpthread -lz -lcrypt -lnsl -lm  -lpthread
g++ -O3 -DDBUG_OFF -fno-implicit-templates -fno-exceptions -fno-rtti -rdynamic -o gen_lex_hash gen_lex_hash.o  ../isam/libnisam.a ../merge/libmerge.a ../myisam/libmyisam.a ../myisammrg/libmyisammrg.a ../heap/libheap.a ../vio/libvio.a ../mysys/libmysys.a ../dbug/libdbug.a ../regex/libregex.a ../strings/libmystrings.a -lpthread -lz -lcrypt -lnsl -lm -lpthread
make[1]: ³ª°¨ `/home/mnaschool/SRC/mysql-4.0.15/sql' µð·ºÅ丮
./gen_lex_hash > lex_hash.h
./gen_lex_hash: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory
make: *** [lex_hash.h] Error 127

Same OS, Same Environment ... Work-around does not work. How can i do?
I you want to see my system please mail to me. I will send you root password.

[22 Sep 2003 9:05] Lenz Grimmer
This is not a MySQL bug.

Your OS installation is incomplete - the dynamic linker (ld.so) cannot find
the shared library "libstdc++.so.5". Make sure it is installed or use "gcc"
to compile the C++ files by exporting the environment variable "CXX=gcc" before
configuring and compiling MySQL from source. This will also avoid the dependency on libstc++ (which is recommended in our manual anyway).
[22 Sep 2003 19:41] Yunho Kang
Thanks your kind reply. But ... another error happend. -.-

slave.o: In function `init_slave()':
slave.o(.text+0xb5): undefined reference to `operator new(unsigned)'
slave.o: In function `end_slave()':
slave.o(.text+0x1353): undefined reference to `operator delete(void*)'
sql_union.o: In function `mysql_union(THD*, st_lex*, select_result*)':
sql_union.o(.text+0x9f3): undefined reference to `operator delete[](void*)'
sql_union.o(.text+0xb60): undefined reference to `operator delete[](void*)'
sql_union.o(.text+0xd90): undefined reference to `operator delete[](void*)'
collect2: ld returned 1 exit status
make[4]: *** [mysqld] ¿À·ù 1
make[4]: ³ª°¨ `/home/mnaschool/SRC/mysql-4.0.15/sql' µð·ºÅ丮
make[3]: *** [all-recursive] ¿À·ù 1
make[3]: ³ª°¨ `/home/mnaschool/SRC/mysql-4.0.15/sql' µð·ºÅ丮
make[2]: *** [all] ¿À·ù 2
make[2]: ³ª°¨ `/home/mnaschool/SRC/mysql-4.0.15/sql' µð·ºÅ丮
make[1]: *** [all-recursive] ¿À·ù 1
make[1]: ³ª°¨ `/home/mnaschool/SRC/mysql-4.0.15' µð·ºÅ丮
make: *** [all] ¿À·ù 2
[1 Jun 2004 4:12] Travis Ferguson
I just ran into this exactly same issue on Solaris 9 (64bit) while compiling mysql-4.0.20.  The issue is that libstdc++.so.5 is not in your LD_LIBRARY_PATH (most likely you have this lib in /usr/local/lib so add that to your path).