[MDEV-7209] mroonga storage engine fails to build on OpenBSD Created: 2014-11-26  Updated: 2021-08-13  Resolved: 2021-07-27

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Mroonga
Affects Version/s: 10.5.8
Fix Version/s: 10.2.40, 10.3.31, 10.4.21, 10.5.12, 10.6.4

Type: Bug Priority: Blocker
Reporter: Brad Smith Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

OpenBSD



 Description   

The mroonga storage engine fails to build on OpenBSD.

Updating this for 10.5 it is now failing in a different manner.

humpty$ make
===>  Building for mariadb-10.5.8
[1/102] cd /home/ports/pobj/mariadb-10.5.8/build-amd64 && /usr/local/bin/cmake -P /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/cmake/info_src.cmake
[2/102] cd /home/ports/pobj/mariadb-10.5.8/build-amd64 && /usr/local/bin/cmake -P /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/cmake/info_bin.cmake
[3/102] /home/ports/pobj/mariadb-10.5.8/bin/c++  -DDBUG_TRACE -DHAVE_CONFIG_H -DMRN_GROONGA_EMBEDDED -DMRN_GROONGA_NORMALIZER_MYSQL_EMBEDDED -DMYSQL_DYNAMIC_PLUGIN -DWITH_GROONGA_NORMALIZER_MYSQL=1 -Dmroonga_EXPORTS -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/wsrep-l
ib/include -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/wsrep-lib/wsrep-API/v26 -Iinclude -Istorage/mroonga -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/lib -I/home/ports/pobj/mariadb
-10.5.8/mariadb-10.5.8/include -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/sql -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/regex -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8 -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/vendor/groonga/incl
ude -O2 -pipe  -I/usr/local/include -fstack-protector --param=ssp-buffer-size=4 -DNDEBUG -D_FORTIFY_SOURCE=2 -DDBUG_OFF -fPIC   -std=gnu++11 -MD -MT storage/mroonga/CMakeFiles/mroonga.dir/ha_mroonga.cpp.o -MF storage/mroonga/CMakeFiles/mroonga.dir/ha_mroonga.cpp.o.d -o st
orage/mroonga/CMakeFiles/mroonga.dir/ha_mroonga.cpp.o -c /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/ha_mroonga.cpp
FAILED: storage/mroonga/CMakeFiles/mroonga.dir/ha_mroonga.cpp.o
/home/ports/pobj/mariadb-10.5.8/bin/c++  -DDBUG_TRACE -DHAVE_CONFIG_H -DMRN_GROONGA_EMBEDDED -DMRN_GROONGA_NORMALIZER_MYSQL_EMBEDDED -DMYSQL_DYNAMIC_PLUGIN -DWITH_GROONGA_NORMALIZER_MYSQL=1 -Dmroonga_EXPORTS -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/wsrep-lib/inclu
de -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/wsrep-lib/wsrep-API/v26 -Iinclude -Istorage/mroonga -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/lib -I/home/ports/pobj/mariadb-10.5.8/
mariadb-10.5.8/include -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/sql -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/regex -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8 -I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/vendor/groonga/include -O2
-pipe  -I/usr/local/include -fstack-protector --param=ssp-buffer-size=4 -DNDEBUG -D_FORTIFY_SOURCE=2 -DDBUG_OFF -fPIC   -std=gnu++11 -MD -MT storage/mroonga/CMakeFiles/mroonga.dir/ha_mroonga.cpp.o -MF storage/mroonga/CMakeFiles/mroonga.dir/ha_mroonga.cpp.o.d -o storage/mr
oonga/CMakeFiles/mroonga.dir/ha_mroonga.cpp.o -c /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/ha_mroonga.cpp
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/ha_mroonga.cpp:23:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/mrn_mysql.h:24:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/include/my_global.h:320:
In file included from /usr/include/c++/v1/math.h:309:
In file included from /usr/include/c++/v1/type_traits:406:
In file included from /usr/include/c++/v1/cstddef:38:
/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/version:1:1: error: expected unqualified-id
7.07
^
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/ha_mroonga.cpp:23:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/mrn_mysql.h:24:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/include/my_global.h:320:
In file included from /usr/include/c++/v1/math.h:309:
In file included from /usr/include/c++/v1/type_traits:407:
/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/version:1:1: error: expected unqualified-id
7.07
^
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/ha_mroonga.cpp:23:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/mrn_mysql.h:24:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/include/my_global.h:320:
In file included from /usr/include/c++/v1/math.h:310:
In file included from /usr/include/c++/v1/limits:122:
/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/version:1:1: error: expected unqualified-id
7.07
^
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/ha_mroonga.cpp:23:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/mrn_mysql.h:24:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/include/my_global.h:1127:
In file included from /usr/include/c++/v1/new:85:
In file included from /usr/include/c++/v1/exception:84:
/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/version:1:1: error: expected unqualified-id
7.07
^
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/ha_mroonga.cpp:23:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/mrn_mysql.h:24:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/include/my_global.h:1127:
In file included from /usr/include/c++/v1/new:88:
/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/version:1:1: error: expected unqualified-id
7.07
^
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/ha_mroonga.cpp:23:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/mrn_mysql.h:51:
In file included from /home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/sql/sql_class.h:23:
In file included from /usr/include/c++/v1/atomic:547:
/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga/version:1:1: error: expected unqualified-id
7.07
^
.....



 Comments   
Comment by Brad Smith [ 2014-12-08 ]

Any comment? I can build test any proposed diffs even against a 10.0.15 code base.

Comment by Brad Smith [ 2014-12-16 ]

ping.

Comment by Brad Smith [ 2015-01-28 ]

Still broken with 10.0.16.

Comment by carrie h [ 2015-02-16 ]

I'm encountering this exact issue on OpenBSD 5.6 GENERIC.MP#333 amd64 during the initial make for versions 10.0.15 and 10.0.16.

Comment by Jon Tibble [ 2015-03-29 ]

This also affects illumos/Solaris based OSs. The following fixed this particular issue for me:

--- mariadb-10.0.17/configure.cmake.~1~ 2015-02-25 15:40:53.000000000 +0000
+++ mariadb-10.0.17/configure.cmake     2015-03-28 19:31:19.075448106 +0000
@@ -196,6 +196,7 @@
 CHECK_INCLUDE_FILES (memory.h HAVE_MEMORY_H)
 CHECK_INCLUDE_FILES (ndir.h HAVE_NDIR_H)
 CHECK_INCLUDE_FILES (netinet/in.h HAVE_NETINET_IN_H)
+CHECK_INCLUDE_FILES ("sys/types.h;netinet/tcp.h" HAVE_NETINET_TCP_H)
 CHECK_INCLUDE_FILES (paths.h HAVE_PATHS_H)
 CHECK_INCLUDE_FILES (port.h HAVE_PORT_H)
 CHECK_INCLUDE_FILES (poll.h HAVE_POLL_H)

Comment by Kouhei Sutou [ 2015-05-06 ]

Groonga at master is buildable on OpenBSD. This issue will be fixed when new Groonga is released (It will be released at 2015-05-29) and bundled into MariaDB.

Comment by Brad Smith [ 2015-08-30 ]

Building 10.0.21 the issue still exists there. Again the issue is the netinet/tcp.h header check is failing due to the fact that sys/types.h header is not being included at the same time which is required for netinet/tcp.h. The patch Job Tibble posted seems to work but to me it feels like the wrong place to fix the issue. It should be in the Mroonga specific bits of code with regard to the CMake / autoconf infrastructure.

Comment by Kouhei Sutou [ 2015-09-04 ]

Could you try http://packages.groonga.org/source/mroonga/mariadb-10.0.21-with-mroonga-5.06.tar.gz ?

It replaces bundled Mroonga with the latest Mroonga. If it solves this problem, we can solve this problem by updating bundled Mroonga.

Comment by Brad Smith [ 2016-08-30 ]

Since our OpenBSD port has Mroonga disabled (until this is fixed) I forgot about this issue. It still exists with 10.0.27.

/home/ports/pobj/mariadb-10.0.27/mariadb-10.0.27/storage/mroonga/vendor/groonga/lib/com.c: In function 'grn_com_copen':
/home/ports/pobj/mariadb-10.0.27/mariadb-10.0.27/storage/mroonga/vendor/groonga/lib/com.c:976: error: 'TCP_NODELAY' undeclared (first use in this function)
/home/ports/pobj/mariadb-10.0.27/mariadb-10.0.27/storage/mroonga/vendor/groonga/lib/com.c:976: error: (Each undeclared identifier is reported only once
/home/ports/pobj/mariadb-10.0.27/mariadb-10.0.27/storage/mroonga/vendor/groonga/lib/com.c:976: error: for each function it appears in.)
/home/ports/pobj/mariadb-10.0.27/mariadb-10.0.27/storage/mroonga/vendor/groonga/lib/com.c: In function 'grn_com_sopen':
/home/ports/pobj/mariadb-10.0.27/mariadb-10.0.27/storage/mroonga/vendor/groonga/lib/com.c:1094: error: 'TCP_NODELAY' undeclared (first use in this function)

