Bug #89168 Sun RPC removed from glibc, add option to detect and use libtirpc as replacement
Submitted: 10 Jan 2018 11:34 Modified: 13 Feb 2018 3:24
Reporter: Terje Røsten Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.7.20 OS:Any
Assigned to: CPU Architecture:Any

[10 Jan 2018 11:34] Terje Røsten
Description:
Sun RPC is being removed from glibc: https://fedoraproject.org/wiki/Changes/SunRPCRemoval

Replacement is libtirpc, please add support for detecting and using libtirpc if
Sun RPC in glibc is missing. 

In fact, it seems like check of rpc.h is missing too.

How to repeat:
Use Fedora 28 host and do:

$ mkdir build
$ cmake ..
$ cd rapid/plugin/group_replicationrapid/plugin/group_replication
$ make VERBOSE=1

ends with:

cd /work/trosten/mysql/b/rapid/plugin/group_replication/libmysqlgcs && /bin/cc -DHAVE_CONFIG_H -DHAVE_LIBEVENT1 -DRAPIDJSON_NO_SIZETYPEDEFINE -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -DXCOM_HAVE_OPENSSL -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_USE_MATH_DEFINES -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/work/trosten/mysql/b -I/work/trosten/mysql/b/include -I/work/trosten/mysql/b/rapid -I/work/trosten/mysql -I/work/trosten/mysql/include -I/work/trosten/mysql/rapid -I/work/trosten/mysql/b/libbinlogevents/include -I/work/trosten/mysql/libbinlogevents/export -isystem /work/trosten/mysql/extra/zlib -isystem /work/trosten/mysql/b/extra/zlib -isystem /work/trosten/mysql/extra/yassl/include -isystem /work/trosten/mysql/extra/yassl/taocrypt/include -isystem /work/trosten/mysql/extra/libedit/editline -isystem /work/trosten/mysql/extra/lz4 -isystem /work/trosten/mysql/extra/rapidjson/include -I/work/trosten/mysql/b/rapid/plugin/group_replication/libmysqlgcs/xdr_gen -I/work/trosten/mysql/libbinlogevents/include  -Wall -Wextra -Wformat-security -Wvla -Wundef -Wmissing-format-attribute -Wwrite-strings -O2 -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer  -DDBUG_OFF   -DHAVE_YASSL -DYASSL_PREFIX -DHAVE_OPENSSL -DMULTI_THREADED -DYASSL_MYSQL_COMPATIBLE -Wno-unused-variable -Wno-unused-function -Wno-conversion -Wno-switch -DMYSQL_DYNAMIC_PLUGIN -o CMakeFiles/mysqlgcs.dir/src/bindings/xcom/xcom/pax_msg.c.o   -c /work/trosten/mysql/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/pax_msg.c
In file included from /work/trosten/mysql/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/node_connection.h:42:0,
                 from /work/trosten/mysql/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/task.h:41,
                 from /work/trosten/mysql/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/server_struct.h:26,
                 from /work/trosten/mysql/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/site_struct.h:26,
                 from /work/trosten/mysql/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/pax_msg.h:26,
                 from /work/trosten/mysql/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/pax_msg.c:23:
/work/trosten/mysql/b/rapid/plugin/group_replication/libmysqlgcs/xdr_gen/xcom_vp.h:9:10: fatal error: rpc/rpc.h: No such file or directory
 #include <rpc/rpc.h>
          ^~~~~~~~~~~
compilation terminated.

Suggested fix:
Add cmake code to detect where rpc.h  is and what rpc library to use.
[13 Feb 2018 3:24] Paul DuBois
Posted by developer:
 
Fixed in 5.7.22, 8.0.5.

Sun RPC is being removed from glibc. CMake now detects and uses
libtirpc if glibc does not contain Sun RPC. (You might find it
necessary to install libtirpc and rpcgen to take advantage of this
CMake feature.)
[3 Mar 2018 20:39] Terje Røsten
Marked as dup: https://bugs.mysql.com/bug.php?id=89776
[16 Nov 2018 22:31] Björn Voigt
MySQL 8.0.13 still does not compile with Glibc 2.27 (tested on openSUSE Tumbleweed 20181112):

[ 73%] Building C object plugin/group_replication/libmysqlgcs/CMakeFiles/mysqlgcs.dir/src/bindings/xcom/xcom/xcom_transport.c.o                                                                 
/home/bv/rpmbuild/BUILD/mysql-8.0.13/mysql-8.0.13/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_transport.c: In function ‘xdr_proto_sizeof’:
/home/bv/rpmbuild/BUILD/mysql-8.0.13/mysql-8.0.13/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_transport.c:511:18: error: assignment to ‘u_int (*)(struct __rpc_xdr *)’ {aka ‘unsigned int (*)(struct __rpc_xdr *)’} from incompatible pointer type ‘u_int (*)(const XDR *)’ {aka ‘unsigned int (*)(const struct __rpc_xdr *)’} [-Werror=incompatible-pointer-types]
   ops.x_getpostn = x_getpostn;
                  ^
