Bug 248114

Summary: databases/mariadb105-server: Fails to build with MIT Kerberos: gssapi_server.cc:79:5: error: use of undeclared identifier 'krb5_xfree'
Product: Ports & Packages Reporter: Naram Qashat <cyberbotx>
Component: Individual Port(s)Assignee: Bernard Spil <brnrd>
Status: Closed Overcome By Events    
Severity: Affects Some People CC: bofh, mhfb
Priority: --- Keywords: needs-patch, needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (brnrd)
koobs: merge-quarterly?
Hardware: Any   
OS: Any   

Description Naram Qashat 2020-07-19 20:56:21 UTC
I attempted to build databases/mariadb105-server in poudriere on an amd64 machine with GSSAPI_BASE disabled and GSSAPI_MIT enabled, the build fails as such:

[00:18:30] [1158/1977] /usr/bin/c++  -DDBUG_TRACE -DHAVE_CONFIG_H -DMYSQL_DYNAMIC_PLUGIN -DPLUGIN_GSSAPI -Dauth_gssapi_EXPORTS -Iinclude -Isql -O2 -pipe -L/usr/local/lib -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -O2 -pipe -L/usr/local/lib -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -DDBUG_OFF -fPIC   -isystem /usr/local/include -std=gnu++11 -MD -MT plugin/auth_gssapi/CMakeFiles/auth_gssapi.dir/gssapi_server.cc.o -MF plugin/auth_gssapi/CMakeFiles/auth_gssapi.dir/gssapi_server.cc.o.d -o plugin/auth_gssapi/CMakeFiles/auth_gssapi.dir/gssapi_server.cc.o -c plugin/auth_gssapi/gssapi_server.cc
[00:18:30] FAILED: plugin/auth_gssapi/CMakeFiles/auth_gssapi.dir/gssapi_server.cc.o 
[00:18:30] /usr/bin/c++  -DDBUG_TRACE -DHAVE_CONFIG_H -DMYSQL_DYNAMIC_PLUGIN -DPLUGIN_GSSAPI -Dauth_gssapi_EXPORTS -Iinclude -Isql -O2 -pipe -L/usr/local/lib -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -O2 -pipe -L/usr/local/lib -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -DDBUG_OFF -fPIC   -isystem /usr/local/include -std=gnu++11 -MD -MT plugin/auth_gssapi/CMakeFiles/auth_gssapi.dir/gssapi_server.cc.o -MF plugin/auth_gssapi/CMakeFiles/auth_gssapi.dir/gssapi_server.cc.o.d -o plugin/auth_gssapi/CMakeFiles/auth_gssapi.dir/gssapi_server.cc.o -c plugin/auth_gssapi/gssapi_server.cc
[00:18:30] c++: warning: argument unused during compilation: '-L/usr/local/lib' [-Wunused-command-line-argument]
[00:18:30] c++: warning: argument unused during compilation: '-L/usr/local/lib' [-Wunused-command-line-argument]
[00:18:30] plugin/auth_gssapi/gssapi_server.cc:79:5: error: use of undeclared identifier 'krb5_xfree'
[00:18:30]     krb5_free_unparsed_name(context, unparsed_name);
[00:18:30]     ^
[00:18:30] plugin/auth_gssapi/gssapi_server.cc:34:38: note: expanded from macro 'krb5_free_unparsed_name'
[00:18:30] #define krb5_free_unparsed_name(a,b) krb5_xfree(b)
[00:18:30]                                      ^
[00:18:30] 1 error generated.
[00:18:30] ninja: build stopped: subcommand failed.
[00:18:30] *** Error code 1
[00:18:30] 
[00:18:30] Stop.
[00:18:30] make: stopped in /usr/ports/databases/mariadb105-server

From extracting security/krb5 and checking its sources, there is no krb5_xfree in that port.

I'm honestly not sure why this is happening, looking at mariadb's source code for 10.5, the CMakeLists.txt for auth_gssapi should be checking for krb5_xfree in krb5.h and only set the HAVE_KRB5_XFREE definition is that is the case, but as can be seen in the above, there is no -DHAVE_KRB5_XFREE in the c++ invocation . To me this rules out that it is finding the definition of krb5_xfree in the base implementation.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2020-07-20 02:03:13 UTC
Do other databases/mariadb*-server fail in the same manner?
Comment 2 Naram Qashat 2020-07-20 03:49:34 UTC
I've only ever tried to compile mariadb103-server and mariadb104-server with those options in the past and have not had any errors in building those. I do not know about the older ones.
Comment 3 Mariusz J. Handke 2020-07-20 16:36:47 UTC
I'm having the same iussue with 10.5 and tried 10.4 which compiles with no issues with the same make flags used.
Comment 4 Bernard Spil freebsd_committer freebsd_triage 2020-07-24 18:55:15 UTC
Hi @Naram, @Mariusz, can you chase this patch down to a working svn diff for the port? Sounds like it also needs a ticket in upstream JIRA.

This was introduced a month ago in https://github.com/MariaDB/server/commit/93cee30309588b62312debba714eec06ea5b2063 perhaps they broke MIT compat?
Comment 5 Naram Qashat 2020-07-24 19:29:06 UTC
I would assume that commit is the reason for the breakage, but past that, I don't know how we could patch the FreeBSD port or what sort of patch would need to be submitted upstream.

I also can't see why that commit would break things, as mentioned in my initial comment, there doesn't seem to be any reference to HAVE_KRB5_XFREE in the c++ call so the directive isn't defined which means it shouldn't actually be using that redefine macro at all. There must be something else going on that I'm not seeing.
Comment 6 Michael Havemester 2020-08-04 07:04:16 UTC
I'm having the same build issue with default options (no entry in /var/db/ports/databases_mariadb105-server or any earlier version of it) on FreeBSD-12.1-RELEASE-p7, I'm using make -DBATCH.

I noticed one change (10.4 -> 10.5) in plugin/auth_gssapi/CMakeLists.txt

SET(CMAKE_REQUIRED_FLAGS "-Werror -Wall")

This was added in 10.5.

After removing this line manually, the build finishes without problems.
Comment 7 Naram Qashat 2020-08-31 17:35:33 UTC
I think this could probably be closed now. The recent update to 10.5.5 appears to no longer have a build failure due to this.
Comment 8 Bernard Spil freebsd_committer freebsd_triage 2020-10-24 09:13:07 UTC
As per Naram's comment, fixed in 10.5.5