TDLibKit: Relocation out of range & Can not encode offset X in resulting scattered relocation. & Section too large, can't encode r_address X into 24 bits of scattered relocation entry.

I am building a watchOS Telegram client. GitHub repo watchOS 9.2 (20S5331e), iOS 16.2 (20C5032e), macOS 13.1 (22C5033e), XCode 14.1 (14B47b) - actually latest beta versions. It works fine on a simulator, but I can’t build on a real device, get this error every time:

SwiftCompile normal armv7k Compiling\ CancelDownloadFile.swift,\ CancelPasswordReset.swift,\ CancelUploadFile.swift,\ ChangeImportedContacts.swift,\ ChangePhoneNumber.swift,\ ChangeStickerSet.swift,\ Chat.swift,\ ChatAction.swift,\ ChatActionBar.swift,\ ChatAdministrator.swift,\ ChatAdministratorRights.swift,\ ChatAdministrators.swift,\ ChatEvent.swift,\ ChatEventAction.swift,\ ChatEventLogFilters.swift,\ ChatEvents.swift,\ ChatFilter.swift,\ ChatFilterInfo.swift,\ ChatInviteLink.swift,\ ChatInviteLinkCount.swift,\ ChatInviteLinkCounts.swift,\ ChatInviteLinkInfo.swift,\ ChatInviteLinkMember.swift,\ ChatInviteLinkMembers.swift,\ ChatInviteLinks.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/CancelDownloadFile.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/CancelPasswordReset.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/CancelUploadFile.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChangeImportedContacts.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChangePhoneNumber.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChangeStickerSet.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/Chat.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatAction.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatActionBar.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatAdministrator.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatAdministratorRights.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatAdministrators.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatEvent.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatEventAction.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatEventLogFilters.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatEvents.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatFilter.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatFilterInfo.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLink.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinkCount.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinkCounts.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinkInfo.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinkMember.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinkMembers.swift /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinks.swift (in target 'TDLibKit' from project 'TDLibKit')
    cd /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit
    builtin-swiftTaskExecution -- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -filelist /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/sources-4 -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/CancelDownloadFile.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/CancelPasswordReset.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/CancelUploadFile.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChangeImportedContacts.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChangePhoneNumber.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChangeStickerSet.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/Chat.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatAction.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatActionBar.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatAdministrator.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatAdministratorRights.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatAdministrators.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatEvent.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatEventAction.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatEventLogFilters.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatEvents.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatFilter.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatFilterInfo.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLink.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinkCount.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinkCounts.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinkInfo.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinkMember.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinkMembers.swift -primary-file /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit/Sources/TDLibKit/Generated/Models/ChatInviteLinks.swift -supplementary-output-file-map /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/supplementaryOutputs-194 -target armv7k-apple-watchos4.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS9.1.sdk -I /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Products/Debug-watchos -I /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/usr/lib -F /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Products/Debug-watchos -F /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/Library/Frameworks -F /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS9.1.sdk/Developer/Library/Frameworks -no-color-diagnostics -enable-testing -g -module-cache-path /Users/lev/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity\=checked -Onone -D SWIFT_PACKAGE -D DEBUG -D Xcode -serialize-debugging-options -empty-abi-descriptor -Xcc -working-directory -Xcc /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/SourcePackages/checkouts/TDLibKit -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc -I/Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/swift-overrides.hmap -Xcc -I/Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Products/Debug-watchos/include -Xcc -I/Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/DerivedSources-normal/armv7k -Xcc -I/Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/DerivedSources/armv7k -Xcc -I/Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/DerivedSources -Xcc -DSWIFT_PACKAGE -Xcc -DDEBUG\=1 -module-name TDLibKit -frontend-parseable-output -disable-clang-spi -target-sdk-version 9.1 -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/CancelDownloadFile.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/CancelPasswordReset.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/CancelUploadFile.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChangeImportedContacts.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChangePhoneNumber.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChangeStickerSet.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/Chat.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatAction.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatActionBar.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatAdministrator.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatAdministratorRights.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatAdministrators.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatEvent.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatEventAction.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatEventLogFilters.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatEvents.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatFilter.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatFilterInfo.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLink.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinkCount.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinkCounts.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinkInfo.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinkMember.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinkMembers.o -o /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Build/Intermediates.noindex/TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinks.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/CancelDownloadFile.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/CancelPasswordReset.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/CancelUploadFile.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChangeImportedContacts.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChangePhoneNumber.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChangeStickerSet.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/Chat.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatAction.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatActionBar.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatAdministrator.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatAdministratorRights.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatAdministrators.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatEvent.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatEventAction.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatEventLogFilters.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatEvents.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatFilter.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatFilterInfo.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLink.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinkCount.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinkCounts.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinkInfo.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinkMember.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinkMembers.o -index-unit-output-path /TDLibKit.build/Debug-watchos/TDLibKit.build/Objects-normal/armv7k/ChatInviteLinks.o -index-store-path /Users/lev/Library/Developer/Xcode/DerivedData/BetterTG-dtpgcbgbqoqpkhcmkqkoyxtcyjoo/Index.noindex/DataStore -index-system-modules

