[SOLVED] LLDB failed when I connected my c++ lib

I connected C++ library to my executable SPM project and set -enable-experimental-cxx-interop to swift settings, and when I try to debug with LLDB, I received the next error messages

(lldb) po self
error: expression failed to parse:
unknown error

and

(lldb) po self
warning: Swift error in scratch context: /Users/v.prusakov/Developer/AdaEngine/Sources/AdaBox2d/box2d_swift.hpp:11:10: note: while building module 'box2d' imported from /Users/v.prusakov/Developer/AdaEngine/Sources/AdaBox2d/box2d_swift.hpp:11:
#include <box2d/box2d.h>
         ^

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/box2d.h"
        ^

/Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/box2d.h:28:10: note: in file included from /Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/box2d.h:28:
#include "b2_settings.h"
         ^

error: /Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/b2_math.h:47:35: error: use of undeclared identifier 'xIn'
        b2Vec2(float xIn, float yIn) : x(xIn), y(yIn) {}
                                         ^

error: /Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/b2_math.h:138:2: error: duplicate member 'b2Vec3'
        b2Vec3(float xIn, float yIn, float zIn) : x(xIn), y(yIn), z(zIn) {}
        ^

/Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/b2_math.h:135:2: note: previous declaration is here
        b2Vec3() = default;
        ^

error: too many errors emitted, stopping now
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "box2d_swift.hpp"
        ^

error: /Users/v.prusakov/Developer/AdaEngine/Sources/AdaBox2d/box2d_swift.hpp:11:10: error: could not build module 'box2d'
#include <box2d/box2d.h>
         ^

error: could not build Objective-C module 'AdaBox2d'
.
Shared Swift state for AdaEditor has developed fatal errors and is being discarded.
REPL definitions and persistent names/types will be lost.

error: expression failed to parse:
unknown error

My app perfectly run on Xcode 14.3 beta and Swift 5.7 (I got same behavior on 5.8), but debugging is broken.

How to fix that??

Hi @SpectralDragon, for now, you can add the following to your lldbinit file:

settings set target.experimental.swift-enable-cxx-interop true
2 Likes

Thanks, that's solved my issue!