Skip to content

Failed to use swiftc to compile swift code with import foundation. #63708

Closed
@Chenxiangxie1996

Description

@Chenxiangxie1996

Description

I have follwed the steps from this doc and run hello on android. But when I want to use swiftc to compile a swift within import foundation. Errors will occur.

date.swift:1:8  error: no such module 'Foundation'
import Foundation

Steps to reproduce

date.swift:

import Foundation
print("hello")
let time = Date()
print(time)

Expected behavior

I directly run this date.swift on x86_64. It can run successfully.
But when I use swiftc to compile it into a exec file on android. it cannot.
So how can I compile it successfully? Should I add some parameters on utils or swiftc? Please help me.

image

Environment

  • Swift compiler version info
  • Xcode version info
  • Deployment target:

Metadata

Metadata

Assignees

No one assigned

    Labels

    AndroidPlatform: AndroidbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.documentationplatform support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions