Bug #6862 Compile problems with SUN provided C under Solaris 9
Submitted: 28 Nov 2004 16:41 Modified: 9 Mar 2005 2:25
Reporter: Martynas Buozis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:4.1.7 OS:Solaris (Solaris 5.9 Generic_112233-11)
Assigned to: Kent Boortz CPU Architecture:Any

[28 Nov 2004 16:41] Martynas Buozis
Description:
Hello

I have two problems with latest MySQL (4.1.7) under Solaris 9. I am using SUN provided C compiler (cc: Sun C 5.6 2004/07/15) to compile packages.  I need urgently to use MySQL, so any fast response will be highly appreciated.

First problem is, that when I try to compile MySQL 4.1.7 from sources after configuring with 'CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v8plus" CXX=CC CXXFLAGS="-noex -mt" ./configure --prefix=/opt/local/web/mysql --enable-assembler' (as recommended in http://dev.mysql.com/doc/mysql/en/Solaris.html) I get following problems :

1. Compilation fails, because :

"history.c", line 734: undefined symbol: VIS_WHITE

Solaris 9 has /usr/platform/sun4u/include/sys/vis.h, but no VIS_WHITE defined in there.

I can easily fix this problem with undefining HAVE_VIS_H in config.h file and compile continues.

2. Second failure (and I have no solution for it) is following :

Making all in client
/bin/bash ../libtool --preserve-dup-deps --mode=link CC  -O3 -DDBUG_OFF -noex -mt   -D_FILE_OFFSET_BITS=64 -DHAVE_RWLOCK_T    -o mysql  mysql.o readline.o  sql_string.o completion_hash.o ../cmd-line-utils/libedit/libedit.a -lcurses ../libmysql/libmysqlclient.la  -lposix4 -lcrypt -lgen -lsocket -lnsl -lm  ../zlib/libz.la
CC -O3 -DDBUG_OFF -noex -mt -D_FILE_OFFSET_BITS=64 -DHAVE_RWLOCK_T -o .libs/mysql mysql.o readline.o sql_string.o completion_hash.o  ../cmd-line-utils/libedit/libedit.a -lcurses ../libmysql/.libs/libmysqlclient.so -lpthread -lthread -lpthread -lthread ../zlib/.libs/libz.a -lpthread -lthread -lposix4 -lcrypt -lgen -lsocket -lnsl -lm -lpthread -lthread -R/opt/local/web/mysql/lib/mysql
Undefined                       first referenced
 symbol                             in file
hash_key                            ../libmysql/.libs/libmysqlclient.so
ld: fatal: Symbol referencing errors. No output written to .libs/mysql
*** Error code 1
make: Fatal error: Command failed for target `mysql'

I think hash_key is defined in ./libmysql/hash.c and hash.o is compiled into libmysqlclient.so, so why it is undefined ? Any ideas ?
 BTW, problem is exactly same if I use --disable-shared in configure line :

/bin/bash ../libtool --preserve-dup-deps --mode=link cc  -O -DDBUG_OFF -Xa -fast -native -xstrconst -xarch=v8plus   -D_FILE_OFFSET_BITS=64 -DHAVE_RWLOCK_T    -o mysqltest  mysqltest.o my_getsystime.o ../libmysql/libmysqlclient.la -lposix4 -lcrypt -lgen -lsocket -lnsl -lm  ../zlib/libz.la
cc -O -DDBUG_OFF -Xa -fast -native -xstrconst -xarch=v8plus -D_FILE_OFFSET_BITS=64 -DHAVE_RWLOCK_T -o mysqltest mysqltest.o my_getsystime.o  ../libmysql/.libs/libmysqlclient.a -lpthread -lthread -lpthread -lthread ../zlib/.libs/libz.a -lpthread -lthread -lposix4 -lcrypt -lgen -lsocket -lnsl -lm -lpthread -lthread
Undefined                       first referenced
 symbol                             in file
hash_key                            ../libmysql/.libs/libmysqlclient.a(hash.o)
ld: fatal: Symbol referencing errors. No output written to mysqltest
*** Error code 1

Second problem is, that when  I use precompiled package for Solaris 9 mysql-standard-4.1.7-sun-solaris2.9-sparc.tar.gz available for download from MySQL, so I can’t compile any soft with  libs from that package, because any compilation  ends with following error :

Undefined                       first referenced
 symbol                             in file
__cmpdi2                            /opt/local/web/mysql/lib/libmysqlclient.a(libmysql.o)
__floatdidf                         /opt/local/web/mysql/lib/libmysqlclient.a(libmysql.o)
__floatdisf                         /opt/local/web/mysql/lib/libmysqlclient.a(libmysql.o)
ld: fatal: Symbol referencing errors. No output written to conftest

I am not using GNU lib (I think these symbols are defined in GNU lib?) and do not have that package installed. How should I deal with these undefined symbols without GNU lib ?

Thank you for any advises according all problems. 

With best regards
Martynas

How to repeat:
Try to compile as described in original information.
[28 Nov 2004 20:13] Martynas Buozis
Hello

I removed inline from function hash_key type and this solved compile problem. What I will loose now without inline in function type description ?

With best regards
Martynas
[14 Feb 2005 20:02] JR Lawhorne
You can also link your own app with

-lmygcc

and it should get these undefined symbols.  This lib is located in the mysql/lib directory.
[9 Mar 2005 1:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/22814
[9 Mar 2005 2:25] Kent Boortz
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

configure now checks not only that the header file exists,
but also that the strvis() function exists before it sets
HAVE_VIS_H.

We now compile the Solaris binaries using the Sun Forte
compilers. This should mean that -lmygcc is not needed
when linking.