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-15968] Getting the following error when importing Darwin or Foundation in Swift #58229

Open
richardlamo opened this issue Mar 12, 2022 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@richardlamo
Copy link

Previous ID SR-15968
Radar None
Original Reporter @richardlamo
Type Bug
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 9becee2b2562992d93ab0b799facc755

Issue Description:

As reported in https://forums.swift.org/t/getting-the-following-error-when-importing-darwin-or-foundation-in-swift/55619/3

I get the following error when I try to import Foundation or anything else.

Welcome to Swift version 5.5.2-dev.
Type :help for assistance.
1> import Foundation
:5:9: note: in file included from :5::5:
#import "copyfile.h"
^

error: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/copyfile.h:41:9: error: unknown type name 'uint32_t'
typedef uint32_t copyfile_flags_t;
^

:5:9: note: in file included from :5::5:
#import "copyfile.h"
^

error: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/copyfile.h:62:44: error: unknown type name 'uint32_t'
int copyfile_state_get(copyfile_state_t s, uint32_t flag, void * dst);
^

:5:9: note: in file included from :5::5:
#import "copyfile.h"
^

error: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/copyfile.h:63:44: error: unknown type name 'uint32_t'
int copyfile_state_set(copyfile_state_t s, uint32_t flag, const void * src);
^

:30:9: note: in file included from :30::30:
#import"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang/include/tgmath.h"
^

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang/include/tgmath.h:13:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang/include/tgmath.h:13:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang/include/tgmath.h:13:
#include <math.h>
^

/usr/local/include/math.h:29:12: note: in file included from /usr/local/include/math.h:29:/usr/local/include/math.h:29:

...^

Seems that it is picking up header files from /usr/local/include possibly created by some other program.

I fixed it by moving /usr/local/include but I suspect I shouldn't have to.

Perhaps Swift ignores /usr/local/include in the future?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

1 participant