Skip to content

[SR-5524] Importing a modulemapped C library in REPL throws an error #4626

Open
@swift-ci

Description

@swift-ci
Previous ID SR-5524
Radar None
Original Reporter MatiMax (JIRA User)
Type Bug

Attachment: Download

Environment

Ubuntu Linux 16.04 LTS, Swift 3.1.1, Swift 4.0.0-dev

Additional Detail from JIRA
Votes 4
Component/s LLDB for Swift
Labels Bug, Linux, REPL
Assignee None
Priority Medium

md5: 4ca55ff9257afe4db0384f0c0979d411

relates to:

  • SR-3648 Unable to Import Foundation
  • SR-2783 REPL crashes due to bad permissions CoreFoundation header files (Ubuntu)
  • SR-3794 import Glibc does not work from the swift 3.1-dev REPL
  • SR-7065 REPL broken on Linux (cannot import anything) as of 2018-02-22 Swift 4.1 snapshot

Issue Description:

A Swift package of type system-module throws an error when trying to import in REPL.

Swift 3.1.1

swift -I ./Clibssh -L /usr/lib/x86_64-linux-gnu
Welcome to Swift version 3.1.1 (swift-3.1.1-RELEASE). Type :help for assistance.
  1> import Clibssh 
error: repl.swift:1:8: error: could not build Objective-C module 'Clibssh'
import Clibssh
       ^

Swift 4.0.0-dev

swift -I ./Clibssh -L /usr/lib/x86_64-linux-gnu
Welcome to Swift version 4.0-dev (LLVM a15decabe3, Clang ae62debbb4, Swift 823d7e27bf). Type :help for assistance.
  1> import Clibssh 
error: repl.swift:1:8: error: could not build C module 'Clibssh'
import Clibssh
       ^

Module definition for Clibssh

The following sources were used to produce the system module for using libssh.so in Swift.

Package definition for the module
import PackageDescription

let package = Package(
    name: "Clibssh",
    pkgConfig: "libssh"
)
Module map definition
module Clibssh [system] {
  header "/usr/include/libssh/libssh.h"
  link "ssh"
  export *
}

Note 1: Importing the module in Swift 3.0.1 REPL works fine.
Note 2: Building an executable file with this module definition works flawlessly in Swift 3.1.1 and Swift 4.0.0

I'm linking this issue to SR-3794, SR-3648 and SR-2783 as it seems there are some similarities.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions