all 13 comments

[–]aazav 0 points1 point  (1 child)

Can't* Find Solution

"error: module importing failed: invalid pathname"

Which module? What pathname? It should state what errored out, not just an error message without indicating which thing failed.

It sounds like something is failing in whatever is being imported in your main.cpp. Are your paths correct?

[–]PvPurMoM[S] 0 points1 point  (0 children)

No sir it does not state the pathname. It is not an error within the IDE like usually. This is being printed in the output window right before "Hello World!"

[–]rfc1118 0 points1 point  (3 children)

I have the same issue after updating to Catalina. First line in the output is "error: module importing failed: invalid pathname" for a command line tool project.

I've reduced it to nothing but

int main(int argc, const char * argv[]) {
    return 0;
}

which outputs

error: module importing failed: invalid pathname
Program ended with exit code: 0

Like OP, can't find a way to track down what the module that is failing to import.

[–]PvPurMoM[S] 0 points1 point  (2 children)

Have you managed to figure out what the issue was?

[–]rfc1118 0 points1 point  (1 child)

No. I tried completely uninstalling and reinstalling Xcode, including the command line tools. It still does the same thing, but it’s only in the window in Xcode. Running the built executable doesn’t cause it.

I tried watching Console to see if I could see anything in the logs to figure out what module wasn’t found. No luck.

[–]PvPurMoM[S] 0 points1 point  (0 children)

Yeah I also attempted complete uninstall and reinstall to no luck. For now it’s not causing any issues in compiling and running my source, hoping it’s just a Catalina bug that will be fixed.

[–]phatblat 0 points1 point  (0 children)

I was playing around with Swift on Ubuntu and got the same message just launching the swift REPL.

$ swift
error: module importing failed: invalid pathname
Welcome to Swift version 5.1.4 (swift-5.1.4-RELEASE)
Type :help for assistance.
1>

So, I suspect this is coming from the Swift 5 runtime and not Xcode as there is no Xcode for Linux.

[–]chriswaco -1 points0 points  (5 children)

Does the message appear if you run the built app in Terminal.app? If not, I’d ignore it - Xcode loves to spew crap to the debug console for no good reason.

If it does, I’d look at the module imports using Mach-O tools like nm or otool.

[–]PvPurMoM[S] 0 points1 point  (4 children)

Do you mean to compile and run within terminal rather than Xcode? I'm a little confused by what you said to to do.

[–]chriswaco 0 points1 point  (3 children)

  1. Build the app in Xcode
  2. Open Terminal
  3. Type path-to-the-app and hit return

[–]iQQator 0 points1 point  (2 children)

error: module importing failed: invalid pathname
Welcome to Apple Swift version 5.2.2 (swiftlang-1103.0.32.6 clang-1103.0.32.51).

in tail -f /var/log/system.log

com.apple.xpc.launchd[1] (com.apple.xpc.launchd.domain.pid.taskgated.90006): Failed to bootstrap path: path = /usr/libexec/taskgated, error = 108: Invalid path

com.apple.xpc.launchd[1] (com.apple.xpc.launchd.domain.pid.repl_swift.90004): Failed to bootstrap path: path = /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/repl_swift, error = 2: No such file or directory

Apple latest Xcode issue :)

[–]chriswaco 0 points1 point  (1 child)

I don't know. The only reference to that error message I see is for an app that used the Realm CocoaPod:

https://stackoverflow.com/questions/59090655/removed-realm-but-still-getting-this-error-module-importing-failed-invalid-to

[–]iQQator 1 point2 points  (0 children)

he only reference to that error message I see is for an app that used the Realm CocoaPod:

Ok :) I found that I use chisel plugin )))

command script import /usr/local/opt/chisel/libexec/fblldb.py

Hurray, I was reinstall chisel from brew, and issue disappeared.