error: <unknown>:0: Relocation out of range

Command SwiftCompile failed with a nonzero exit code

I’ve tried deleting derived data, cleaning build folder, resetting package caches, using different versions of TDLibKit, reinstalling TDLibKit. Tried these things many times, but nothing works, I have no more thoughts about it, any suggestion would be great🙏

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

I’ve tried to separate files and disable initializer generation, but still no luck fitting into the 32-bit requirement. I’ve used the script bellow and edited the generator to mark the beginning and end of each enum/struct.

Patch

From 4eae1b675f181baaec59d3e0dadaa35908fe24d8 Mon Sep 17 00:00:00 2001
Subject: [PATCH] set begin and end for structs and enums

---
 .../tl2swift/Sources/TlParserLib/Composer/EnumComposer.swift   | 3 +++
 .../tl2swift/Sources/TlParserLib/Composer/StructComposer.swift | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/scripts/tl2swift/Sources/TlParserLib/Composer/EnumComposer.swift b/scripts/tl2swift/Sources/TlParserLib/Composer/EnumComposer.swift
index e40de4777..9510e14e4 100644
--- a/scripts/tl2swift/Sources/TlParserLib/Composer/EnumComposer.swift
+++ b/scripts/tl2swift/Sources/TlParserLib/Composer/EnumComposer.swift
@@ -34,6 +34,7 @@ final class EnumComposer: Composer {
         let structs = try composeAssociatedStructs()
         
         return ""
+            .addLine("// BEGIN: \(enumInfo.enumType)")
             .addLine("/// \(enumInfo.description)")
             .addLine("public \(indirect)enum \(enumInfo.enumType): Codable, Equatable, Hashable {")
             .addBlankLine()
@@ -46,6 +47,8 @@ final class EnumComposer: Composer {
             .append(encoder.indent())
             .addLine("}")
             .addBlankLine()
+            .addLine("// END: \(enumInfo.enumType)")
+            .addBlankLine()
             .append(structs)
     }
     
diff --git a/scripts/tl2swift/Sources/TlParserLib/Composer/StructComposer.swift b/scripts/tl2swift/Sources/TlParserLib/Composer/StructComposer.swift
index f6a76c1d2..7d5e2a172 100644
--- a/scripts/tl2swift/Sources/TlParserLib/Composer/StructComposer.swift
+++ b/scripts/tl2swift/Sources/TlParserLib/Composer/StructComposer.swift
@@ -36,6 +36,7 @@ final class StructComposer: Composer {
         let props = composeStructProperties(classInfo.properties)
         let structInit = composeInit(classInfo.properties)
         return ""
+            .addLine("// BEGIN: \(structName)")
             .addLine("/// \(classInfo.description)")
             .addLine("public struct \(structName): \(protocols) {")
             .addBlankLine()
@@ -44,6 +45,8 @@ final class StructComposer: Composer {
             .append(structInit.indent())
             .addLine("}")
             .addBlankLine()
+            .addLine("// END: \(structName)")
+            .addBlankLine()
     }
     
     private func composeStructProperties(_ properties: [ClassProperty]) -> String {
-- 
2.40.0


python3 split_source.py Sources/TDLibKit/Generated/Models

import re
import os
import sys

def extract_marked_items(filename):
    with open(filename, 'r') as file:
        content = file.read()

    # Adjust the regex pattern to capture only the content between the BEGIN and END marks for both structs and enums
    pattern = re.compile(r'// BEGIN: (\w+)([\s\S]*?public (?:indirect |)(struct|enum) \1[\s\S]*?})\s*// END: \1', re.MULTILINE)

    # Find all matches
    return pattern.findall(content)

def save_to_files(extracted, output_dir):
    for item_name, content, _ in extracted:
        with open(os.path.join(output_dir, f"{item_name}.swift"), 'w') as f:
            f.write("import Foundation\n\n" + content.strip())

def process_directory(source_dir):
    # Iterate through every swift file in the source directory
    for filename in os.listdir(source_dir):
        if filename.endswith('.swift'):
            file_path = os.path.join(source_dir, filename)
            
            # Create the atomized directory for the current file
            atomized_dir = os.path.join(source_dir, f"{os.path.splitext(filename)[0]}_Atomized")
            if not os.path.exists(atomized_dir):
                os.makedirs(atomized_dir)
            
            extracted_items = extract_marked_items(file_path)
            save_to_files(extracted_items, atomized_dir)

            # Remove the original file
            os.remove(file_path)

def main():
    if len(sys.argv) != 2:
        print("Usage: python script_name.py <source_directory>")
        return

    source_dir = sys.argv[1]

    process_directory(source_dir)

if __name__ == "__main__":
    main()

Will continue the investigation probably rewriting the parser

JFYI: Latest TDLibKit now supports Apple Watch Ultra, which is purely an arm64 arch. The test app builds successfully. Still no luck for arm64_32 devices. cc @levochkaa