# build error xtrabackup-2.4.12



## bagas (Oct 4, 2018)

Hello.
Not going to port xtrabackup-2.4.12.
ports updated.

```
[ 26%] Building CXX object storage/innobase/CMakeFiles/innobase_embedded.dir/row/row0sel.cc.o
cd /usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/storage/innobase && /usr/bin/c++  -DCOMPILER_HINTS -DHAVE_CONFIG_H -DHAVE_IB_ATOMIC_PTHREAD_T_GCC=1 -DHAVE_IB_GCC_ATOMIC_COMPARE_EXCHANGE=1 -DHAVE_IB_GCC_ATOMIC_THREAD_FENCE=1 -DHAVE_IB_GCC_SYNC_SYNCHRONISE=1 -DHAVE_LIBEVENT1 -DHAVE_LZ4=1 -DHAVE_NANOSLEEP=1 -DMUTEX_EVENT -DXTRABACKUP -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/include -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/extra/rapidjson/include -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/libbinlogevents/include -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/libbinlogevents/export -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/extra/lz4 -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/storage/innobase/include -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/storage/innobase/handler -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/sql -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/sql/auth -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/regex -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/extra/yassl/include -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/extra/yassl/taocrypt/include -O -pipe -fstack-protector -fno-strict-aliasing -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter -Wno-null-conversion -Wno-unused-private-field -O -pipe -fstack-protector -fno-strict-aliasing -DDBUG_OFF   -fPIC -o CMakeFiles/innobase_embedded.dir/row/row0sel.cc.o -c /usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/storage/innobase/row/row0sel.cc
/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/storage/innobase/row/row0sel.cc:5178:29: error: comparison between pointer and integer ('void *' and 'int')
                    && prebuilt->idx_cond == false && end_loop >= 100) {
                       ~~~~~~~~~~~~~~~~~~ ^  ~~~~~
1 error generated.
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/xtrabackup
root@BASE_ELI:/usr/ports/databases/xtrabackup #
```


```
FreeBSD 11.2-RELEASE-p4 amd64
```


```
cat /etc/make.conf
CPUTYPE?=nocona
NO_PROFILE=true
CFLAGS= -O -pipe
#MAKE_JOBS_NUMBER=6
#NO_CLEAN=YES
NO_PROFILE=true
NO_CPU_CFLAGS=false
NO_CPU_COPTFLAGS=false
KERNCONF=base_eli_03102018
NO_GAMES=true
NO_INET6=true
NO_BLUETOOTH=true
NO_SHAREDOCS=true
WITHOUT_IPV6=yes
OPTIONS_UNSET=DOCS X11 IPV6
DEFAULT_VERSIONS+=perl5=5.24
MAKE_JOBS_UNSAFE=yes
```


```
# mysql -V
mysql  Ver 14.14 Distrib 5.6.41, for FreeBSD11.1 (amd64) using  EditLine wrapper
```
What to do?


----------



## SirDice (Oct 4, 2018)

Remove the CFLAGS from /etc/make.conf. And remove the default perl version, 5.24 has been deprecated a long time ago. Remove MAKE_JOBS_UNSAFE too, it's not an option you should or need to enable. It's for port developers/maintainers, it serves no other purpose.


----------



## bagas (Oct 4, 2018)

