Bug #36403 Compiling Falcon on Solaris fails due to dtrace
Submitted: 29 Apr 2008 17:55 Modified: 30 Sep 2008 21:24
Reporter: Hakan Kuecuekyilmaz
Status: Closed
Category:Server: Falcon Severity:S1 (Critical)
Version:6.0, 6.0-falcon-team OS:Sun Solaris
Assigned to: Olav Sandstaa Target Version:6.0.6
Triage: D3 (Medium)

[29 Apr 2008 17:55] Hakan Kuecuekyilmaz
Description:
In mysql-6.0-falcon-team tree when trying to compile Falcon on Solaris 10 with Sun Studio
12, we get compile errors due to dtrace.

How to repeat:
Clone mysql-6.0-falcon-team tree

autoreconf --force --install

./configure CC=/opt/SUNWspro/bin/cc CXX=/opt/SUNWspro/bin/CC CFLAGS="-Xa -m32 -mt"
CXXFLAGS="-m32 -mt" --prefix=/usr/local/mysql-6.0 --with-named-curses=-lcurses
--with-mysql-ldflags=-static --with-client-ldflags=-static
--with-plugins=myisam,innobase,falcon 

gmake -j3
...
...
...

/opt/SUNWspro/bin/CC -m32 -mt -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 sql_audit.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/falcon/libfalcon.a ../storage/heap/libheap.a ../storage/innobase/libinnobase.a
../storage/myisam/libmyisam.a ../storage/myisammrg/libmyisammrg.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
Undefined                       first referenced
 symbol                             in file
__dtrace_mysql___external_lock      handler.o
__dtrace_mysql___update_start       sql_update.o
__dtrace_falcon___close            
../storage/falcon/libfalcon.a(libhafalcon_a-ha_falcon.o)
__dtrace_mysql___insert_row_start   handler.o
__dtrace_mysql___insert_row_end     handler.o
__dtrace_mysql___select_start       sql_select.o
__dtrace_mysql___insert_end         sql_insert.o
__dtrace_mysql___delete_end         sql_delete.o
__dtrace_mysql___filesort_end       filesort.o
__dtrace_mysql___filesort_start     filesort.o
__dtrace_falcon___open             
../storage/falcon/libfalcon.a(libhafalcon_a-ha_falcon.o)
__dtrace_mysql___update_end         sql_update.o
const unsigned char*EncodedDataStream::decode(const unsigned char*,Value*,bool)
../storage/falcon/libfalcon.a(libhafalcon_a-TableSpaceManager.o)
__dtrace_mysql___select_end         sql_select.o
ld: fatal: Symbol referencing errors. No output written to mysqld
gmake[3]: *** [mysqld] Error 1
gmake[3]: Leaving directory `/home/hakan/mysql-6.0-falcon-team-export/sql'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/home/hakan/mysql-6.0-falcon-team-export/sql'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/home/hakan/mysql-6.0-falcon-team-export/sql'
gmake: *** [all-recursive] Error 1

Suggested fix:
Fixed dtrace probes in Falcon.
[29 Apr 2008 21:11] Hakan Kuecuekyilmaz
Providing --disable-dtrace does not help either; compilation still fails due to dtrace.
[30 Apr 2008 22:24] Olav Sandstaa
Here is some information about why this happens.

1. When I run configure on Solaris it seems like the default for dTrace support is that
this is disabled(?) At least when looking into the file includes/my_config.h the
following is specified relating to dTrace:

  /* Enables DTRACE Support */
  /* #undef HAVE_DTRACE */

Is this a correct assumption? That dTrace support is off by default?

2. In sql/mysql_priv.h the following code:

#ifdef HAVE_DTRACE
#define _DTRACE_VERSION 1
#endif
#include "probes.h"

seems to be used for enabling dTrace support if HAVE_DTRACE is defined (which is not
defined as shown in step 1 above). So this code does not enable dTrace by setting
_DTRACE_VERSION.

3. sql/probes.h contains the method signatures for the dTrace probes. If _DTRACE_VERSION
is defined, the dTrace method signatures will be declared:

#if _DTRACE_VERSION

#define	MYSQL_DELETE_END() \
	__dtrace_mysql___delete_end()

In my compilations HAVA_DTRACE is not defined, and due to this _DTRACE_VERSION is not
defined by the code in sql/mysql_priv.h. Still the dTrace methods get included in the
compilation due to _DTRACE_VERSION is defined anyway due to the file
/usr/include/sys/feature_tests.h .

So basically, not mather what configure or include/my_config.h decides to do with
HAVE_DTRACE symbol, the signatures for the dTrace methods get defined.

Is this the intended results when HAVE_DTRACE is not defined?
[2 May 2008 13:58] Olav Sandstaa
If I add --enable-dtrace when running configure most of the unknown dtrace symbols are
resolved. Only the two Falcon specific symbols are still not found by the linker:

Undefined                       first referenced
 symbol                             in file
__dtrace_falcon___close            
../storage/falcon/libfalcon.a(libhafalcon_a-ha_falcon.o)
__dtrace_falcon___open             
../storage/falcon/libfalcon.a(libhafalcon_a-ha_falcon.o)
[19 Jun 2008 14:39] 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/commits/48169

2712 Olav Sandstaa	2008-06-19
      Temporary work-around for Bug#36403 Compiling Falcon on Solaris fails due to dtrace
      
      To avoid that other people compiling on Solaris have problems with linking
      the two DTrace probes found in Falcon we temporarily comment these out
      of the code.
      
      Before these should be enabled again there need to be done some work
      on how configure and make do linking of DTrace probes for the storage
      engines.
[23 Jun 2008 15:44] Olav Sandstaa
I have made a separate bug report for the DTrace linking errors that are not related to
Falcon. See Bug#37584 "MySQL does not link on Solaris 10 MU4 or newer due to missing
DTrace symbols".
[22 Aug 2008 20:35] Kevin Lewis
Fix is in version 6.0.6
[30 Sep 2008 21:24] Jon Stephens
Documented in the 6.0.6 changelog as follows:

        Compiling the server with Falcon support failed on Solaris 10 due to
        problems with DTrace. This occurred even when the build was configured
        using --disable-dtrace.