/home/bv/rpmbuild/BUILD/mysql-8.0.13/mysql-8.0.13/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_transport.c:519:17: error: assignment to ‘bool_t (*)(struct __rpc_xdr *, long int *)’ {aka ‘int (*)(struct __rpc_xdr *, long int *)’} from incompatible pointer type ‘bool_t (*)(const XDR *, long int *)’ {aka ‘int (*)(const struct __rpc_xdr *, long int *)’} [-Werror=incompatible-pointer-types]
   ops.x_getlong = (dummyfunc1)harmless;
                 ^
/home/bv/rpmbuild/BUILD/mysql-8.0.13/mysql-8.0.13/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_transport.c:520:18: error: assignment to ‘bool_t (*)(struct __rpc_xdr *, char *, u_int)’ {aka ‘int (*)(struct __rpc_xdr *, char *, unsigned int)’} from incompatible pointer type ‘bool_t (*)(const XDR *, char *, u_int)’ {aka ‘int (*)(const struct __rpc_xdr *, char *, unsigned int)’} [-Werror=incompatible-pointer-types]
   ops.x_getbytes = (dummyfunc2)harmless;
                  ^
cc1: all warnings being treated as errors
[21 Nov 2018 10:09] Terje Røsten
Hi!

I am not able to reproduce on openSUSE Tumbleweed 20181118:

$ head -2 /etc/os-release
NAME="openSUSE Tumbleweed"
# VERSION="20181118"

$ rpm -q glibc
glibc-2.27-6.1.x86_64

$ rpm -q libtirpc-devel
libtirpc-devel-1.0.3-2.1.x86_64

$ gcc --version|head -1
gcc (SUSE Linux) 8.2.1 20181025 [gcc-8-branch revision 265488]

$ wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.13.tar.gz
$ tar xf mysql-boost-8.0.13.tar.gz
$ cd mysql-8.0.13
$ mkdir build && cd build
$ cmake .. -DWITH_BOOST=../boost
$ make -j$(nproc)
$ bin/mysqld -V 
/w/mysql-8.0.13/build/runtime_output_directory/mysqld  Ver 8.0.13 for Linux on x86_64 (Source distribution)
[22 Nov 2018 13:10] Björn Voigt
Okay, with your build configuration I can also compile without errors. But I can not compile a RPM for openSUSE Tumbleweed with the source RPM from SLES (SUSE Linux Enterprise Server) 15. (In this post (https://mysqlrelease.com/2018/10/adding-support-in-mysql-8-for-opensuse-and-sle-15/) openSUSE RPMs are announced, but I do not find them here: https://dev.mysql.com/downloads/mysql/. This is why I tried the SLES 15 RPMs for openSUSE)

The following example configuration (shortened from SLES 15 RPM) does not compile on openSUSE Tumbleweed:

[...same start like you described (download, mkdir build etc. ...]
  cmake .. \
           -DBUILD_CONFIG=mysql_release \
           -DINSTALL_LAYOUT=RPM \
           -DPIDFILE_RPM="/var/run/mysql/mysqld.pid" \
           -DLOGFILE_RPM="/var/log/mysql/mysqld.log" \
           -DCMAKE_BUILD_TYPE=Debug \
           -DWITH_BOOST=../boost \
           -DWITH_SYSTEMD=1 \
           -DSYSTEMD_SERVICE_NAME="mysql" \
           -DSYSTEMD_PID_DIR="/var/run/mysql" \
           -DWITH_NDBCLUSTER=1 \
           -DWITH_MEB=1 \
           -DWITH_INNODB_MEMCACHED=1 \
           -DROUTER_INSTALL_PLUGINDIR="%{_lib}/mysqlrouter" \
           -DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \
           -DMYSQLX_UNIX_ADDR="/var/run/mysql/mysqlx.sock" \
           -DFEATURE_SET="community" \
           -DWITH_NUMA=ON

  make
[...]
[ 72%] Building C object plugin/group_replication/libmysqlgcs/CMakeFiles/mysqlgcs.dir/src/bindings/xcom/xcom/xcom_transport.c.o
/data2/tmp/mysql-bug-89168/mysql-8.0.13/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_transport.c: In function ‘xdr_proto_sizeof’:
/data2/tmp/mysql-bug-89168/mysql-8.0.13/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_transport.c:504:18: error: assignment to ‘u_int (*)(struct __rpc_xdr *)’ {aka ‘unsigned int (*)(struct __rpc_xdr *)’} from incompatible pointer type ‘u_int (*)(const XDR *)’ {aka ‘unsigned int (*)(const struct __rpc_xdr *)’} [-Werror=incompatible-pointer-types]
   ops.x_getpostn = x_getpostn;
                  ^
cc1: all warnings being treated as errors
[23 Nov 2018 8:42] Terje Røsten
Hi again!

Please visit:
 https://dev.mysql.com/downloads/repo/suse/

to get RPMS and SRPMS for openSUSE 15 or browse directly:

 http://repo.mysql.com/yum/mysql-8.0-community/suse/15/x86_64/

Due to glibc changes and need of libtirpc, these RPMS might not rebuild clean
on openSUSE Tumbleweed.
[26 Nov 2018 10:35] Terje Røsten
hi!

Problem is related to location of tirpc headers on openSUSE,
which confuses cmake checks in MySQL.

I have created:

 https://bugs.mysql.com/bug.php?id=93341

to track this.