Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10.41 breaks compilation of MariaDB and other consumers #173

Closed
thesamesam opened this issue Dec 8, 2022 · 5 comments
Closed

10.41 breaks compilation of MariaDB and other consumers #173

thesamesam opened this issue Dec 8, 2022 · 5 comments

Comments

@thesamesam
Copy link

MariaDB fails to compile with libpcre2-10.41 like so:

FAILED: client/CMakeFiles/mariadb-test.dir/mysqltest.cc.o 
/usr/bin/x86_64-pc-linux-gnu-g++ -DDBUG_TRACE -DHAVE_CONFIG_H -DHAVE_DLOPEN -DHAVE_OPENSSL -D_FILE_OFFSET_BITS=64 -Dmariadb_test_EXPORTS -I/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/libmariadb/include -I/var/tmp/portage/dev-db/mariadb-10.5.17/work/mariadb-10.5.17_build/libmariadb/include -I/var/tmp/portage/dev-db/mariadb-10.5.17/work/mariadb-10.5.17_build/include -I/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/include -I/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/mysys_ssl -I/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/sql -I/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/strings -I/var/tmp/portage/dev-db/mariadb-10.5.17/work/mariadb-10.5.17_build/client -I/usr/include/readline  -O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -felide-constructors -fno-strict-aliasing -pie -fPIC -fstack-protector --param=ssp-buffer-size=4 -DNDEBUG -fno-omit-frame-pointer -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wenum-compare -Wenum-conversion -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -std=gnu++11 -DTHREADS -MD -MT client/CMakeFiles/mariadb-test.dir/mysqltest.cc.o -MF client/CMakeFiles/mariadb-test.dir/mysqltest.cc.o.d -o client/CMakeFiles/mariadb-test.dir/mysqltest.cc.o -c /var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc
In file included from /var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:49:
/usr/include/pcre2posix.h:147:47: error: expected initializer before ‘pcre2_regcomp’
  147 | PCRE2POSIX_EXP_DECL int PCRE2_CALL_CONVENTION pcre2_regcomp(regex_t *, const char *, int);
      |                                               ^~~~~~~~~~~~~
/usr/include/pcre2posix.h:148:47: error: expected initializer before ‘pcre2_regexec’
  148 | PCRE2POSIX_EXP_DECL int PCRE2_CALL_CONVENTION pcre2_regexec(const regex_t *, const char *, size_t,
      |                                               ^~~~~~~~~~~~~
/usr/include/pcre2posix.h:150:50: error: expected initializer before ‘pcre2_regerror’
  150 | PCRE2POSIX_EXP_DECL size_t PCRE2_CALL_CONVENTION pcre2_regerror(int, const regex_t *, char *, size_t);
      |                                                  ^~~~~~~~~~~~~~
/usr/include/pcre2posix.h:151:48: error: expected initializer before ‘pcre2_regfree’
  151 | PCRE2POSIX_EXP_DECL void PCRE2_CALL_CONVENTION pcre2_regfree(regex_t *);
      |                                                ^~~~~~~~~~~~~
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc: In function ‘void check_regerr(regex_t*, int)’:
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:7389:5: error: ‘pcre2_regerror’ was not declared in this scope; did you mean ‘PCRE2regerror’?
 7389 |     regerror(err,r,err_buf,sizeof(err_buf));
      |     ^~~~~~~~
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc: In function ‘char* re_eprint(int)’:
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:9246:11: error: ‘pcre2_regerror’ was not declared in this scope; did you mean ‘PCRE2regerror’?
 9246 |           regerror(err, (regex_t *)NULL, epbuf, sizeof(epbuf));
      |           ^~~~~~~~
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc: In function ‘void init_re_comp(regex_t*, const char*)’:
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:9253:12: error: ‘pcre2_regcomp’ was not declared in this scope; did you mean ‘PCRE2regcomp’?
 9253 |   int err= regcomp(re, str, (REG_EXTENDED | REG_ICASE | REG_NOSUB | REG_DOTALL));
      |            ^~~~~~~
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:9257:17: error: ‘pcre2_regerror’ was not declared in this scope; did you mean ‘PCRE2regerror’?
 9257 |     size_t len= regerror(err, re, erbuf, sizeof(erbuf));
      |                 ^~~~~~~~
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc: In function ‘int match_re(regex_t*, char*)’:
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:9353:12: error: ‘pcre2_regexec’ was not declared in this scope; did you mean ‘PCRE2regexec’?
 9353 |   int err= regexec(re, str, (size_t)0, NULL, 0);
      |            ^~~~~~~
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:9362:17: error: ‘pcre2_regerror’ was not declared in this scope; did you mean ‘PCRE2regerror’?
 9362 |     size_t len= regerror(err, re, erbuf, sizeof(erbuf));
      |                 ^~~~~~~~
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc: In function ‘void free_re()’:
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:9371:3: error: ‘pcre2_regfree’ was not declared in this scope; did you mean ‘PCRE2regfree’?
 9371 |   regfree(&ps_re);
      |   ^~~~~~~
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc: In function ‘int reg_replace(char**, int*, char*, char*, char*, int)’:
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:10862:18: error: ‘pcre2_regcomp’ was not declared in this scope; did you mean ‘PCRE2regcomp’?
10862 |   if ((err_code= regcomp(&r,pattern,cflags)))
      |                  ^~~~~~~
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:10879:15: error: ‘pcre2_regexec’ was not declared in this scope; did you mean ‘PCRE2regexec’?
10879 |     err_code= regexec(&r,str_p, r.re_nsub+1, subs,
      |               ^~~~~~~
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:10886:7: error: ‘pcre2_regfree’ was not declared in this scope; did you mean ‘PCRE2regfree’?
10886 |       regfree(&r);
      |       ^~~~~~~
/var/tmp/portage/dev-db/mariadb-10.5.17/work/mysql/client/mysqltest.cc:10999:3: error: ‘pcre2_regfree’ was not declared in this scope; did you mean ‘PCRE2regfree’?
10999 |   regfree(&r);
      |   ^~~~~~~

Initially reported downstream in Gentoo at https://bugs.gentoo.org/884705.

I suspect 1f5e47b caused this. Reverting to 10.40 or partly undoing 1f5e47b seems to fix it.

@thesamesam
Copy link
Author

cc @cbouc

@cbouc
Copy link
Contributor

cbouc commented Dec 8, 2022

To understand what's wrong, I'd need the result of the pre-compiler on mysqltest.cc to see myself what the context for the C++ compiler (don't know PCRE2POSIX_EXP_DECL and PCRE2_CALL_CONVENTION definitions here, or if they have at least an empty definition). Possibly, it's just a case of missing:

#ifndef PCRE2_CALL_CONVENTION
#define PCRE2_CALL_CONVENTION
#endif /*PCRE2_CALL_CONVENTION*/

in pcre2 common include files. Not able to build MariaDB by myself.

@cbouc
Copy link
Contributor

cbouc commented Dec 8, 2022

I think I pinpointed the problem:
pcre2.h contains this:

/* When compiling with the MSVC compiler, it is sometimes necessary to include
a "calling convention" before exported function names. (This is secondhand
information; I know nothing about MSVC myself). For example, something like

  void __cdecl function(....)

might be needed. In order so make this easy, all the exported functions have
PCRE2_CALL_CONVENTION just before their names. It is rarely needed; if not
set, we ensure here that it has no effect. */

#ifndef PCRE2_CALL_CONVENTION
#define PCRE2_CALL_CONVENTION
#endif

But not pcre2posix.h ! And MariaDB seems to be using that file (in mysqltest.cc : #include "pcre2posix.h" / pcreposix regex library */*). Also, pcre2posif.h only #include <stdlib.h>, nothing to default PCRE2_CALL_CONVENTION definition.
Adding the same defaulting as in pcre2.h for PCRE2_CALL_CONVENTION in pcre2posix.h should solve the issue.

@thesamesam
Copy link
Author

Thanks, I was off the computer yesterday. Let me take a look (although I note that cd8dc40 has been committed since which may fix it).

@thesamesam
Copy link
Author

thesamesam commented Dec 9, 2022

Yeah, that commit works for me. Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants