# Error compiling MySQL 5.5.25 with DTrace Support



## overmind (Jun 9, 2012)

I've enabled support for DTrace by adding -DENABLE_DTRACE=1 to CMAKE_ARGS+ section of the Makefile for the mysql55-server port but when I compile I got the following error:


```
1 error
*** Error code 2
../../mysys/libmysys.a(mf_keycache.c.o): In function `key_cache_read':
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0xbe8):
 undefined reference to `__dtraceenabled_mysql___keycache__read__start'
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0xc19):
 undefined reference to `__dtrace_mysql___keycache__read__start'
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0xe1c):
 undefined reference to `__dtrace_mysql___keycache__read__block'
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0xf32):
 undefined reference to `__dtrace_mysql___keycache__read__miss'
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0xf81):
 undefined reference to `__dtrace_mysql___keycache__read__hit'
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0x111e):
 undefined reference to `__dtraceenabled_mysql___keycache__read__done'
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0x1185):
 undefined reference to `__dtrace_mysql___keycache__read__done'
../../mysys/libmysys.a(mf_keycache.c.o): In function `key_cache_write':
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0x3076):
 undefined reference to `__dtraceenabled_mysql___keycache__write__start'
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0x30a1):
 undefined reference to `__dtrace_mysql___keycache__write__start'
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0x32af):
 undefined reference to `__dtrace_mysql___keycache__write__block'
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0x3a83):
 undefined reference to `__dtraceenabled_mysql___keycache__write__done'
/usr/ports/databases/mysql55-server/work/mysql-5.5.25/mysys/mf_keycache.c:(.text+0x3a9d):
 undefined reference to `__dtrace_mysql___keycache__write__done'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1
1 error
*** Error code 2
3 errors
*** Error code 2
1 error
*** Error code 1
```

Did anybody successfully compile mysql with Dtrace on FreeBSD 9.0, AMD64?


----------



## naguz (Jun 20, 2012)

It fails for me with no  editing of the Makefile with the following:


