I'm running into some issues when trying to use the new Regex
type on Linux:
-
It seems to require the
-Xswiftc -enable-bare-slash-regex
flag or to import_StringProcessing
, even when not using the bare-slash-syntax. I don't believe macOS / Xcode has this requirement. -
Regex
does not appear work with--static-swift-stdlib
.
Example link failure output
/usr/bin/ld.gold: error: /home/patrick/.swiftly/toolchains/5.7.0/usr/lib/swift_static/linux/libswiftCore.a(UnicodeScalarProps.cpp.o): multiple definition of '_swift_stdlib_getScript'
/usr/bin/ld.gold: /home/patrick/.swiftly/toolchains/5.7.0/usr/lib/swift_static/linux/libswift_StringProcessing.a(UnicodeScalarProps.c.o): previous definition here
/usr/bin/ld.gold: error: /home/patrick/.swiftly/toolchains/5.7.0/usr/lib/swift_static/linux/libswiftCore.a(UnicodeScalarProps.cpp.o): multiple definition of '_swift_stdlib_getScriptExtensions'
/usr/bin/ld.gold: /home/patrick/.swiftly/toolchains/5.7.0/usr/lib/swift_static/linux/libswift_StringProcessing.a(UnicodeScalarProps.c.o): previous definition here
/home/patrick/.swiftly/toolchains/5.7.0/usr/lib/swift_static/linux/libswift_StringProcessing.a(_StringProcessing.o):_StringProcessing.o:function $s17_StringProcessing5RegexV5MatchV6outputxvg: error: undefined reference to '$s12_RegexParser16TypeConstructionO5tuple2ofypxn_tSKRzyp7ElementRtzlFZ'
/home/patrick/.swiftly/toolchains/5.7.0/usr/lib/swift_static/linux/libswift_StringProcessing.a(_StringProcessing.o):_StringProcessing.o:function $s17_StringProcessing8CompilerC11ByteCodeGenV8emitNode33_39AB0CA4F16DF29C6C8E2960922072B7LLyAA8TypedIntVyAA14_ValueRegisterOGSgAA7DSLTreeV0H0OKF: error: undefined reference to '$s12_RegexParser3ASTV14QuantificationV6AmountOMa'
...
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
[4/5] Linking swift-regex
Are these behaviors expected? And if not, are they related / will they be fixed together?