Bug #100217 Can not compile InnoDB memcached Plugin in 5.7.31 and 5.6.49
Submitted: 14 Jul 2020 14:55 Modified: 15 Jul 2020 7:14
Reporter: Björn Voigt (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Memcached Severity:S3 (Non-critical)
Version:5.7.31 OS:Any
Assigned to: CPU Architecture:Any
Tags: Compilation, compile, gcc, InnoDB Memcached Plugin

[14 Jul 2020 14:55] Björn Voigt
Description:
The InnoDB Memcached Plugin does not compile correctly. The bug is probably only visible when using modern Linux development systems (tested with GCC C++ 10.1.1 on openSUSE Tumbleweed 20200710). Older systems (tested with GCC C++ 7 on openSUSE Leap 15.1) are unaffected. Also MySQL 8.0.21 is unaffected.

The linker complains about multiple definitions of functions from plugin/innodb_memcached/innodb_memcache/include/innodb_cb_api.h.

How to repeat:
1. Download mysql(-boost)-5.7.31.tar.gz or mysql-5.6.49.tar.gz
2. Unpack MySQL
3. cd mysql-*
4. mkdir build
5. cd build
6. cmake -DWITH_INNODB_MEMCACHED=ON ..
7. make

Suggested fix:
The bug is already fixed in MySQL 8.0.21.
[14 Jul 2020 14:59] Björn Voigt
GCC C++ error messages

Attachment: mysql-5.7.31-make.log (text/x-log), 46.05 KiB.

[15 Jul 2020 7:14] MySQL Verification Team
Hi,

Thanks for the report. I assume our build team is aware of this since they already fixed it for 8.0 branch so I assume fix for 5.7 is already on the way. In any case I'm verifying the bug report so we can track when it is fixed.

kind regards
Bogdan
[23 Aug 2022 12:55] Christopher Chavez
Affected compilers appear to be GCC 10 and later, and LLVM 11 and later, since these made `-fno-common` the default behavior.

The fix in 8.0 seems to be to use `extern` where appropriate in innodb_cb_api.h, and move definitions to (what is now) innodb_api.cc, see https://github.com/mysql/mysql-server/commit/05596f6f42a7

A less invasive workaround would be to specify `-fcommon` in CMAKE_C_FLAGS in plugin/innodb_memcached/innodb_memcache/CMakeLists.txt
[23 Aug 2022 12:59] Christopher Chavez
Workaround for MySQL 5.7

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: patch-innodb_engine-fcommon.diff (application/octet-stream, text), 507 bytes.