Skip to content

Explicitly link to pthread#7021

Merged
dlang-bot merged 1 commit intodlang:masterfrom
marler8997:explicitLibraries
May 26, 2019
Merged

Explicitly link to pthread#7021
dlang-bot merged 1 commit intodlang:masterfrom
marler8997:explicitLibraries

Conversation

@marler8997
Copy link
Copy Markdown
Contributor

@marler8997 marler8997 commented May 22, 2019

Currently, phobos is using -defaultlib= to build itself, but is implicitly relying on its library dependencies to be added by dmd.

This change makes the phobos library dependencies explicit rather than relying on its dependencies to be hardcoded into the compiler, which in turn forces all D programs to link to those libraries as well.

This change is required to allow dlang/dmd#9831 to be merged, which removes these implicit libraries from being linked to ALL D programs that use DMD to link.

@dlang-bot
Copy link
Copy Markdown
Contributor

Thanks for your pull request and interest in making D better, @marler8997! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + phobos#7021"

@marler8997 marler8997 changed the title Explicitly link to pthread [WIP] Explicitly link to pthread May 22, 2019
@dlang-bot dlang-bot added the Review:WIP Work In Progress - not ready for review or pulling label May 22, 2019
@thewilsonator
Copy link
Copy Markdown
Contributor

Ping me when this is good.

@marler8997 marler8997 force-pushed the explicitLibraries branch from 45b5203 to 7d409a5 Compare May 22, 2019 12:25
@marler8997 marler8997 changed the title [WIP] Explicitly link to pthread Explicitly link to pthread May 22, 2019
@marler8997
Copy link
Copy Markdown
Contributor Author

marler8997 commented May 22, 2019

I've verified that adding -L-lpthread fixes the step that the autotester was on when it failed with the DMD PR, however, there may be more libraries that need to be added but I don't know of an easy way to test that without using the CI builders...and I need both this PR and the DMD PR to be tested at the same time.

I know for sure we need -lpthread. We could integrate this one first and see if that's all we need, and make more PRs if we find any other libraries that need to be added.

The other libraries that may need to be added are -lm and -lrt. However, they could already be added by some other means. -ldl is another dependency but it is already being added explicitly in the makefile.

@marler8997
Copy link
Copy Markdown
Contributor Author

Closing and re-opening to trigger autotester retry. It looked like it failed on windows because of a race condition between running executables and then removing them afterwards.

@marler8997 marler8997 closed this May 22, 2019
@marler8997 marler8997 reopened this May 22, 2019
@marler8997
Copy link
Copy Markdown
Contributor Author

This one should be ready, if we end up needing to add more libraries then I'll make another PR.

@wilzbach wilzbach removed the Review:WIP Work In Progress - not ready for review or pulling label May 22, 2019
posix.mak Outdated
NODEFAULTLIB=-defaultlib= -debuglib=
ifeq (,$(findstring win,$(OS)))
CFLAGS=$(MODEL_FLAG) -fPIC -DHAVE_UNISTD_H
NODEFAULTLIB += -L-lpthread
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makefile use tabs 🤷‍♂️

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@marler8997 marler8997 force-pushed the explicitLibraries branch from 7d409a5 to 8337ed2 Compare May 22, 2019 22:13
@marler8997
Copy link
Copy Markdown
Contributor Author

Been a few days, any objections to merge this now? Should we apply that label "merge in X days if no objections?" Do we still have that label?

@dlang-bot dlang-bot merged commit dd0d622 into dlang:master May 26, 2019
@marler8997 marler8997 deleted the explicitLibraries branch May 26, 2019 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants