Bug #111190 Build fails with LANG=ja_JP.UTF-8
Submitted: 29 May 2023 17:12 Modified: 23 Jun 2023 18:40
Reporter: Kento Takeuchi (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.31, 8.0.32, 8.0.33 OS:Linux (PopOS! 22.04)
Assigned to: CPU Architecture:x86
Tags: cmake, Contribution

[29 May 2023 17:12] Kento Takeuchi
Description:
When building MySQL, if the value of the environment variable LANG is not C, the build fails because the readelf result cannot be grepped.

The problem with this is related to missing the string "Build Id:" when getting the build-id from readelf, causing the next build-id check to fail.

First build failed commit: 321f106987a3fd62035057c8b544e7a874bc76d3

If MySQL is built with LANG=ja_JP.UTF-8, the readelf results are:
$ cd mysql-server/build/runtime_output_directory && /usr/bin/readelf -n ./build_id_test
Displaying notes found in: .note.gnu.property
  所有者            データサイズ	Description
  GNU                  0x00000020	NT_GNU_PROPERTY_TYPE_0
      Properties: x86 feature: IBT, SHSTK
	x86 ISA needed: x86-64-baseline

Displaying notes found in: .note.gnu.build-id
  所有者            データサイズ	Description
  GNU                  0x00000014	NT_GNU_BUILD_ID (一意なビルドID ビット列)
    ビルドID: 55fc665151e52fbbddb526fe78e4f23d5d7c6e3c

Displaying notes found in: .note.ABI-tag
  所有者            データサイズ	Description
  GNU                  0x00000010	NT_GNU_ABI_TAG (ABI バージョンタグ)
    OS: Linux, ABI: 3.2.0

How to repeat:
Build MySQL with locale other than English.
In my environment, the build failed when the locale was set to "ja_JP.UTF-8".

Suggested fix:
A successful build should result in the following output:
$ cd mysql-server/build/runtime_output_directory && /usr/bin/readelf -n ./build_id_test 
Displaying notes found in: .note.gnu.property
  Owner                Data size 	Description
  GNU                  0x00000020	NT_GNU_PROPERTY_TYPE_0
      Properties: x86 feature: IBT, SHSTK
	x86 ISA needed: x86-64-baseline

Displaying notes found in: .note.gnu.build-id
  Owner                Data size 	Description
  GNU                  0x00000014	NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: 55fc665151e52fbbddb526fe78e4f23d5d7c6e3c

Displaying notes found in: .note.ABI-tag
  Owner                Data size 	Description
  GNU                  0x00000010	NT_GNU_ABI_TAG (ABI version tag)
    OS: Linux, ABI: 3.2.0

The environment variable LANG must be fixed at build time.
[29 May 2023 17:14] Kento Takeuchi
Patch mysys/CMakeLists.txt

Attachment: mysql-mysys-cmake.patch (text/x-patch), 910 bytes.

[29 May 2023 17:44] Kento Takeuchi
Fix Synopsis
[30 May 2023 8:15] MySQL Verification Team
Hello Kento Takeuchi,

Thank you very much for your report and patch contribution, we appreciate it!
In order for us to continue the process of reviewing your contribution to MySQL, please send us a signed copy of the Oracle Contributor Agreement (OCA) as outlined in https://oca.opensource.oracle.com

Signing an OCA needs to be done only once and it's valid for all other Oracle governed Open Source projects as well.

Getting a signed/approved OCA on file will help us facilitate your contribution - this one, and others in the future.  

Please let me know, if you have any questions.

Thank you for your interest in MySQL.

regards,
Umesh
[30 May 2023 10:11] Kento Takeuchi
Hi MySQL Verification Team.

I signed OCA in https://oca.opensource.oracle.com, and it was approved.
Please confirm my signed OCA.

Thanks.
[1 Jun 2023 6:44] MySQL Verification Team
Thank you, Kento Takeuchi San.
I suggest your to re-upload your patch using the "Contributions" tab of this bug page otherwise we may not be able to use. 

regards,
Umesh
[1 Jun 2023 7:28] Kento Takeuchi
re-upload mysys/CMakeLists.txt patch

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

Contribution: mysql-mysys-cmake.patch (text/x-patch), 910 bytes.

[23 Jun 2023 18:40] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Server 8.0.34 and 8.1.0 releases, and here's the proposed changelog entry from the documentation team:

MySQL now sets LANG=C in the environment when executing readelf to avoid
problems with non-ascii output.

Our thanks to Kento Takeuchi for the contribution.

Thank you for the bug report.