```
[ 26%] Building CXX object storage/innobase/CMakeFiles/innobase_embedded.dir/row/row0sel.cc.o
cd /usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/storage/innobase && /usr/bin/c++  -DCOMPILER_HINTS -DHAVE_CONFIG_H -DHAVE_IB_ATOMIC_PTHREAD_T_GCC=1 -DHAVE_IB_GCC_ATOMIC_COMPARE_EXCHANGE=1 -DHAVE_IB_GCC_ATOMIC_THREAD_FENCE=1 -DHAVE_IB_GCC_SYNC_SYNCHRONISE=1 -DHAVE_LIBEVENT1 -DHAVE_LZ4=1 -DHAVE_NANOSLEEP=1 -DMUTEX_EVENT -DXTRABACKUP -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/include -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/extra/rapidjson/include -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/libbinlogevents/include -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/libbinlogevents/export -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/extra/lz4 -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/storage/innobase/include -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/storage/innobase/handler -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/sql -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/sql/auth -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/regex -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/extra/yassl/include -I/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/extra/yassl/taocrypt/include -O2 -pipe -march=nocona -fstack-protector -fno-strict-aliasing -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter -Wno-null-conversion -Wno-unused-private-field -O2 -pipe -march=nocona -fstack-protector -fno-strict-aliasing -DDBUG_OFF   -fPIC -o CMakeFiles/innobase_embedded.dir/row/row0sel.cc.o -c /usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/storage/innobase/row/row0sel.cc
/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/storage/innobase/row/row0sel.cc:5178:29: error: comparison between pointer and integer ('void *' and 'int')
                    && prebuilt->idx_cond == false && end_loop >= 100) {
                       ~~~~~~~~~~~~~~~~~~ ^  ~~~~~
1 error generated.
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/xtrabackup
root@BASE_ELI:/usr/ports/databases/xtrabackup #
```


```
at /etc/make.conf
CPUTYPE?=nocona
#NO_PROFILE=true
#CFLAGS= -O -pipe
#MAKE_JOBS_NUMBER=6
#NO_CLEAN=YES
#NO_PROFILE=true
#NO_CPU_CFLAGS=false
#NO_CPU_COPTFLAGS=false
KERNCONF=base_eli_03102018
NO_GAMES=true
NO_INET6=true
NO_BLUETOOTH=true
NO_SHAREDOCS=true
WITHOUT_IPV6=yes
OPTIONS_UNSET=DOCS X11 IPV6
#DEFAULT_VERSIONS+=perl5=5.24
MAKE_JOBS_UNSAFE=yes
```


----------



## SirDice (Oct 4, 2018)

It's failing to build at exactly the same point on the official build clusters. So the port itself is broken at the moment.

http://beefy9.nyi.freebsd.org/data/112amd64-default/481092/logs/errors/xtrabackup-2.4.12.log

PR 230836


----------



## bagas (Oct 4, 2018)

SirDice said:


> It's failing to build at exactly the same point on the official build clusters. So the port itself is broken at the moment.


I do not want to put a pearl new.
So what to do?
Created a post in a bug report
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231943


----------



## Datapanic (Oct 4, 2018)

Here's the bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230836

There has been a fix attached to the bug report, however the maintainer has not done anything about it.  The fix does work.


----------



## bagas (Oct 4, 2018)

Datapanic said:


> Here's the bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230836
> 
> There has been a fix attached to the bug report, however the maintainer has not done anything about it.  The fix does work.


Do not have to apply patches, how to do it?


----------



## SirDice (Oct 4, 2018)

bagas said:


> Created a post in a bug report
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231943


Don't open new bug reports for existing issues. It will simply get closed as a duplicate ticket.


----------



## bagas (Oct 4, 2018)

did so, put the patch here  /usr/ports/databases/xtrabackup/files/patch-plugin_keyring_common_system__keys__container.cc

