Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building HandyJSON in Swift 5.10 throws a fatal error #71946

Open
CrazyFanFan opened this issue Feb 28, 2024 · 12 comments
Open

Building HandyJSON in Swift 5.10 throws a fatal error #71946

CrazyFanFan opened this issue Feb 28, 2024 · 12 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software Frontend Area → compiler: Frontend

Comments

@CrazyFanFan
Copy link
Contributor

CrazyFanFan commented Feb 28, 2024

Description

When building HandyJSON using Swift version 5.10, the compiler throws a fatal error. The code was being compiled for 'arm64-apple-ios12.0'.
The error thrown by the compiler was:

Call parameter type does not match function signature!
ptr null
 i64  %16 = call swiftcc i64 @swift_getTypeByMangledNameInContext(ptr %15, i64 %10, ptr null, ptr null) #22, !dbg !2868

Reproduction

Clone HandyJSON to your local.
The issue was encountered when executing the following swift build command:

swift build \
-c release \
-Xswiftc "-target" -Xswiftc "arm64-apple-ios12.0" \
-Xswiftc "-Osize" \
--sdk "/Applications/Xcode-15.3.0-rc.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.4.sdk"

Stack dump

<unknown>:0: error: fatal error encountered during compilation; please submit a bug report (https://swift.org/contributing/#reporting-bugs)
<unknown>:0: note: Broken module found, compilation aborted!
Rename failed: /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/ContextDescriptorType.swift-247a21ae.o.tmp -> /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/ContextDescriptorType.swift.o: No such file or directory
<unknown>:0: error: error closing '/Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/ContextDescriptorType.swift.o' for output: /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/ContextDescriptorType.swift-247a21ae.o.tmp => /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/ContextDescriptorType.swift.o: No such file or directory
Rename failed: /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/FieldDescriptor.swift-0e23ada6.o.tmp -> /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/FieldDescriptor.swift.o: No such file or directory
<unknown>:0: error: error closing '/Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/FieldDescriptor.swift.o' for output: /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/FieldDescriptor.swift-0e23ada6.o.tmp => /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/FieldDescriptor.swift.o: No such file or directory
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x0000000108837f3c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x00000001088370f8 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000108838544 SignalHandler(int) + 360
3  libsystem_platform.dylib 0x000000019df13584 _sigtramp + 56
4  libsystem_pthread.dylib  0x000000019dee2c20 pthread_kill + 288
5  libsystem_c.dylib        0x000000019ddefa20 abort + 180
6  swift-frontend           0x00000001031416d8 PrettyStackTraceFrontend::~PrettyStackTraceFrontend() + 0
7  swift-frontend           0x0000000108780a18 llvm::report_fatal_error(llvm::Twine const&, bool) + 280
8  swift-frontend           0x0000000108780900 llvm::report_fatal_error(llvm::Twine const&, bool) + 0
9  swift-frontend           0x00000001036144b8 llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::printPipeline(llvm::raw_ostream&, llvm::function_ref<llvm::StringRef (llvm::StringRef)>) + 0
10 swift-frontend           0x0000000108537ce8 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 224
11 swift-frontend           0x0000000103607490 swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*, llvm::raw_pwrite_stream*) + 3992
12 swift-frontend           0x0000000103608bec swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, llvm::vfs::OutputBackend&, swift::UnifiedStatsReporter*) + 2364
13 swift-frontend           0x0000000103610e70 (anonymous namespace)::LLVMCodeGenThreads::Thread::run() + 156
14 swift-frontend           0x0000000103610dc8 (anonymous namespace)::LLVMCodeGenThreads::runThread(void*) + 12
15 libsystem_pthread.dylib  0x000000019dee2f94 _pthread_start + 136
16 libsystem_pthread.dylib  0x000000019deddd34 thread_start + 8
Rename failed: /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/NSDecimalNumberTransform.swift-094848a0.o.tmp -> /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/NSDecimalNumberTransform.swift.o: No such file or directory
<unknown>:0: error: error closing '/Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/NSDecimalNumberTransform.swift.o' for output: /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/NSDecimalNumberTransform.swift-094848a0.o.tmp => /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/NSDecimalNumberTransform.swift.o: No such file or directory
Rename failed: /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/HexColorTransform.swift-0a53d513.o.tmp -> /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/HexColorTransform.swift.o: No such file or directory
<unknown>:0: error: error closing '/Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/HexColorTransform.swift.o' for output: /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/HexColorTransform.swift-0a53d513.o.tmp => /Users/current/HandyJSON/.build/arm64-apple-macosx/release/HandyJSON.build/HexColorTransform.swift.o: No such file or directory

Expected behavior

The expected behavior is for the code to compile successfully without any errors.

Environment

swiftc -version
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0

Xcode version: 15.3 (15E5202a)
OS: macos sonoma 14.4 Beta(23E5211a)
Chip: Apple M3 pro

@CrazyFanFan CrazyFanFan added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels labels Feb 28, 2024
@macblazer
Copy link

I have also run into this same crash on a different (non-public) project.

@chuzhaozhi
Copy link

Waiting for an effective solution

@CrazyFanFan
Copy link
Contributor Author

A quick, workable solution is to disable whole-module-optimization for this module that is encountering the error.

@sooola
Copy link

sooola commented Mar 8, 2024

Is there any new progress? I also encountered this problem

@macblazer
Copy link

@CrazyFanFan Is there a way to turn off whole-module-optimization for release builds? The SPM Usage docs indicate that release builds always build with that flag turned on, and I haven't found any other way to disable it.

@CrazyFanFan
Copy link
Contributor Author

@macblazer Sorry, I mainly use cocoapods at present, and there seems to be no good way to disable wmo if SPM is used.

@Annacheckingin
Copy link

I solved this issue by selecting HandyJSON in the PODS project, then set the Optimization Level to None_xxx

@CtrlJone
Copy link

Is there any new progress? I also encountered this problem, me too

@sooola
Copy link

sooola commented Mar 16, 2024

Is there any new progress? I also encountered this problem

I rolled back to the old version of Xcode 15.2, and the project can run normally. For now, I'll just use it like this

@sunkehappy
Copy link

I solved this issue by selecting HandyJSON in the PODS project, then set the Optimization Level to None_xxx

This way works. Make sure to modify Swift Compiler setting not Apple Clang.

@DyoungYu
Copy link

I solved this issue by selecting HandyJSON in the PODS project, then set the Optimization Level to None_xxx

it works for me

@ktoso ktoso added compiler The Swift compiler itself Frontend Area → compiler: Frontend and removed triage needed This issue needs more specific labels labels May 15, 2024
@siwon-estaid
Copy link

I used this version. This works for me
alibaba/HandyJSON#491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software Frontend Area → compiler: Frontend
Projects
None yet
Development

No branches or pull requests

10 participants