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-9198] Glibc modulemap doesn't contain -lm for math #51689

Open
alblue opened this issue Nov 6, 2018 · 5 comments
Open

[SR-9198] Glibc modulemap doesn't contain -lm for math #51689

alblue opened this issue Nov 6, 2018 · 5 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@alblue
Copy link
Contributor

alblue commented Nov 6, 2018

Previous ID SR-9198
Radar None
Original Reporter @alblue
Type Bug
Additional Detail from JIRA
Votes 1
Component/s Standard Library
Labels Bug
Assignee @alblue
Priority Medium

md5: 39911a1675c6af9f181df40f5ca8e1a2

Issue Description:

The glibc.modulemap has a math module, which includes the math.h header, but doesn't suggest that the m library is added. It should read:

module math {
link "m"
header "/usr/include/math.h"
export *
}

Currently the -lm is hard-coded in the Unix toolchain, where it should really be added when the math module is used instead:

https://github.com/apple/swift/blob/master/lib/Driver/UnixToolChains.cpp#L53

@belkadan
Copy link
Contributor

belkadan commented Nov 6, 2018

Seems reasonable! @airspeedswift, who's in charge of the Linux platform module map?

@alblue
Copy link
Contributor Author

alblue commented Nov 8, 2018

Pushed #20430 as a proposal to add this, and added @airspeedswift as a reviewer.

@airspeedswift
Copy link
Member

> Seems reasonable! Ben Cohen, who's in charge of the Linux platform module map?

It's a bit of a grey area. But if it's a bit of obvious goodness we can just do it.

> Pushed #20430 as a proposal to add this, and added Ben Cohen as a reviewer.

I swapped out myself for @stephentyrone because math.

@stephentyrone
Copy link
Member

Yeah, this is a no-brainer.

(Even more of a no-brainer would have been for linux linkers to fix the default behavior like two decades ago, but that ship has clearly sailed, and the linux crowd is doomed to need to specify -lm forever.)

@alblue
Copy link
Contributor Author

alblue commented Nov 8, 2018

Thanks!

@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. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

4 participants