Bug 222428

Summary: lang/swift: fails to build with ICU 59.1
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Steve Wills <swills>
Status: Closed FIXED    
Severity: Affects Only Me CC: girgen, pusateri
Priority: --- Keywords: patch
Version: LatestFlags: bugzilla: maintainer-feedback? (swills)
Hardware: Any   
OS: Any   
URL: https://github.com/apple/swift/commit/b61c51b7b672
Bug Depends on:    
Bug Blocks: 218788    
Attachments:
Description Flags
fix build with ICU & clang none

Description Jan Beich freebsd_committer freebsd_triage 2017-09-18 17:38:43 UTC
/wrkdirs/usr/ports/lang/swift/work/swift-3.1.1/swift/stdlib/public/stubs/UnicodeNormalization.cpp:97:11: error: no matching function for call to 'ucol_openElements'
          ucol_openElements(Collator, Buffer, 1, &ErrorCode);
          ^~~~~~~~~~~~~~~~~
/usr/local/include/unicode/ucoleitr.h:113:1: note: candidate function not viable: no known conversion from 'uint16_t [1]' to 'const UChar *' (aka 'const char16_t *') for 2nd argument
ucol_openElements(const UCollator  *coll,
^
/wrkdirs/usr/ports/lang/swift/work/swift-3.1.1/swift/stdlib/public/stubs/UnicodeNormalization.cpp:138:10: error: no matching function for call to 'ucol_strcoll'
  return ucol_strcoll(GetRootCollator(),
         ^~~~~~~~~~~~
/usr/local/include/unicode/ucol.h:560:1: note: candidate function not viable: no known conversion from 'const uint16_t * _Nonnull' (aka 'const unsigned short *') to 'const UChar *' (aka 'const char16_t *') for 2nd argument
ucol_strcoll(    const    UCollator    *coll,
^
/wrkdirs/usr/ports/lang/swift/work/swift-3.1.1/swift/stdlib/public/stubs/UnicodeNormalization.cpp:163:3: error: no matching function for call to 'uiter_setString'
  uiter_setString(&RightIterator, RightString, RightLength);
  ^~~~~~~~~~~~~~~
/usr/local/include/unicode/uiter.h:594:1: note: candidate function not viable: no known conversion from 'const uint16_t * _Nonnull' (aka 'const unsigned short *') to 'const UChar *' (aka 'const char16_t *') for 2nd argument
uiter_setString(UCharIterator *iter, const UChar *s, int32_t length);
^
/wrkdirs/usr/ports/lang/swift/work/swift-3.1.1/swift/stdlib/public/stubs/UnicodeNormalization.cpp:207:43: error: no matching function for call to 'ucol_openElements'
  UCollationElements *CollationIterator = ucol_openElements(
                                          ^~~~~~~~~~~~~~~~~
/usr/local/include/unicode/ucoleitr.h:113:1: note: candidate function not viable: no known conversion from 'const __swift_uint16_t * _Nonnull' (aka 'const unsigned short *') to 'const UChar *' (aka 'const char16_t *') for 2nd argument
ucol_openElements(const UCollator  *coll,
^
/wrkdirs/usr/ports/lang/swift/work/swift-3.1.1/swift/stdlib/public/stubs/UnicodeNormalization.cpp:254:27: error: no matching function for call to 'u_strToUpper'
  uint32_t OutputLength = u_strToUpper(Destination, DestinationCapacity,
                          ^~~~~~~~~~~~
/usr/local/include/unicode/ustring.h:1083:1: note: candidate function not viable: no known conversion from 'uint16_t * _Nonnull' (aka 'unsigned short *') to 'UChar *' (aka 'char16_t *') for 1st argument
u_strToUpper(UChar *dest, int32_t destCapacity,
^
/wrkdirs/usr/ports/lang/swift/work/swift-3.1.1/swift/stdlib/public/stubs/UnicodeNormalization.cpp:281:27: error: no matching function for call to 'u_strToLower'
  uint32_t OutputLength = u_strToLower(Destination, DestinationCapacity,
                          ^~~~~~~~~~~~
/usr/local/include/unicode/ustring.h:1109:1: note: candidate function not viable: no known conversion from 'uint16_t * _Nonnull' (aka 'unsigned short *') to 'UChar *' (aka 'char16_t *') for 1st argument
u_strToLower(UChar *dest, int32_t destCapacity,
^

http://package18.nyi.freebsd.org/data/110amd64-default-PR218788/2017-09-18_05h19m21s/logs/errors/swift-3.1.1_1.log
Comment 1 Jan Beich freebsd_committer freebsd_triage 2017-09-18 17:52:06 UTC
Upstream has a fix but for some reason limited to Linux. I guess, only Apple platforms are weird enough to not support UChar abstraction.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2017-09-18 18:14:44 UTC
Bug 218788 will land next week, pressured by bug 221335 and 2016Q4 branching. Please, help if you want to avoid the port marked BROKEN.
Comment 3 Tom Pusateri 2017-10-04 01:42:05 UTC
just got bit by this one. I did a 'pkg upgrade' and it deleted swift and upgraded icu and firefox. Choosing between the latest firefox and swift is not a choice I wanted to make.
Comment 4 Palle Girgensohn freebsd_committer freebsd_triage 2017-10-08 16:12:33 UTC
Created attachment 187007 [details]
fix build with ICU & clang

Hi,

This patch fixes the build problems for clang. I just tested it with 11.1-amd64.

Palle
Comment 5 Palle Girgensohn freebsd_committer freebsd_triage 2017-10-09 21:39:52 UTC
@swills if you like I can commit the patch, it builds fine with it.

Palle
Comment 6 Steve Wills freebsd_committer freebsd_triage 2017-10-10 20:21:29 UTC
(In reply to Palle Girgensohn from comment #5)
Sure, go ahead.
Comment 7 commit-hook freebsd_committer freebsd_triage 2017-10-13 13:31:10 UTC
A commit references this bug:

Author: girgen
Date: Fri Oct 13 13:30:10 UTC 2017
New revision: 451995
URL: https://svnweb.freebsd.org/changeset/ports/451995

Log:
  Fix compile error with ICU 59

  Suggested by:	Jan Beich (linked to upstreams fix)
  PR:		222428
  Approved by:	@swills (maintainer)

Changes:
  head/lang/swift/Makefile
  head/lang/swift/files/patch-swift_stdlib_public_stubs_UnicodeNormalization.cpp
Comment 8 Palle Girgensohn freebsd_committer freebsd_triage 2017-10-13 13:32:33 UTC
Committed Jan Beich's suggested patch. Had to apply "manually". Thanks!