Comment by Kouhei Sutou [ 2016-08-30 ]

Thanks for your report.
I've fixed it as https://github.com/groonga/groonga/commit/ed2045bc1dc985f71af4e290ec460bd2fec96ebe

Mroonga will be able to build on OpenBSD when the latest Groonga and Mroonga are merged into MariaDB.

Comment by Brad Smith [ 2016-08-30 ]

Except that did not fix anything. It's a nasty workaround. OpenBSD does have TCP_NODELAY. It is in netinet/tcp.h where it should be. The problem is with the CMake test that is testing for the existence of netinet/tcp.h, the test needs to test sys/types.h + netinet/tcp.h. As Jon pointed out this also affects illumos/Solaris.

Comment by Kouhei Sutou [ 2016-08-30 ]

Do you know a document that TCP_NODELAY requires sys/types.h + netinet/tcp.h?

http://man.openbsd.org/OpenBSD-5.9/tcp.4 says only netinet/tcp.h:

> TCP_NODELAY (from <netinet/tcp.h>)

Comment by Kouhei Sutou [ 2016-08-30 ]

MariaDB 10.0.27 still bundles old Mroonga and Groonga.
I hope that they are updated to the latest version.

Comment by Brad Smith [ 2020-11-16 ]

I updated the ticket since it is still open but it was based on 10.0 way back in 2016. Now we're using 10.5.

Comment by Sergei Golubchik [ 2020-11-19 ]

komainu8, is it something you would want to look at?

Comment by Horimoto Yasuhiro [ 2020-11-24 ]

Probably, this problem is caused by the Mroonga version is old.
So, I think I can't find anything for resolving this problem for now.

So, first of all, we update to the latest the Mroonga that is included in MariaDB.
Next, I hope that I confirm that this problem whither reproduces or not on the latest Mroonga.

Comment by Daniel Nachun [ 2021-07-02 ]

I'm a Homebrew maintainer and we recently identified the root cause of this problem. Some versions of Clang expect any file called "version" (or "VERSION" on macOS, due to case insensitivity) to have a certain format (a better explanation is that Clang mistakes the version/VERSION files for the "version" header that is part of its standard library). There are currently several files called "version/VERSION" in the include paths of the mroonga plugin which cause this failure. A similar issue was already fixed by MDEV-25543 for a different plugin, and we have implemented a temporary fix in https://github.com/Homebrew/homebrew-core/pull/79696, by renaming the offending files, or removing directories which contain them from include paths. This is also related to MDEV-25716, which is caused by the same issue. Please follow up if more information is needed to get this resolved.

Comment by Brad Smith [ 2021-07-03 ]

Oh. I see what you're talking about. From the error, looking at /usr/include/c++/v1/cstddef.. which has...

#include <__config>
#include <version>

and there are some header paths added (-I/home/ports/pobj/mariadb-10.5.8/mariadb-10.5.8/storage/mroonga) during the build which happen to have files named "version". I was wondering why we had not run into this with libmarias3 but then I noticed it's VERSION there instead of version so we luck out due to case sensitivity.

Comment by Daniel Nachun [ 2021-07-03 ]

Actually this is a problem for libmarias3 as well because macOS is not case sensitive, but it was resolved in a commit that hasn't made it into 10.5 yet: https://github.com/mariadb-corporation/libmarias3/commit/c71898f82598.

Comment by Oleksandr Byelkin [ 2021-07-27 ]

commit 4fc25ed235e9a4cd8fddba0f76ec4cb94cf37ea5 (HEAD -> bb-10.2-MDEV-7209, origin/bb-10.2-MDEV-7209)
Author: Oleksandr Byelkin <sanja@mariadb.com>
Date:   Tue Jul 20 14:47:24 2021 +0200
 
    MDEV-7209 mroonga storage engine fails to build on OpenBSD
    
    Rename VERSION -> VERSION.txt

Comment by Brad Smith [ 2021-08-13 ]

Thanks. With 10.6.4 out we're now shipping Mroonga with our port / package in -current.

Generated at Thu Feb 08 07:17:50 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.