Swift编译器错误-Xcode 11.5中没有此类模块

时间:2020-06-20 01:21:36

标签: swift xcode swift-package-manager

在Xcode 11.5的MyApp项目中,我有2个目标和1个CLibBSM模块(SPM)。

目标
1.MyApp(GUI App)
2.实用程序链接到CLibBSM(命令行工具)

个人编译2个目标非常好。
但是,当我在MyApp的Utility(Wrapper-subpath:Contents / Library / LaunchServices)中将Build Phases-Copy Files复制到MyApp时,发生了“ Swift编译器错误-没有这样的模块CLibBSM”问题。
有可能解决这个问题吗?

CLibBSM / Package.swift(SPM)

// swift-tools-version:5.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "CLibBSM",
products: [
    // Products define the executables and libraries produced by a package, and make them visible to other packages.
    .library(
        name: "CLibBSM",
        targets: ["CLibBSM"]),
],
dependencies: [
    // Dependencies declare other packages that this package depends on.
    // .package(url: /* package url */, from: "1.0.0"),
],
targets: [
    // Targets are the basic building blocks of a package. A target can define a module or a test suite.
    // Targets can depend on other targets in this package, and on products in packages which this package depends on.
    .target(
        name: "CLibBSM",
        dependencies: []),
    .testTarget(
        name: "CLibBSMTests",
        dependencies: ["CLibBSM"]),
]

CLibBSM / Sources / CLibBSM / include / module.modulemap(SPM)

module CLibBSM [system] {
    header "shim.h"
    link "bsm"
    export *
}

CLibBSM / Sources / CLibBSM / include / shim.h(SPM)

#ifndef __CLIBBSM_SHIM_H__
#define __CLIBBSM_SHIM_H__

#import <sys/sysctl.h>
#import <Foundation/Foundation.h>
#import <unistd.h>
#import <libproc.h>
#import <pthread.h>
#import <bsm/audit.h>
#import <sys/ioctl.h>
#import <sys/types.h>
#import <bsm/libbsm.h>
#import <bsm/audit_kevents.h>
#import <security/audit/audit_ioctl.h>
#import <sys/proc_info.h>

#endif

CLibBSM / Sources / CLibBSM / shim.c(SPM)

// empty

enter image description here enter image description here

0 个答案:

没有答案