Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined symbol: _db_enter_ #3

Open
realdadfish opened this issue Apr 16, 2014 · 4 comments
Open

undefined symbol: _db_enter_ #3

realdadfish opened this issue Apr 16, 2014 · 4 comments

Comments

@realdadfish
Copy link

Was trying to create the functions after I placed the compiled regexp.so into my /usr/lib/mysql/plugin, but got:

ERROR 1126 (HY000): Can't open shared library 'regexp.so' (errno: 0 /usr/lib/mysql/plugin/regexp.so: undefined symbol: _db_enter_)

Only found http://bugs.mysql.com/bug.php?id=60872 as a reference for this problem, but I don't know exactly how I could deal with it.

@orion19792014
Copy link

Hi tommyd3mdi.

AFAIK there are 2 options to deal with this issue:

  1. Recompile MySQL server with debugging enabled.
  2. Rewrite the plugin to avoid using DBUG* defines.
    I've chosen the second option, because i needed this plugin for prototyping purposes only and also in the link you've provided, is discussed, that the debugging functionality is not suitable for plugins. AFAIK there are three kinds of them in the code: DBUG_ENTER, DBUG_RETURN and DBUG_NULL_RETURN.

@utdrmac
Copy link

utdrmac commented Apr 1, 2015

The commentors at http://bugs.mysql.com/bug.php?id=60872 state that the DBUG_* macros are not intended to be used by external plugins. They are an internal-only framework and are not exported by default. The author of this plugin is using macros he shouldn't be, according to the Oracle developers' comments on the noted bug. Thus, without compiling your mysql server with debugging enabled, you can't use this plugin; without rewriting parts of it yourself. Hopefully hholzgra can update his code to not use these unsupported macros.

@saper
Copy link

saper commented Oct 2, 2016

Here's how I solved this by adding explicit -DDBUG_OFF (compiling by hand due to #8):

 cc -DDBUG_OFF -DHAVE_CONFIG_H -fPIC -I. -I. -I.   \
                    -I/usr/home/saper/sw/mysql-5.6.31/include \
                    -I/usr/home/saper/sw/mysql-5.6.31 \
                    -I/usr/home/saper/sw/mysql-5.6.31/sql  \
                    -g -O2 -MT regexp_la-regexp.lo -MD -MP -MF ".deps/regexp_la-regexp.Tpo" \
                    -c -o regexp_la-regexp.lo regexp.c
 cc -g -O2 -fPIC -o regexp.so -shared -Wl,-rpath /usr/local/lib  regexp_la-regexp.lo

This regexp.so seems to load, here's a list of its symbols:

$ nm regexp.la 
00000000002030a0 B __bss_start
                 U calloc@@GLIBC_2.2.5
                 w __cxa_finalize@@GLIBC_2.2.5
0000000000203098 d __dso_handle
0000000000202df8 d _DYNAMIC
00000000002030a0 D _edata
00000000002030a8 B _end
00000000000028a0 T _fini
                 U __fprintf_chk@@GLIBC_2.3.4
                 U free@@GLIBC_2.2.5
0000000000203000 d _GLOBAL_OFFSET_TABLE_
                 w __gmon_start__
0000000000000b80 T _init
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 w _Jv_RegisterClasses
                 U malloc@@GLIBC_2.2.5
                 U memcpy@@GLIBC_2.14
                 U my_charset_latin1
                 U my_regcomp
                 U my_regexec
                 U my_regfree
                 U realloc@@GLIBC_2.2.5
0000000000001b90 T regexp_instr
0000000000001b60 T regexp_instr_deinit
00000000000018c0 T regexp_instr_init
0000000000001070 T regexp_like
0000000000001040 T regexp_like_deinit
0000000000000db0 T regexp_like_init
0000000000002020 T regexp_replace
0000000000002000 T regexp_replace_deinit
0000000000001ea0 T regexp_replace_init
0000000000001550 T regexp_substr
0000000000001510 T regexp_substr_deinit
0000000000001260 T regexp_substr_init
                 U __sprintf_chk@@GLIBC_2.3.4
                 U stderr@@GLIBC_2.2.5
                 U strcat@@GLIBC_2.2.5
                 U strlen@@GLIBC_2.2.5
                 U strncat@@GLIBC_2.2.5
                 U strncpy@@GLIBC_2.2.5
                 U __strndup@@GLIBC_2.2.5
00000000002030a0 d __TMC_END__

wuranbo pushed a commit to wuranbo/mysql-udf-regexp that referenced this issue Jan 5, 2018
wuranbo added a commit to wuranbo/mysql-udf-regexp that referenced this issue Jan 5, 2018
@wuranbo
Copy link

wuranbo commented Jan 5, 2018

Thanks @saper very much. And I make a PR.

wuranbo added a commit to wuranbo/mysql-udf-regexp that referenced this issue Jan 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants