Bug #94258 UNABLE TO BUILD ON WINDOWS - LINE ENDINGS IN uca9-dump.cc
Submitted: 8 Feb 2019 14:25 Modified: 13 Feb 2019 14:31
Reporter: Jens Even Blomsoy Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[8 Feb 2019 14:25] Jens Even Blomsoy
Description:
Unable to build on Windows, line endings in mysql-source\strings\uca9-dump.cc is not working as intended. 

The extension of the file is .txt and git has a feature to auto-convert line-endings on checkout.

Build crashes in:

418   // All these Japanese Han characters should be 3 bytes.
419   if ((ja_length % 3)) {
420     fprintf(stderr, "Wrong UTF8 Han character bytes.\n");
421     return 1;
422   }

  comp_err.dir\Debug\comp_err.obj
strings.lib(ctype-uca.obj) : error LNK2001: unresolved external symbol "unsigned short * * ja_han_pages" (?ja_han_pages@@3PAPEAGA) [C:\ade\mysql-build\utilities\comp_err.vcxproj]
strings.lib(ctype-uca.obj) : error LNK2001: unresolved external symbol "int const MIN_JA_HAN_PAGE" (?MIN_JA_HAN_PAGE@@3HB) [C:\ade\mysql-build\utilities\comp_err.vcxproj]
strings.lib(ctype-uca.obj) : error LNK2001: unresolved external symbol "int const MAX_JA_HAN_PAGE" (?MAX_JA_HAN_PAGE@@3HB) [C:\ade\mysql-build\utilities\comp_err.vcxproj]
C:\ade\mysql-build\runtime_output_directory\Debug\comp_err.exe : fatal error LNK1120: 3 unresolved externals [C:\ade\mysql-build\utilities\comp_err.vcxproj]
Done Building Project "C:\ade\mysql-build\utilities\comp_err.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\ade\mysql-build\utilities\GenError.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\ade\mysql-build\utilities\GenError.vcxproj" (default target) (1) ->
"C:\ade\mysql-build\utilities\comp_err.vcxproj" (default target) (3) ->
(Link target) ->
  strings.lib(ctype-uca.obj) : error LNK2001: unresolved external symbol "unsigned short * * ja_han_pages" (?ja_han_pages@@3PAPEAGA) [C:\ade\mysql-build\utilities\comp_err.vcxproj
]
  strings.lib(ctype-uca.obj) : error LNK2001: unresolved external symbol "int const MIN_JA_HAN_PAGE" (?MIN_JA_HAN_PAGE@@3HB) [C:\ade\mysql-build\utilities\comp_err.vcxproj]
  strings.lib(ctype-uca.obj) : error LNK2001: unresolved external symbol "int const MAX_JA_HAN_PAGE" (?MAX_JA_HAN_PAGE@@3HB) [C:\ade\mysql-build\utilities\comp_err.vcxproj]
  C:\ade\mysql-build\runtime_output_directory\Debug\comp_err.exe : fatal error LNK1120: 3 unresolved externals [C:\ade\mysql-build\utilities\comp_err.vcxproj]
    0 Warning(s)
    4 Error(s)
Time Elapsed 00:00:03.12

"C:\ade\mysql-build\utilities\comp_err.vcxproj" (default target) (1) ->
(Link target) ->
  strings.lib(ctype-uca.obj) : error LNK2001: unresolved external symbol "unsigned short * * ja_han_pages" (?ja_han_pag
es@@3PAPEAGA) [C:\ade\mysql-build\utilities\comp_err.vcxproj]
  strings.lib(ctype-uca.obj) : error LNK2001: unresolved external symbol "int const MIN_JA_HAN_PAGE" (?MIN_JA_HAN_PAGE@
@3HB) [C:\ade\mysql-build\utilities\comp_err.vcxproj]
  strings.lib(ctype-uca.obj) : error LNK2001: unresolved external symbol "int const MAX_JA_HAN_PAGE" (?MAX_JA_HAN_PAGE@
@3HB) [C:\ade\mysql-build\utilities\comp_err.vcxproj]
  C:\ade\mysql-build\runtime_output_directory\Debug\comp_err.exe : fatal error LNK1120: 3 unresolved externals [C:\ade\
mysql-build\utilities\comp_err.vcxproj]
    6 Warning(s)
    4 Error(s)
Time Elapsed 00:00:29.26

How to repeat:
On Windows:

C:\ade\mysql-build>C:/ade/mysql-build/runtime_output_directory/Debug/uca9dump.exe ja --in_file=C:/ade/mysql-source/strings/lang_data/ja_hans.txt --out_file=C:/ade/mysql-build/strings/uca900_ja_tbls.cc
Wrong UTF8 Han character bytes.

Suggested fix:

uca9-dump.cc
int dump_ja_hans

  if (ja_u8_bytes[ja_length - 1] == '\r') {
    ja_u8_bytes[ja_length - 1] = '\0';
    ja_length--;
   
  }
[8 Feb 2019 16:38] MySQL Verification Team
I've filed this already and been using my fix locally....
https://bugs.mysql.com/bug.php?id=93756
(can't build current trunk on windows due to trimming issue with uca9dump)
[12 Feb 2019 14:07] Steinar Gunderson
Posted by developer:
 
Probably a better way of fixing this is to turn off this git misfeature:

  git config --global core.eol lf

Optionally, it's possible to change it just for this specific file in .gitattributes:

  *_hans.txt text=false
[13 Feb 2019 14:31] Paul DuBois
Posted by developer:
 
Fixed in 8.0.17.

Bug affects no released version. No changelog entry needed.
[10 May 2019 4:48] Erlend Dahl
Bug#95178 MySql failed to build due to error C2039 and C3861 with MSVC on windows

was marked as a duplicate.