Post

Replies

Boosts

Views

Activity

lib_InternalSyntaxParser.dylib: Embedding in mobile iOS app as framework
Hey there, many thanks for your time! Goal: Using lib_InternalSyntaxParser.dylib in an app-store compatible build for iOS. Some quick context: swift-syntax Library repo - https://github.com/apple/swift-syntax My reference project - https://github.com/tikimcfee/LookAtThat Updated / standard instructions on manually building dylib - https://github.com/pol-piella/polpiella.dev/blob/4a7b5f6e6b3511d5010da887435f870f84c53d2a/src/pages/embedding-a-dylib-in-a-swift-package.md Issues: x86_64, arm64, iossim all require different architecture builds of lib_InternalSyntaxParser. I cannot embed the dylib generated by the build tool into a app-store capable build (not supported by iOS). macOS dylib with an exported .app is fine so far. Attempting to wrap this with a framework causes signing errors after installation on device. Question: I am looking for guidance on the proper, expected practice for bundling the multiple versions of this dylib (listed above). I was fortunate enough to meet one @Rintaro (hello and thank you again!) at this year's WWDC developer event, and they suggested I pop up my issue here. I am happy to answer questions to help narrow down a solution! I would greatly appreciate an as-detailed-as-is-reasonable explanation of what the expected process of embedding this dylib looks like, and what the specific requirements are for code signature and verification for this use case. A third and final time: many thanks for your time, patience, and assistance.
0
1
533
Jun ’22
Running build script 'swift/utils/build-parser-lib' always fails
Hey there internet people. The crash: $ ./swift/utils/build-parser-lib --release --no-assertions --build-dir /tmp/parser-lib-build-ios --host iphoneos --architectures arm64 [ ... many many lines of build information later ...] [1/2] Linking CXX shared library lib/lib_InternalSwiftSyntaxParser.dylib FAILED: lib/lib_InternalSwiftSyntaxParser.dylib : && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -arch arm64 -miphoneos-version-min=10.0 -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -Wno-nested-anon-types -Werror=switch -Wdocumentation -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk -dynamiclib -Wl,-headerpad_max_install_names -Wl,-exported_symbols_list,"/tmp/parser-lib-build-ios/arm64/obj/tools/swift/tools/libSwiftSyntaxParser/libSwiftSyntaxParser.exports" -Wl,-dead_strip	-target arm64-apple-ios10.0 -Xlinker -dead_strip -Xlinker -compatibility_version -Xlinker 1 -o lib/lib_InternalSwiftSyntaxParser.dylib -install_name @rpath/lib_InternalSwiftSyntaxParser.dylib tools/swift/tools/libSwiftSyntaxParser/CMakeFiles/libSwiftSyntaxParser.dir/c-include-check.c.o tools/swift/tools/libSwiftSyntaxParser/CMakeFiles/libSwiftSyntaxParser.dir/libSwiftSyntaxParser.cpp.o	lib/libswiftParse.a	lib/libswiftSyntaxParse.a	lib/libswiftParse.a	lib/libswiftSyntaxParse.a	lib/libswiftAST.a	lib/libswiftBasic.a	lib/libLLVMSupport.a	-lm	lib/libLLVMDemangle.a	lib/libswiftDemangling.a	./lib/libclangBasic.a	lib/libswiftSyntax.a && : Undefined symbols for architecture arm64: 	"clang::MacroInfo::dump() const", referenced from: 			swift::ClangNode::dump() const in libswiftAST.a(Decl.cpp.o) 	"clang::Type::dump() const", referenced from: 			swift::UnexpectedClangTypeError::dump() in libswiftAST.a(ExtInfo.cpp.o) 	"clang::Decl::dump() const", referenced from: 			swift::ClangNode::dump() const in libswiftAST.a(Decl.cpp.o) ld: symbol(s) not found for architecture arm64 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 (You can find the full, gorey, exciting log at https://gist.github.com/tikimcfee/75c24cdce8cc352645da78da4b015daf ) The context: I am attempting to build a custom version of lib_InternalSwiftSyntaxParser.dylib to embed in iOS as described in the repositories below: https://github.com/apple/swift-syntax https://github.com/apple/swift My configuration is: swift-DEVELOPMENT-SNAPSHOT-2020-09-23-a installed at /Library/Developer/Toolchains $ echo $TOOLCHAINS swift $ xcrun --find swift /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-09-23-a.xctoolchain/usr/bin/swift $ xcrun --toolchain default --find swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift $ xcrun --toolchain swift --find swift /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-09-23-a.xctoolchain/usr/bin/swift showing that --toolchain with bad input goes back to default $ xcrun --toolchain random_string_that_shouldnt_do_anything --find swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift So far, I have successfully built the main swift repository with $ ./swift/utils/build-script --clean ... and I am using the built .dylib from that effectively in a macOS application. There are a couple of things I noticed in the build log that have me questioning some kind of cache or local configuration. Specifically, lines that mention build tools from a different toolchain: - Found libtool - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool [...]- CMake (/usr/local/Cellar/cmake/3.18.2/bin/cmake) Version: 3.18.2 - CMake Make Program (/usr/local/bin/ninja) Version: 1.10.1 - C Compiler (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc) Version: 12.0.0.12000032 - C Compiler (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c) Version: 12.0.0.12000032 I'm guessing I'm doing something wrong with the invoking of this script, but I've also tried a number of path hacks within the actual build script to try to point to a different toolchain or compiler - all of which are things I am completely unfamiliar with and am stabbing at in the dark with print debugging. I ask you kindly and with great hope in my heart: pls halp
0
0
1.4k
Sep ’20