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-328] Some Glibc functions not imported because they depend on feature test macros #42950

Open
swift-ci opened this issue Dec 21, 2015 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself Linux Platform: Linux standard library Area: Standard library umbrella

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-328
Radar None
Original Reporter dunkelstern (JIRA User)
Type Bug
Environment

Ubuntu 15.10

Additional Detail from JIRA
Votes 1
Component/s Compiler, Standard Library
Labels Bug, ClangImporter, Linux
Assignee None
Priority Medium

md5: fe85e3a129e976d855f0176e874a827d

Issue Description:

Try using strptime or lrand48 for example, they need the C compiler macro _XOPEN_SOURCE defined to work.

see: man 7 feature_test_macros for further examples

@swift-ci
Copy link
Collaborator Author

Comment by Johannes Schriewer (JIRA)

Ping @ddunbar @belkadan can we expect this to be fixed in the near future? It is just missing a #define _GNU_SOURCE somewhere. I had a ugly-hack workaround: I just created a big header file with that define at the beginning and all headers from the Glibc.modulemap included.

Shall I create something in that fashion and PR it or has this no chance beeing included?

@belkadan
Copy link
Contributor

I think we'd accept a PR to change the Clang importer itself. It has a bunch of predefines on OS X; can't see why doing some for Linux would be a problem. I'd want someone else to review and agree that the settings you pick make sense as Swift's defaults, though.

(You can work around this using -Xcc, which passes arguments through to the Clang inside Swift.)

@gparker42
Copy link
Mannequin

gparker42 mannequin commented Nov 16, 2017

This change was again proposed as part of Fuschia OS support.
#12955

One way or the other it will likely be changed soon.

@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. compiler The Swift compiler in itself Linux Platform: Linux standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants