Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

292
Visualizações
What's the solution for "error: Couldn't IRGen expression, no additional error" on Xcode 10.1?

We have a large project with a lot of dependencies brought in through Carthage. Whenever we try to look at a variable in the lldb debugger (p variablename), it gives us an error: error: Couldn't IRGen expression, no additional error

None of the workarounds are very good. We can run carthage with --no-use-binaries to get around it, but it makes builds take a prohibitively long time. We can use fr v on some variables, but not all. People have fixed this in previous versions of Xcode by changing permissions on some Swift directories, but I can't find the corresponding directories in Xcode 10.1. And I saw someone say that changing the build system back and forth helped him, but that hasn't worked for us.

So I'm starting this search for a solution on Xcode 10.1 specifically. Has anyone else found out what's causing this error, and/or a good solution to it?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Someone on my team shared a solution to this that actually works (I don't know if he discovered it or found it elsewhere):

Set a breakpoint on the first line of the AppDelegate didFinishLaunchingWithOptions method. Set the action for this breakpoint to: po application

Now, when your run your application, the debugger will pause at that breakpoint and will display this text in the lldb debugger pane (with your app name instead of Foo):

note: Swift compiler options for Foo conflict with options found in other modules; Switching to a new expression evaluator for Foo, old $R variables are lost.

And then the lldb debugger will work properly, able to p and po variables and expr expressions.

I don't know why it works, but it works, and reliably too!

over 4 years ago · Santiago Trujillo Relatório

0

A colleague and me found a solution:

Create an Objective-C file in your Swift project. Hit yes when it asks for the Bridging Header.

Test.h

#import <Foundation/Foundation.h>

@interface Test : NSObject

- (id)init;

@end

Test.m

#include "Test.h"

@implementation Test

- (id)init
{
    return self;
}

@end

MyProject-Bridging-Header.h

#include "Test.h"

And now: 🎉 no more error: Couldn't IRGen expression, no additional error and you can debug again.

So I think just adding a bridging header works as a workaround...

But If that doesn't work:

Add a breakpoint in AppDelegate.swift in application: UIApplication, didFinishLaunching like so and hope that this helps:

Breakpoint in Xcode

over 4 years ago · Santiago Trujillo Relatório

0

There is currently a hard requirement that the version of the swift compiler you use to build your source and the version of lldb you use to debug it must come from the same toolchain. Currently the swift debug information for types is just a serialization of internal swift compiler data structures. It also depends on local path information, which makes it hard to move around.

There is a longer term effort to change that design, but for now you have to rebuild all your binaries every time you update your tools, and you can't use pre-built binaries.

I'm a little surprised this causes a day-to-day problem, however. This full rebuild only needs to happen when you pull new sources from Carthage or update your tools, which shouldn't be that often. If you are triggering rebuilds more frequently than that, maybe dependencies aren't getting tracked properly, so that more files are getting rebuilt than need to be?

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda