Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-6669] Swift Objective-C interoperability on Linux, error: 'Foundation/Foundation.h' file not found #49218

Closed
swift-ci opened this issue Dec 27, 2017 · 1 comment

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-6669
Radar None
Original Reporter kmn (JIRA User)
Type Improvement
Status Resolved
Resolution Invalid
Additional Detail from JIRA
Votes 0
Component/s
Labels Improvement
Assignee None
Priority Medium

md5: 80887cc14a6363cd3558e7d1b3095507

Issue Description:

I'm trying to compile a swift program that uses code written in Objective-C on a VM running Linux (Ubuntu 16.0.4, Swift 4.0.3).

I get this error when compiling :

fatal error: 'Foundation/Foundation.h' file not found

#import <Foundation/Foundation.h>

On Mac OS

The same program works perfectly on Mac OS.

What have I tried ?

I've tried reverting to swift 3.1.1 (I remember this working on swift 3 a while ago).

I've googled the problem, extensively, and had no success.

I've followed instructions on how to install the Objective-C runtime on Linux and installed GNUStep (see http://www.techotopia.com/index.php/Installing_and_Using_GNUstep_and_Objective-C_on_Linux[1])

All with no success.

why am I using objective-C ?

(Anticipating this question).

I need to call a python script from the program. Python has a library for C, which I can only use with C or Objective-C.

In fact, commenting out the line `#import <Foundation/Foundation.h>` makes compilation fail when importing the Python library :

fatal error: 'Python/Python.h' file not found
{{ #include <Python/Python.h>}}
{{ ^}}
{{ 1 error generated.}}

[1]: http://www.techotopia.com/index.php/Installing_and_Using_GNUstep_and_Objective-C_on_Linux

@belkadan
Copy link
Contributor

belkadan commented Jan 2, 2018

Swift doesn't support Objective-C on Linux (GNUStep or otherwise) for a handful of reasons. You should still be able to use C as an interoperability language with Python, but you'll have to deal with the fact that the Python headers live in different places on different OSs.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants