Fixes errors when linking caffe2 statically#10765
Fixes errors when linking caffe2 statically#10765peterjc123 wants to merge 3 commits intopytorch:masterfrom
Conversation
orionr
left a comment
There was a problem hiding this comment.
If tests pass, this looks good. Thanks!
|
@pytorchbot retest this please |
1 similar comment
|
@pytorchbot retest this please |
|
@pytorchbot retest this please |
1 similar comment
|
@pytorchbot retest this please |
e6a7b47 to
236d0b4
Compare
|
I think the failure of CI is unrelated to this PR. |
|
@pytorchbot retest this please |
|
I was trying to fix this in a slightly different way and also notice some other suspicious places. Should we also fix the linkage in its base class IdWrapper? |
|
Added #10941 |
|
@xkszltl Yes, that's missing. Thanks for pointing out. For the convenience of the merging of these related PRs, I've included all the required changes in this PR. So, would you please close your PR(s)? |
|
Hidden visibility (for *nix) is landing in #10752, so let's wait until that and then rebase and test. Hopefully after the above we should get better signal on Unix builds for Windows dllimport/export issues. Granted, not perfect, but better. |
|
@pytorchbot retest this please |
facebook-github-bot
left a comment
There was a problem hiding this comment.
orionr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@pytorchbot retest this please |
|
@peterjc123, correct - looks like we need to have |
aten/src/ATen/core/IdWrapper.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
aten/src/ATen/core/typeid.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
aten/src/ATen/core/typeid.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
aten/src/ATen/core/typeid.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
aten/src/ATen/core/typeid.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@orion It seems that you are right. As this post says, it seems that GCC wants the entire class exported while MSVC doesn't. So there may be two possible solutions for this issue:
|
|
Thanks for the feedback. @peterjc123, depending on how many cases we have of this, I would recommend exploring option 2 for a day or two and then fallback to option 1. @mingzhe09088 is also seeing challenges with enabling all of Caffe2 with shared DLL builds on Windows, so it's possible that we'll hit similar issues there. So maybe option 1 is going to be required regardless. |
|
For reference, @mingzhe09088 is doing this work at #11160 |
|
For that stackoverflow post, I wonder if it's because implicitly defined functions, e.g. default constructor, are not exported unless we put the decorator at class level. If that's the case, something like this might help: |
|
@xkszltl Thanks! I'll try this. |
Test locally and figure out all the required changes Target comments minor changes .
| */ | ||
| template <typename T> | ||
| AT_CORE_API static TypeIdentifier Id(); | ||
| static TypeIdentifier Id(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@peterjc123 do you still have issues with building static libs on Windows with the latest master? Just checking. I feel like with the changes @Yangqing submitted we should be in good shape without these changes, but please let us know. |
|
@orionr Let me try locally first. |
|
@orionr It seems this issue is not resolved by the several Windows PRs. The error log is here: |
|
Looks like tests are failing to link. @mingzhe09088 is working on BUILD_PYTHON enabling at #11385 and then we're going to look at BUILD_TEST. Both are by default disabled on Windows right now, which they shouldn't be. |
|
cc @Yangqing |
|
Closed because it's out of date. |
Fixes #10746 and #10902.
The linking error is caused by the wrong usage of dllexport/dllimport. We don't need them if the implementation of the function is available from the external side.