```
cat /usr/ports/databases/xtrabackup/files/patch-plugin_keyring_common_system__keys__container.cc
Index: databases/xtrabackup/files/patch-plugin_keyring_common_system__keys__container.cc
===================================================================
--- databases/xtrabackup/files/patch-plugin_keyring_common_system__keys__container.cc    (nonexistent)
+++ databases/xtrabackup/files/patch-plugin_keyring_common_system__keys__container.cc    (working copy)
@@ -0,0 +1,11 @@
+--- plugin/keyring/common/system_keys_container.cc.orig    2018-08-27 16:50:01 UTC
++++ plugin/keyring/common/system_keys_container.cc
+@@ -125,7 +125,7 @@ void System_keys_container::store_or_upd
+   if (is_system_key_with_version(key, system_key_id, key_version))
+   {
+     if (system_key_id_to_system_key.count(system_key_id) == 0) // add a new system key
+-      system_key_id_to_system_key.insert(std::make_pair<std::string, System_key_adapter*>(system_key_id, new System_key_adapter(key_version, key)));
++      system_key_id_to_system_key.insert(std::make_pair(system_key_id, new System_key_adapter(key_version, key)));
+     else
+       update_system_key(key, system_key_id, key_version);
+   }
Index: databases/xtrabackup/files/patch-storage_innobase_row_row0sel.cc
===================================================================
--- databases/xtrabackup/files/patch-storage_innobase_row_row0sel.cc    (nonexistent)
+++ databases/xtrabackup/files/patch-storage_innobase_row_row0sel.cc    (working copy)
@@ -0,0 +1,11 @@
+--- storage/innobase/row/row0sel.cc.orig    2018-08-27 16:21:56 UTC
++++ storage/innobase/row/row0sel.cc
+@@ -5175,7 +5175,7 @@ rec_loop:
+         reporting due to search views etc. */
+         if (prev_rec != NULL
+             && prebuilt->m_mysql_handler->end_range != NULL
+-            && prebuilt->idx_cond == false && end_loop >= 100) {
++            && prebuilt->idx_cond == NULL && end_loop >= 100) {
+
+             dict_index_t*    key_index = prebuilt->index;
+             bool        clust_templ_for_sec = false;
```



```
patch < /usr/ports/databases/xtrabackup/files/patch-plugin_keyring_common_system__keys__container.cc
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: databases/xtrabackup/files/patch-plugin_keyring_common_system__keys__container.cc
|===================================================================
|--- databases/xtrabackup/files/patch-plugin_keyring_common_system__keys__container.cc    (nonexistent)
|+++ databases/xtrabackup/files/patch-plugin_keyring_common_system__keys__container.cc    (working copy)
--------------------------
(Creating file patch-plugin_keyring_common_system__keys__container.cc...)
Patching file patch-plugin_keyring_common_system__keys__container.cc using Plan A...
Empty context always matches.
Hunk #1 succeeded at 1.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: databases/xtrabackup/files/patch-storage_innobase_row_row0sel.cc
|===================================================================
|--- databases/xtrabackup/files/patch-storage_innobase_row_row0sel.cc    (nonexistent)
|+++ databases/xtrabackup/files/patch-storage_innobase_row_row0sel.cc    (working copy)
--------------------------
(Creating file patch-storage_innobase_row_row0sel.cc...)
Patching file patch-storage_innobase_row_row0sel.cc using Plan A...
Empty context always matches.
Hunk #1 succeeded at 1.
done
root@BASE_ELI:/usr/ports/databases/xtrabackup #
```

# make install clean


```
/usr/ports/databases/xtrabackup/work/percona-xtrabackup-2.4.12/storage/innobase/row/row0sel.cc:5178:29: error: comparison between pointer and integer ('void *' and 'int')
                    && prebuilt->idx_cond == false && end_loop >= 100) {
                       ~~~~~~~~~~~~~~~~~~ ^  ~~~~~
1 error generated.
*** Error code 1
```


----------



## Datapanic (Oct 4, 2018)

Once you have the patch file in database/xtrabackup, you need to get the source distfiles and apply the patches.  From my notes, the process goes like this:

First, copy the patch attached to the bug report to /usr/ports/databases/xtrabackup/files/patch-llvm60

(Edited)
cd /usr/ports
patch < /usr/ports/databases/xtrabackup/files/patch-llvm60

Then,`cd /usr/ports/databases/xtrabackup` and...



```
make extract
make patch
make install
```


----------



## SirDice (Oct 5, 2018)

bagas said:


> ```
> patch < /usr/ports/databases/xtrabackup/files/patch-plugin_keyring_common_system__keys__container.cc
> ```



Patches in the files/ directory don't need to be applied by hand, they're automatically applied when you build the port.


----------

