Build fails at cmark

I was interested in troubleshooting something, but with a fresh checkout following the build instructions, things are failing for me early in cmark:

Linking C shared library extensions/libcmark-gfm-extensions.0.29.0.gfm.13.dylib
FAILED: extensions/libcmark-gfm-extensions.0.29.0.gfm.13.dylib 
: && /Applications/Xcode-15.1.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --target=arm64-apple-macosx10.13 -Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector -O2 -g -DNDEBUG -arch arm64 -isysroot /Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -dynamiclib -Wl,-headerpad_max_install_names -compatibility_version 0.29.0 -current_version 0.29.0 -o extensions/libcmark-gfm-extensions.0.29.0.gfm.13.dylib -install_name @rpath/libcmark-gfm-extensions.0.29.0.gfm.13.dylib extensions/CMakeFiles/libcmark-gfm-extensions.dir/core-extensions.c.o extensions/CMakeFiles/libcmark-gfm-extensions.dir/table.c.o extensions/CMakeFiles/libcmark-gfm-extensions.dir/strikethrough.c.o extensions/CMakeFiles/libcmark-gfm-extensions.dir/autolink.c.o extensions/CMakeFiles/libcmark-gfm-extensions.dir/tagfilter.c.o extensions/CMakeFiles/libcmark-gfm-extensions.dir/ext_scanners.c.o extensions/CMakeFiles/libcmark-gfm-extensions.dir/tasklist.c.o  -Wl,-rpath,/Users/stephen/Developer/apple/build/Ninja-RelWithDebInfoAssert/cmark-macosx-arm64/src  src/libcmark-gfm.0.29.0.gfm.13.dylib && :
ld: Undefined symbols:
  _cmark_inline_parser_get_chunk, referenced from:
      _match in autolink.c.o
      _match in autolink.c.o
  _cmark_inline_parser_get_column, referenced from:
      _match in strikethrough.c.o
      _match in autolink.c.o
      _match in autolink.c.o
      _match in autolink.c.o
  _cmark_inline_parser_get_line, referenced from:
      _match in strikethrough.c.o
      _match in autolink.c.o
      _match in autolink.c.o
  _cmark_inline_parser_get_offset, referenced from:
      _match in autolink.c.o
      _match in autolink.c.o
  _cmark_inline_parser_in_bracket, referenced from:
      _match in autolink.c.o
      _match in autolink.c.o
  _cmark_inline_parser_push_delimiter, referenced from:
      _match in strikethrough.c.o
  _cmark_inline_parser_remove_delimiter, referenced from:
      _insert in strikethrough.c.o
      _insert in strikethrough.c.o
  _cmark_inline_parser_scan_delimiters, referenced from:
      _match in strikethrough.c.o
  _cmark_inline_parser_set_offset, referenced from:
      _match in autolink.c.o
      _match in autolink.c.o
  _cmark_node_unput, referenced from:
      _match in autolink.c.o
  _cmark_parser_add_child, referenced from:
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
  _cmark_parser_advance_offset, referenced from:
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
      _matches in tasklist.c.o
      _matches in tasklist.c.o
      _open_tasklist_item in tasklist.c.o
  _cmark_parser_get_first_nonspace, referenced from:
      _matches in table.c.o
      _matches in table.c.o
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
      ...
  _cmark_parser_get_offset, referenced from:
      _try_opening_table_block in table.c.o
      _try_opening_table_block in table.c.o
  _cmark_parser_is_blank, referenced from:
      _try_opening_table_block in table.c.o
  _cmark_utf8proc_is_punctuation, referenced from:
      _match in autolink.c.o
      _match in autolink.c.o
      _match in autolink.c.o
      _check_domain in autolink.c.o
  _cmark_utf8proc_is_space, referenced from:
      _match in autolink.c.o
      _match in autolink.c.o
      _match in autolink.c.o
      _check_domain in autolink.c.o
  _cmark_utf8proc_iterate, referenced from:
      _match in autolink.c.o
      _match in autolink.c.o
      _match in autolink.c.o
      _check_domain in autolink.c.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
ERROR: command terminated with a non-zero exit status 1, aborting

Running the recommended:

utils/build-script --skip-build-benchmarks \
    --skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
    --sccache --release-debuginfo --swift-disable-dead-stripping

Am I missing something simple, or did I pick the wrong day to take the compiler for a spin?

I believe @Max_Desiatov run into it and it worked with Xcode 15.0.1 AFAIU

2 Likes

Yes, this doesn't seem to be a problem with swift-cmark itself, potentially a regression in how Clang driver passes arguments to the linker, given that same versions of CMake and ninja should generate identical build commands for both Xcode 15.1 and 15.0.1? Anyway, selecting Xcode 15.0.1 fixes it. Earlier Xcode versions could work too, but I haven't checked.

Since swift-cmark project on GitHub doesn't allow filing issues, I've filed one on swift proper for now: Swift toolchain fails to build with Xcode 15.1 (regression from Xcode 15.0.1) · Issue #70641 · apple/swift · GitHub