Bug #73826 cannot build mysql with DTrace on Solaris 11.2
Submitted: 6 Sep 2014 17:35 Modified: 10 Oct 2014 21:37
Reporter: Eugene Zheganin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.6.20 OS:Solaris
Assigned to: CPU Architecture:Any
Tags: dtrace compilation

[6 Sep 2014 17:35] Eugene Zheganin
Description:
OS: Solaris 11.2 GA
GCC: # gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/gcc/4.8/lib/gcc/i386-pc-solaris2.11/4.8.2/lto-wrapper
Target: i386-pc-solaris2.11
Configured with: /builds/hudson/workspace/nightly-update/build/i386/components/gcc48/gcc-4.8.2/configure CC=/usr/gcc/4.7/bin/gcc CXX=/usr/gcc/4.7/bin/g++ --prefix=/usr/gcc/4.8 --mandir=/usr/gcc/4.8/share/man --bindir=/usr/gcc/4.8/bin --libdir=/usr/gcc/4.8/lib --sbindir=/usr/gcc/4.8/sbin --infodir=/usr/gcc/4.8/share/info --libexecdir=/usr/gcc/4.8/lib --enable-languages=c,c++,fortran,objc --enable-shared --with-gmp-include=/usr/include/gmp --with-mpfr-include=/usr/include/mpfr --without-gnu-ld --with-ld=/usr/bin/ld --with-gnu-as --with-as=/usr/gnu/bin/as CFLAGS='-g -O2  -mtune=opteron -march=opteron' CXXFLAGS='-g -O2 -mtune=opteron -march=opteron'
Thread model: posix
gcc version 4.8.2 (GCC)

cmake: 3.0.1

Cannot build 5.6.20 on a Solaris 11.2 with dtrace support.
Compilation fails:

Scanning dependencies of target myisam_ftdump
[ 36%] Building C object storage/myisam/CMakeFiles/myisam_ftdump.dir/myisam_ftdump.c.o
Linking CXX executable myisam_ftdump
Undefined                    first referenced
 symbol                             in file
__dtraceenabled_mysql___keycache__read__done ../../mysys/libmysys.a(mf_keycache.c.o)
__dtrace_mysql___keycache__read__start ../../mysys/libmysys.a(mf_keycache.c.o)
__dtrace_mysql___keycache__read__block ../../mysys/libmysys.a(mf_keycache.c.o)
__dtrace_mysql___keycache__write__done ../../mysys/libmysys.a(mf_keycache.c.o)
__dtrace_mysql___keycache__read__hit ../../mysys/libmysys.a(mf_keycache.c.o)
__dtraceenabled_mysql___keycache__read__start ../../mysys/libmysys.a(mf_keycache.c.o)
__dtrace_mysql___keycache__read__done ../../mysys/libmysys.a(mf_keycache.c.o)
__dtrace_mysql___keycache__read__miss ../../mysys/libmysys.a(mf_keycache.c.o)
__dtraceenabled_mysql___keycache__write__done ../../mysys/libmysys.a(mf_keycache.c.o)
__dtraceenabled_mysql___keycache__write__start ../../mysys/libmysys.a(mf_keycache.c.o)
__dtrace_mysql___keycache__write__block ../../mysys/libmysys.a(mf_keycache.c.o)
__dtrace_mysql___keycache__write__start ../../mysys/libmysys.a(mf_keycache.c.o)
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
gmake[2]: *** [storage/myisam/myisam_ftdump] Error 1
gmake[1]: *** [storage/myisam/CMakeFiles/myisam_ftdump.dir/all] Error 2
gmake: *** [all] Error 2

How to repeat:
Get a 5.6.20 and try to build it with -DENABLE_DTRACE.
[6 Sep 2014 21:11] MySQL Verification Team
Please check for duplicate with http://bugs.mysql.com/bug.php?id=69639 . Thanks.
[7 Sep 2014 6:19] Eugene Zheganin
Doesn't seem like the duplicate to the bug you showed. This is indeed, the bug about dtrace too, but mine is about linking errors, and #73826 is about dtrace template (.d) missing in some case, thus leading to object compilation errors, and everything else.
[9 Sep 2014 12:31] MySQL Verification Team
Hello Eugene Zheganin,

Thank you for the bug report.
I'm able to reproduce this issue.

Thanks,
Umesh
[9 Sep 2014 12:32] MySQL Verification Team
Build details

Attachment: 73826.txt (text/plain), 78.20 KiB.

[11 Sep 2014 10:32] Bjørn Munch
The underlying cause of this failure is that dtrace now identifies itself as 'Oracle' instead of 'Sun'. This confuses cmake which makes the wrong assumptions about dtrace support.

A workaround is to add -DHAVE_REAL_DTRACE_INSTRUMENTING=ON to the cmake command, this should force it to treat dtrace the proper way. At least it built for me when I used this.
[30 Sep 2014 15:36] MySQL Verification Team
Patched results

Attachment: 73826_patched.txt (text/plain), 122.75 KiB.

[10 Oct 2014 21:37] Paul DuBois
Noted in 5.6.22, 5.7.6 changelogs.

In Solaris 11.2, "dtrace -V" output changed from "Sun D" to "Oracle D",
causing detection of DTrace availability to failure during MySQL
configuration.
[10 Dec 2014 13:19] Laurynas Biveinis
$ bzr log -r 6190
------------------------------------------------------------
revno: 6190
committer: Praveenkumar Hulakund <praveenkumar.hulakund@oracle.com>
branch nick: mysql-5.6
timestamp: Tue 2014-10-07 15:39:51 +0530
message:
  Bug#19586917 - cannot build mysql with dtrace on solaris 11.2
  
  On Solaris 11.2, "dtrace -V" output changed from "Sun D" to
  "Oracle D". Because of this detection of real dtrace was failing.
  Changed code in file dtrace.make to check "Sun D" or "Oracle D"
  from "dtrace -V" output to fix this issue.