Bug #34866 Can't compile on Solaris 9/Sparc with gcc
Submitted: 26 Feb 2008 23:55 Modified: 5 May 2011 15:01
Reporter: Hakan Küçükyılmaz Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:6.0.5 OS:Solaris (Solaris 9/Sparc, 10/Intel)
Assigned to: Jonathan Perkin CPU Architecture:Any

[26 Feb 2008 23:55] Hakan Küçükyılmaz
Description:
Compiling latest mysql-6.0 from bk does not work on Solaris 9/Sparc.

How to repeat:
- Clone latest mysql-6.0 from bk
- BUILD/compile-solaris-sparc-debug

gcc -g -DSAFE_MUTEX -g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -O3 -fno-omit-frame-pointer -fno-implicit-templates -fno-exceptions -fno-rtti -D_FILE_OFFSET_BITS=64 -DHAVE_RWLOCK_T -o mysqld sql_lex.o sql_handler.o sql_partition.o item.o item_sum.o item_buff.o item_func.o item_cmpfunc.o item_strfunc.o item_timefunc.o thr_malloc.o item_create.o item_subselect.o item_row.o item_geofunc.o item_xmlfunc.o field.o strfunc.o key.o sql_class.o sql_list.o net_serv.o protocol.o sql_state.o lock.o my_lock.o sql_string.o sql_manager.o sql_map.o mysqld.o password.o hash_filo.o hostname.o sql_connect.o scheduler.o sql_parse.o set_var.o sql_yacc.o sql_base.o table.o sql_select.o sql_insert.o sql_profile.o sql_prepare.o sql_error.o sql_locale.o sql_update.o sql_delete.o uniques.o sql_do.o procedure.o sql_test.o log.o init.o derror.o sql_acl.o unireg.o des_key_file.o log_event.o rpl_record.o log_event_old.o rpl_record_old.o discover.o time.o opt_range.o opt_sum.o records.o filesort.o handler.o ha_partition.o sql_db.o sql_table.o sql_rename.o sql_crypt.o sql_load.o mf_iocache.o field_conv.o sql_show.o sql_udf.o sql_analyse.o sql_cache.o slave.o sql_repl.o rpl_filter.o rpl_tblmap.o rpl_utility.o rpl_injector.o rpl_rli.o rpl_mi.o rpl_reporting.o sql_union.o sql_derived.o sql_client.o stacktrace.o repl_failsafe.o sql_olap.o sql_view.o gstream.o spatial.o sql_help.o sql_cursor.o tztime.o my_decimal.o sp_head.o sp_pcontext.o sp_rcontext.o sp.o sp_cache.o parse_file.o sql_trigger.o event_scheduler.o event_data_objects.o event_queue.o event_db_repository.o events.o sql_plugin.o sql_binlog.o sql_builtin.o sql_tablespace.o partition_info.o sql_servers.o sha2.o ddl_blocker.o si_objects.o mini_client_errors.o pack.o client.o my_time.o my_user.o  ./.libs/libndb.a -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread ../storage/csv/libcsv.a ../storage/heap/libheap.a ../storage/myisammrg/libmyisammrg.a ../storage/myisam/libmyisam.a ../vio/libvio.a ../mysys/libmysys.a ../dbug/libdbug.a ../regex/libregex.a ../strings/libmystrings.a -lz -ldl backup/.libs/libbackup.a -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread -lrt -lresolv -lgen -lsocket -lnsl -lm -lpthread -lthread
ld: elf error: file ./.libs/libndb.a: elf_getarsym
ld: fatal: File processing errors. No output written to mysqld

hakan@wendlingen:~/work/mysql/mysql-6.0$ gcc --version
gcc (GCC) 3.4.5

hakan@wendlingen:~/work/mysql/mysql-6.0$ bison --version
bison (GNU Bison) 1.875
Written by Robert Corbett and Richard Stallman.

hakan@wendlingen:~/work/mysql/mysql-6.0$ automake --version
automake (GNU automake) 1.10.1

hakan@wendlingen:~/work/mysql/mysql-6.0$ autoconf --version
autoconf (GNU Autoconf) 2.61

hakan@wendlingen:~/work/mysql/mysql-6.0$ ld --version
GNU ld version 2.17

This failure happens after fixing the issue with #include <getopt.h> described in Bug#34094.
[7 Mar 2008 23:35] Trudy Pelzer
On IRC, Hakan reported he has the same failure on 
Solaris 10/Intel and Solaris 9/Sparc
[30 Sep 2008 9:29] Amit Saha
I have run into the same error using the 5.1.28-rc sources with the following development environment:

gcc (GCC) 3.4.3 (csl-sol210-3_4-20050802)
GNU Make 3.81
SunOS opensolaris 5.11 snv_86 i86pc i386 i86pc Solaris
[16 Nov 2008 18:07] Erik Ljungstrom
I can confirm this bug with same setup as Amit, but with version 5.1.29-rc
[28 Nov 2008 11:32] MC Brown
This issue is caused by trying to link in an empty library to the binary. 

On Solaris/ELF binaries the gnu ld attempts to open the symbol table for what is an empty library and promptly fails. 

The solution is to not link empty library files.
[29 Nov 2008 21:22] Philippe Dax
I have the same error while building mysql-5.1.30 with

solaris9-sparc
gcc-4.2.0
./configure --with-pthread --disable-largefile
[12 Dec 2008 0:40] Jörg Prante
I think when Solaris ld complains about elf_getarsym, it is caused by a bug at least five years known. Solaris ld is picky about 'ar' archive internal format. 

A workaround for this MySQL build issue is using Sun's ar utility like this:

cd sql
/usr/ccs/bin/ar -ts .libs/libndb.a
make msqld

Thanks to Erek Adams, 21 Dec 2003, on snort-users mailing list.
[8 May 2009 18:33] Shea Lovan
I was getting this error trying to compile 5.1.34 on Solaris 10U3.  It looks like it may be a problem with the GNU Binutils package on Solaris.  When I put /usr/ccs/bin in my path in front of the binutils location, the compile-time errors went away and I could run a successful "make test".
[6 Jan 2010 18:21] Michael Widenius
This fixes the linker issue:

+++ sql/ha_ndbcluster.cc        2010-01-06 18:19:02 +0000
@@ -10565,4 +10565,6 @@
 }
 mysql_declare_plugin_end;

+#else
+int Sun_ar_require_a_symbol_here= 0;
 #endif
[15 Sep 2010 5:08] John Warburton
This is also happening in the 5.1.x stream for me on Soalris 10/SPARC gcc 3.4.6. Just failed with mysql-5.1.50

Not just me - http://lists.mysql.com/internals/35983
[5 May 2011 15:01] Daniel Fischer
Closing because we don't support gcc on Solaris.
[12 May 2012 0:45] Erik Hetzner
If you don't support gcc on solaris, perhaps you could modify this page:

http://dev.mysql.com/doc/refman/5.1/en/solaris-installation-source.html