Bug 199556 - databases/mysql-udf fails to build with MariaDB
Summary: databases/mysql-udf fails to build with MariaDB
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Bernard Spil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-20 10:31 UTC by Beeblebrox
Modified: 2016-07-03 12:44 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (brnrd)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Beeblebrox 2015-04-20 10:31:53 UTC
I came accross this bug while trying to build databases/mysql-udf, which would fail to compile with "fatal error: 'mysql/<module_name>' file not found". Examination of the mariadb100-client modules showed path-prefix being specified in the "#include" statements. Removing the "mysql/" prefix corrects the problem.

My patch does not resolve all path problems (I did NOT do a grep search through all files in the mysql folder), it only addresses path issues with regards to compiling databases/mysql-udf. Other path issues may exist.

The semi-patch for this path problem is:

#1: include/my_global.h
@@ -1033 +1033 @@
- #include <mysql/plugin.h>  /* my_bool */
+ #include <plugin.h>  /* my_bool */

#2: include/mysql/plugin.h
@@ -51 +51 @@
- #include <mysql/services.h>
+ #include <services.h>

#3: include/mysql/services.h
@@ -22,32 +22,32 @@
- #include <mysql/service_my_snprintf.h>
- #include <mysql/service_thd_alloc.h>
- #include <mysql/service_thd_wait.h>
- #include <mysql/service_progress_report.h>
- #include <mysql/service_debug_sync.h>
- #include <mysql/service_kill_statement.h>
- #include <mysql/service_thd_timezone.h>
- #include <mysql/service_sha1.h>
- #include <mysql/service_logger.h>
- #include <mysql/service_thd_autoinc.h>
- #include <mysql/service_thd_error_context.h>
+ #include <service_my_snprintf.h>
+ #include <service_thd_alloc.h>
+ #include <service_thd_wait.h>
+ #include <service_progress_report.h>
+ #include <service_debug_sync.h>
+ #include <service_kill_statement.h>
+ #include <service_thd_timezone.h>
+ #include <service_sha1.h>
+ #include <service_logger.h>
+ #include <service_thd_autoinc.h>
+ #include <service_thd_error_context.h>

#4: include/mysql/my_pthread.h
@@ -721 +721 @@
- #include <mysql/psi/mysql_thread.h>
+ #include <psi/mysql_thread.h>

#5: include/mysql/psi/mysql_thread.h
@@ -57 +57 @@
- #include "mysql/psi/psi.h"
+ #include "psi/psi.h"

#6: include/mysql/my_sys.h
@@ -42, +42 @@
- #include <mysql/plugin.h>
+ #include <plugin.h> 

@@ -1010, +1010 @@
- #include <mysql/psi/psi.h>
+ #include <psi/psi.h>

#7: include/mysql/m_string.h
@@ -207 +207 @@
- #include <mysql/plugin.h>
+ #include <plugin.h>
Comment 1 Bernard Spil freebsd_committer 2015-05-03 15:30:20 UTC
Hi Raif,

Thanks for the patch! Will investigate this further.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2015-08-13 13:42:45 UTC
Over to new maintainer.
Comment 3 Bernard Spil freebsd_committer 2015-08-15 11:57:53 UTC
Hi Raif,

The problem is with databases/mysql-udf not with mariadb-client.

This patch solves the build issue
% diff -udp Makefile.orig Makefile
--- Makefile.orig       2015-08-15 13:55:14.929563914 +0200
+++ Makefile    2015-08-15 13:49:53.650585000 +0200
@@ -31,7 +31,7 @@ CFLAGS+=      -fPIC
 do-build:
 .for MODULE in ${MODULES}
        cd ${WRKSRC} && \
-       ${CC} ${CFLAGS} -I${LOCALBASE}/include -c -o udf_${MODULE}.o udf_${MODULE}.cc && \
+       ${CC} ${CFLAGS} -I${LOCALBASE}/include -I${LOCALBASE}/include/mysql -c -o udf_${MODULE}.o udf_${MODULE}.cc && \
        ${CC} -shared -o udf_${MODULE}.so udf_${MODULE}.o
 .endfor
Comment 4 Bernard Spil freebsd_committer 2015-08-23 14:21:14 UTC
I think I've come to the bottom of this now.

The problem is actually with the mysql-udf sources, not so much with MySQL/MariaDB. The sources include mysql's header files directly whereas these files are in a subdirectory of /usr/local/includes. This works on MySQL by chance as it doesn't pull in any of the mysql header files that include other header files. Including plugin.h or service.h (which have '#include <mysql/') would result in the same error using mysql.
Comment 5 Beeblebrox 2016-03-12 17:07:12 UTC
Although the initial error report seems resolved, the port still fails to build due to "unknown type name my_bool" message.

This argument is type is present in at least
my_dbug.h, my_pthread.h
I assume the type needs to be declared at some top level...
Comment 6 commit-hook freebsd_committer 2016-07-03 12:44:14 UTC
A commit references this bug:

Author: brnrd
Date: Sun Jul  3 12:43:28 UTC 2016
New revision: 417969
URL: https://svnweb.freebsd.org/changeset/ports/417969

Log:
  databases/mysql-udf: Fix building with MariaDB

    - Work around MySQL's include/mysql/mysql directory
      - Add -I ${LOCALBASE}/include to CFLAGS
    - Move from USE_MYSQL to USES= mysql

  PR:		199556

Changes:
  head/databases/mysql-udf/Makefile
  head/databases/mysql-udf/distinfo