Bug #80549 violite.h and other headers missing in mysql-community-devel
Submitted: 28 Feb 2016 23:03 Modified: 30 Nov 2018 5:22
Reporter: Justin Swanhart Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S1 (Critical)
Version:5.7.11, 5.7.13 OS:Any
Assigned to: CPU Architecture:Any

[28 Feb 2016 23:03] Justin Swanhart
Description:
I have the following packages installed from the Oracle MySQL Fedora repository:
--------------------------------------------------------

mysql-community-server-5.7.11-1.fc23.x86_64
mysql-community-devel-5.7.11-1.fc23.x86_64
mysql-community-libs-5.7.11-1.fc23.x86_64
mysql57-community-release-fc23-7.noarch
mysql-community-client-5.7.11-1.fc23.x86_64
mysql-community-common-5.7.11-1.fc23.x86_64

When I try to compile my UDF I get a missing header:
--------------------------------------------------------

g++ --std=c++11 -shared -Wl,-rpath '-Wl,$ORIGIN' -L lib/ -I include/ -I include/fastbit -I `mysql_config --include` -l fastbit -o fb_udf.so `mysql_config --cxxflags` fb_udf.cpp
In file included from /usr/include/mysql/mysql/services.h:26:0,
                 from /usr/include/mysql/plugin.h:59,
                 from fb_udf.h:11,
                 from fb_udf.cpp:7:
/usr/include/mysql/mysql/service_srv_session_info.h:31:53: fatal error: violite.h: No such file or directory
compilation terminated.

Yum says that violite.h is in mariadb packages:
[justin@localhost FastBit_UDF]$ dnf whatprovides *\violite.h
Last metadata expiration check performed 1:00:21 ago on Sun Feb 28 16:10:28 2016.
mariadb-connector-c-devel-2.0.0-3.fc23.i686 : Development files for mariadb-connector-c.
Repo        : fedora

mariadb-connector-c-devel-2.0.0-3.fc23.x86_64 : Development files for mariadb-connector-c.
Repo        : fedora

mariadb-devel-1:10.0.20-3.fc23.i686 : Files for development of MariaDB/MySQL applications
Repo        : fedora

mariadb-devel-1:10.0.20-3.fc23.x86_64 : Files for development of MariaDB/MySQL applications
Repo        : fedora

mariadb-devel-1:10.0.21-1.fc23.i686 : Files for development of MariaDB/MySQL applications
Repo        : updates

mariadb-devel-1:10.0.21-1.fc23.x86_64 : Files for development of MariaDB/MySQL applications
Repo        : updates

I grabbed the git repo which contains violite.h, and copied it into /usr/include/mysql and then I get missing "pfs_socket_provider.h"

Then "my_md5_size.h" is missing.

Then I have other problems:

In file included from /usr/include/mysql/my_sys.h:25:0,
                 from /usr/include/mysql/mysql/psi/mysql_socket.h:27,
                 from /usr/include/mysql/violite.h:27,
                 from /usr/include/mysql/mysql/service_srv_session_info.h:31,
                 from /usr/include/mysql/mysql/services.h:26,
                 from /usr/include/mysql/plugin.h:59,
                 from fb_udf.h:11,
                 from fb_udf.cpp:7:
/usr/include/mysql/mysql/psi/mysql_memory.h:46:3: error: ‘PSI_memory_info’ has not been declared
   PSI_memory_info *info,
   ^
In file included from /usr/include/mysql/violite.h:25:0,
                 from /usr/include/mysql/mysql/service_srv_session_info.h:31,
                 from /usr/include/mysql/mysql/services.h:26,
                 from /usr/include/mysql/plugin.h:59,
                 from fb_udf.h:11,
                 from fb_udf.cpp:7:
/usr/include/mysql/mysql/psi/mysql_memory.h: In function ‘void inline_mysql_memory_register(const char*, int*, int)’:
/usr/include/mysql/mysql/psi/psi.h:2974:39: error: invalid use of incomplete type ‘PSI {aka struct PSI_v1}’
 #define PSI_DYNAMIC_CALL(M) PSI_server->M
                                       ^
...

How to repeat:
dnf install mysql-community-server mysql-community-client mysql-community-devel

git clone git@github.com:greenlion/FastBit_UDF.git

make

note: fastbit 2.0.1 will download and compile, which will take some time, then the error will manifest

Suggested fix:
unsure
[29 Feb 2016 1:08] Justin Swanhart
I can compile my code with 5.7 when I add the following to my header file before including plugin.h

#define MYSQL_ABI_CHECK
[4 Mar 2016 11:43] MySQL Verification Team
Hi Justin,

Thank you for the report.
I tried to reproduce this issue on a freshly built Fedora23(updated) instance but I'm not seeing any of the reported issue(no error but seeing warnings). I'm attaching the build log for your reference. Is there anything else required to trigger this issue? Please let me know.

Regards,
Umesh
[4 Mar 2016 11:44] MySQL Verification Team
Build log

Attachment: 80549.results (application/octet-stream, text), 735.55 KiB.

[5 Apr 2016 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[21 Jul 2016 4:21] dx dx
Can reproduce this issue with libmysqlclient 5.7.13

libmysqlclient 5.6.31 doesn't have this issue.

libmariadbclient 10.1.14 doesn't have this issue.

Minimal test case:

echo 'int main(){};' | gcc $(mysql_config --cflags) -include plugin.h -xc -

The test case in the description needs a revert to the commit that added a workaround for this:

git clone git@github.com:greenlion/FastBit_UDF.git
git revert e311b1982b9665a89b87f6b55f3d426ec441e69a
make
[23 Jul 2016 14:35] Justin Swanhart
Feedback was provided by another user.
[25 Jul 2016 6:01] MySQL Verification Team
thank you for the feedback!

lient-dev                         5.7.13-1ubuntu16.04                                 amd64        MySQL development headers
ii  libmysqlclient20:amd64                     5.7.13-1ubuntu16.04                                 amd64        MySQL shared client libraries
ii  mysql-apt-config                           0.7.3-1                                             all          Auto configuration for MySQL APT Repo.
ii  mysql-common                               5.7.13-1ubuntu16.04                                 amd64        MySQL configuration for client and server
.
.
ushastry@ubuntu1604lts:~/Downloads/apps$ 

ushastry@ubuntu1604lts:~/Downloads/apps$ echo 'int main(){};' | gcc $(mysql_config --cflags) -include plugin.h -xc -
In file included from /usr/include/mysql/mysql/services.h:26:0,
                 from /usr/include/mysql/plugin.h:59,
                 from <command-line>:1:
/usr/include/mysql/mysql/service_srv_session_info.h:31:53: fatal error: violite.h: No such file or directory
compilation terminated.
[6 Dec 2016 11:36] Tor Didriksen
Posted by developer:
 
You should not need <plugin.h> to build your UDF library.
I did this change, and it builds just fine (this is current head of MySQL 5.7)

#include <iomanip>	// std::setprecision

//#define MYSQL_ABI_CHECK

#include <mysql_com.h>