Swift Package Manager: illegal instruction 4 on trivial system module

352 views Asked by At

I'm trying to include a system module in a Swift Package Manager project, and when I run swift package update it fails with the unhelpful error:

Illegal instruction: 4

Verbose output reveals that this occurs when the project is attempting to link the system module I've declared:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm -L /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 /path/to/system/module/checkout/Package.swift -fileno 5

In trying to get this to work, I've stripped down the system module to the most trivial possible implementation:

Package.swift

// swift-tools-version:3.1

import PackageDescription

let package = Package(
    name: "CLibSocket"
)

module.modulemap

module CLibSocket [system] {
  header "shim.h"
  export *
}

shim.h

#include <stdio.h>

And even this is failing. What can be going wrong here?

1

There are 1 answers

0
Ankit Agarwal On

It looks likes the compiler or SwiftPM is crashing while parsing the manifest of your package. It would be great if you can file a JIRA on bugs.swift.org with a zip of your package. Instructions on how to file a good SwiftPM bug are here: https://github.com/apple/swift-package-manager/blob/master/Documentation/Resources.md#reporting-a-good-swiftpm-bug