```
[ 98%] Building CXX object sql/CMakeFiles/mysqld.dir/main.cc.o
Linking CXX executable mysqld
libsql.a(mysqld.cc.o): In function `show_ssl_get_verify_mode(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x218): undefined reference to `SSL_get_verify_mode'
libsql.a(mysqld.cc.o): In function `show_ssl_ctx_get_session_cache_mode(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x254): undefined reference to `SSL_CTX_ctrl'
libsql.a(mysqld.cc.o): In function `show_ssl_ctx_sess_get_cache_size(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x30a): undefined reference to `SSL_CTX_ctrl'
libsql.a(mysqld.cc.o): In function `show_ssl_ctx_sess_connect(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x34a): undefined reference to `SSL_CTX_ctrl'
libsql.a(mysqld.cc.o): In function `show_ssl_ctx_sess_number(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x38a): undefined reference to `SSL_CTX_ctrl'
libsql.a(mysqld.cc.o): In function `show_ssl_ctx_sess_timeouts(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x3ca): undefined reference to `SSL_CTX_ctrl'
libsql.a(mysqld.cc.o):mysqld.cc:(.text+0x40a): more undefined references to `SSL_CTX_ctrl' follow
libsql.a(mysqld.cc.o): In function `show_ssl_session_reused(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x651): undefined reference to `SSL_ctrl'
libsql.a(mysqld.cc.o): In function `show_ssl_ctx_get_verify_mode(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x691): undefined reference to `SSL_CTX_get_verify_mode'
libsql.a(mysqld.cc.o): In function `show_ssl_ctx_get_verify_depth(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x6c1): undefined reference to `SSL_CTX_get_verify_depth'
libsql.a(mysqld.cc.o): In function `show_ssl_get_version(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x1de4): undefined reference to `SSL_get_version'
libsql.a(mysqld.cc.o): In function `show_ssl_get_cipher_list(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x1e75): undefined reference to `SSL_get_cipher_list'
libsql.a(mysqld.cc.o): In function `show_ssl_get_cipher(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x1ec4): undefined reference to `SSL_get_current_cipher'
mysqld.cc:(.text+0x1ecc): undefined reference to `SSL_CIPHER_get_name'
libsql.a(mysqld.cc.o): In function `show_ssl_get_verify_depth(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x1f18): undefined reference to `SSL_get_verify_depth'
libsql.a(mysqld.cc.o): In function `show_ssl_get_default_timeout(THD*, st_mysql_show_var*, char*)':
mysqld.cc:(.text+0x1f58): undefined reference to `SSL_get_default_timeout'
libsql.a(sql_acl.cc.o): In function `acl_authenticate(THD*, unsigned int, unsigned int)':
sql_acl.cc:(.text+0xab36): undefined reference to `SSL_get_verify_result'
sql_acl.cc:(.text+0xab47): undefined reference to `SSL_get_peer_certificate'
sql_acl.cc:(.text+0xab58): undefined reference to `X509_free'
sql_acl.cc:(.text+0xac96): undefined reference to `SSL_get_verify_result'
sql_acl.cc:(.text+0xacb1): undefined reference to `SSL_get_current_cipher'
sql_acl.cc:(.text+0xacb9): undefined reference to `SSL_CIPHER_get_name'
sql_acl.cc:(.text+0xace3): undefined reference to `SSL_get_current_cipher'
sql_acl.cc:(.text+0xaceb): undefined reference to `SSL_CIPHER_get_name'
sql_acl.cc:(.text+0xb15e): undefined reference to `SSL_get_peer_certificate'
sql_acl.cc:(.text+0xb17d): undefined reference to `X509_get_issuer_name'
sql_acl.cc:(.text+0xb189): undefined reference to `X509_NAME_oneline'
sql_acl.cc:(.text+0xb1cb): undefined reference to `X509_free'
sql_acl.cc:(.text+0xb21c): undefined reference to `X509_get_subject_name'
sql_acl.cc:(.text+0xb228): undefined reference to `X509_NAME_oneline'
libsql.a(client.c.o): In function `mysql_close_free_options':
client.c:(.text+0x9ff): undefined reference to `SSL_CTX_free'
libsql.a(client.c.o): In function `mysql_get_ssl_cipher':
client.c:(.text+0x10f0): undefined reference to `SSL_get_current_cipher'
libsql.a(client.c.o): In function `send_client_reply_packet':
client.c:(.text+0x313b): undefined reference to `SSL_get_peer_certificate'
client.c:(.text+0x3164): undefined reference to `X509_get_subject_name'
client.c:(.text+0x3174): undefined reference to `X509_NAME_oneline'
client.c:(.text+0x3180): undefined reference to `X509_free'
client.c:(.text+0x3286): undefined reference to `ERR_error_string_n'
libsql.a(client.c.o): In function `mysql_get_ssl_cipher':
client.c:(.text+0x10fc): undefined reference to `SSL_CIPHER_get_name'
libsql.a(des_key_file.cc.o): In function `load_des_key_file(char const*)':
des_key_file.cc:(.text+0x306): undefined reference to `EVP_md5'
des_key_file.cc:(.text+0x30e): undefined reference to `EVP_des_ede3_cbc'
des_key_file.cc:(.text+0x347): undefined reference to `EVP_BytesToKey'
des_key_file.cc:(.text+0x366): undefined reference to `DES_set_key_unchecked'
des_key_file.cc:(.text+0x377): undefined reference to `DES_set_key_unchecked'
des_key_file.cc:(.text+0x388): undefined reference to `DES_set_key_unchecked'
libsql.a(item_strfunc.cc.o): In function `Item_func_des_decrypt::val_str(String*)':
item_strfunc.cc:(.text+0x8474): undefined reference to `EVP_md5'
item_strfunc.cc:(.text+0x847e): undefined reference to `EVP_des_ede3_cbc'
item_strfunc.cc:(.text+0x84af): undefined reference to `EVP_BytesToKey'
item_strfunc.cc:(.text+0x84bf): undefined reference to `DES_set_key_unchecked'
item_strfunc.cc:(.text+0x84d7): undefined reference to `DES_set_key_unchecked'
item_strfunc.cc:(.text+0x84ef): undefined reference to `DES_set_key_unchecked'
item_strfunc.cc:(.text+0x8563): undefined reference to `DES_ede3_cbc_encrypt'
libsql.a(item_strfunc.cc.o): In function `Item_func_des_encrypt::val_str(String*)':
item_strfunc.cc:(.text+0x87d3): undefined reference to `EVP_md5'
item_strfunc.cc:(.text+0x87db): undefined reference to `EVP_des_ede3_cbc'
item_strfunc.cc:(.text+0x8805): undefined reference to `EVP_BytesToKey'
item_strfunc.cc:(.text+0x8817): undefined reference to `DES_set_key_unchecked'
item_strfunc.cc:(.text+0x8831): undefined reference to `DES_set_key_unchecked'
item_strfunc.cc:(.text+0x884e): undefined reference to `DES_set_key_unchecked'
item_strfunc.cc:(.text+0x8a98): undefined reference to `DES_ede3_cbc_encrypt'
*** Error code 1
1 error
*** Error code 2
1 error
*** Error code 2
1 error
*** Error code 1

Stop in /usr/ports/databases/mysql55-server.
*** Error code 1

Stop in /usr/ports/databases/mysql55-server.

===>>> make failed for databases/mysql55-server
===>>> Aborting update
```
Seems to be because of SSL (which is a configuration option). Trying without it now. Might be some quirks with this ports at the moment unless we are both doing something wrong in different ways.


----------



## naguz (Jun 25, 2012)

It built fine without SSL, so some of the options certainly seem to not be building like they should. Shoul this be reported somewhere (and how)?


----------



## skeletor (Aug 13, 2012)

I have another error on FreeBSD 9.0-RELEASE-p3 amd64, mysql 5.5.27
Dtrace support build in kernel. How it fix?

```
[ 95%] Building CXX object client/CMakeFiles/mysql.dir/completion_hash.cc.o
In file included from /usr/ports/databases/mysql55-client/work/mysql-5.5.27/include/my_global.h:351,
                 from /usr/ports/databases/mysql55-client/work/mysql-5.5.27/client/completion_hash.cc:23:
/usr/include/sys/timeb.h:42:2: warning: #warning "this file includes <sys/timeb.h> which is deprecated"
[ 95%] Building CXX object client/CMakeFiles/mysql.dir/mysql.cc.o
In file included from /usr/ports/databases/mysql55-client/work/mysql-5.5.27/include/my_global.h:351,
                 from /usr/ports/databases/mysql55-client/work/mysql-5.5.27/client/client_priv.h:20,
                 from /usr/ports/databases/mysql55-client/work/mysql-5.5.27/client/mysql.cc:33:
/usr/include/sys/timeb.h:42:2: warning: #warning "this file includes <sys/timeb.h> which is deprecated"
[ 96%] Building CXX object client/CMakeFiles/mysql.dir/readline.cc.o
In file included from /usr/ports/databases/mysql55-client/work/mysql-5.5.27/include/my_global.h:351,
                 from /usr/ports/databases/mysql55-client/work/mysql-5.5.27/client/readline.cc:20:
/usr/include/sys/timeb.h:42:2: warning: #warning "this file includes <sys/timeb.h> which is deprecated"
[ 96%] Building CXX object client/CMakeFiles/mysql.dir/sql_string.cc.o
In file included from /usr/ports/databases/mysql55-client/work/mysql-5.5.27/include/my_global.h:351,
                 from /usr/ports/databases/mysql55-client/work/mysql-5.5.27/client/sql_string.cc:24:
/usr/include/sys/timeb.h:42:2: warning: #warning "this file includes <sys/timeb.h> which is deprecated"
Linking CXX executable mysql
../libmysql/libmysqlclient.a(net_serv.cc.o): In function `net_write_command':
net_serv.cc:(.text+0x50a): undefined reference to `__dtrace_mysql___net__write__start'
net_serv.cc:(.text+0x661): undefined reference to `__dtrace_mysql___net__write__done'
net_serv.cc:(.text+0x691): undefined reference to `__dtrace_mysql___net__write__done'
../libmysql/libmysqlclient.a(net_serv.cc.o): In function `my_net_write':
net_serv.cc:(.text+0x6e7): undefined reference to `__dtrace_mysql___net__write__start'
net_serv.cc:(.text+0x790): undefined reference to `__dtrace_mysql___net__write__done'
net_serv.cc:(.text+0x7fb): undefined reference to `__dtrace_mysql___net__write__done'
../libmysql/libmysqlclient.a(net_serv.cc.o): In function `my_net_read':
net_serv.cc:(.text+0xc12): undefined reference to `__dtrace_mysql___net__read__start'
net_serv.cc:(.text+0xdaa): undefined reference to `__dtrace_mysql___net__read__done'
net_serv.cc:(.text+0xdc8): undefined reference to `__dtrace_mysql___net__read__done'
net_serv.cc:(.text+0xdee): undefined reference to `__dtrace_mysql___net__read__done'
*** Error code 1
1 error
*** Error code 2
1 error
*** Error code 2
1 error
*** Error code 1
```


----------



## overmind (Aug 14, 2012)

What have you done to compile it with DTrace support?


----------



## skeletor (Aug 14, 2012)

I do the same sings as you 


> add -DENABLE_DTRACE=1 to CMAKE_ARGS+ section of the Makefile for the mysql55-server


----------



## overmind (Oct 17, 2014)

As of 2014 the issue remains. If you have any info on that please reply:


```
../../archive/libarchive.a(ha_archive.cc.o): In function `ha_archive::index_next(unsigned char*)':
/usr/ports/databases/mysql56-server/work/mysql-5.6.21/storage/archive/ha_archive.cc:(.text+0x1db5): undefined reference to `__dtrace_mysql___index__read__row__start'
/usr/ports/databases/mysql56-server/work/mysql-5.6.21/storage/archive/ha_archive.cc:(.text+0x1e30): undefined reference to `__dtrace_mysql___index__read__row__done'
../../archive/libarchive.a(ha_archive.cc.o): In function `ha_archive::rnd_next(unsigned char*)':
/usr/ports/databases/mysql56-server/work/mysql-5.6.21/storage/archive/ha_archive.cc:(.text+0x2388): undefined reference to `__dtrace_mysql___read__row__start'
/usr/ports/databases/mysql56-server/work/mysql-5.6.21/storage/archive/ha_archive.cc:(.text+0x2421): undefined reference to `__dtrace_mysql___read__row__done'
../../archive/libarchive.a(ha_archive.cc.o): In function `ha_archive::rnd_pos(unsigned char*, unsigned char*)':
/usr/ports/databases/mysql56-server/work/mysql-5.6.21/storage/archive/ha_archive.cc:(.text+0x2489): undefined reference to `__dtrace_mysql___read__row__start'
/usr/ports/databases/mysql56-server/work/mysql-5.6.21/storage/archive/ha_archive.cc:(.text+0x24fd): undefined reference to `__dtrace_mysql___read__row__done'
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1
```


----------

