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

THRIFT-4759:add thrift export to fix windows shared lib building #1714

Merged
merged 2 commits into from
Feb 4, 2019
Merged

THRIFT-4759:add thrift export to fix windows shared lib building #1714

merged 2 commits into from
Feb 4, 2019

Conversation

cyyever
Copy link
Contributor

@cyyever cyyever commented Jan 26, 2019

add thrift export to fix windows shared lib building

@cyyever
Copy link
Contributor Author

cyyever commented Jan 26, 2019

This PR is same with #1713.
Given that the support for GNU autotools is not dropped,I decided to add the cmake generated header to the source tree.And the header was changed a little to avoid errors in gcc/clang.
And I only added the macro to problematic locations.

@jeking3
Copy link
Contributor

jeking3 commented Jan 26, 2019

We're moving towards cmake but it's going to take a while to get everything that autoconf does for us working in cmake... in the meantime thanks for both. The "make dist" job in Travis CI failed and it looks related.

Copy link
Contributor

@jeking3 jeking3 left a comment

Choose a reason for hiding this comment

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

Long term, we really should put THRIFT_EXPORT on all classes, and disable global visibility on unixy builds like boost does, that way unix and windows are playing the same export game.

@cyyever
Copy link
Contributor Author

cyyever commented Jan 26, 2019

We're moving towards cmake but it's going to take a while to get everything that autoconf does for us working in cmake... in the meantime thanks for both. The "make dist" job in Travis CI failed and it looks related.

I forgot to change autotool scripts,I will re-push it.

@cyyever
Copy link
Contributor Author

cyyever commented Jan 26, 2019

@jeking3 by the way,are there any plans to merge fbthrift code?

@cyyever
Copy link
Contributor Author

cyyever commented Jan 26, 2019

Long term, we really should put THRIFT_EXPORT on all classes, and disable global visibility on unixy builds like boost does, that way unix and windows are playing the same export game.

That is a huge work,and I found little UNIX/Linux cpp projects limiting symbol visibility.It is a good idea except to make code a little ugly.

@jeking3
Copy link
Contributor

jeking3 commented Jan 26, 2019

Boost leads the way in terms of correctness here, just a suggestion for long term.

@jeking3
Copy link
Contributor

jeking3 commented Jan 26, 2019

I think I prefer the other PR for this issue. We don't use autoconf for any build that needs dllimport/export - we only use cmake. Therefore a cmake-centric solution is appropriate, especially if nobody wants to tackle symbol visibility on non-windows systems right now.

@cyyever
Copy link
Contributor Author

cyyever commented Jan 27, 2019

We're moving towards cmake but it's going to take a while to get everything that autoconf does for us working in cmake... in the meantime thanks for both. The "make dist" job in Travis CI failed and it looks related.
AppVeyor passed,Travis CI failed for networking problems.

@jeking3
Copy link
Contributor

jeking3 commented Jan 27, 2019

fbthrift code changes would need to be submitted by the fbthrift team. We cannot pull them in.

Copy link
Contributor

@jeking3 jeking3 left a comment

Choose a reason for hiding this comment

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

Please change the MSVC2017 build job in appveyor to build shared.

@jeking3
Copy link
Contributor

jeking3 commented Feb 4, 2019

Also rebase on master which is more stable... I fixed the concurrency_test.

@emmenlau
Copy link
Member

emmenlau commented Feb 4, 2019

Looking forward, thanks!

@cyyever
Copy link
Contributor Author

cyyever commented Feb 4, 2019

Looking forward, thanks!

wait for a moment.

@cyyever
Copy link
Contributor Author

cyyever commented Feb 4, 2019

Also rebase on master which is more stable... I fixed the concurrency_test.

just rebase on master.I am not familiar with appveyor scripts.

@jeking3
Copy link
Contributor

jeking3 commented Feb 4, 2019

In the file appveyor.yml there is a directive that sets the MSVC 2017 build to static. Change it. None of the windows MSVC build tested your changes because both of them disable shared library builds.

@cyyever
Copy link
Contributor Author

cyyever commented Feb 4, 2019

In the file appveyor.yml there is a directive that sets the MSVC 2017 build to static. Change it. None of the windows MSVC build tested your changes because both of them disable shared library builds.

fixed

@jeking3 jeking3 merged commit 8fdb758 into apache:master Feb 4, 2019
@cyyever cyyever deleted the dllexport branch February 20, 2019 06:53
@ericu65
Copy link

ericu65 commented Mar 18, 2019

This PR throws the following warning in MSVC:
warning LNK4049: locally defined symbol ?GlobalOutput@thrift@apache@@3VTOutput@12@A (class apache::thrift::TOutput apache::thrift::GlobalOutput) imported

@ericu65
Copy link

ericu65 commented Mar 19, 2019

@cyyever @jeking3 note above is in regard to static libraries on MSVC 15.

@goorjn
Copy link

goorjn commented Nov 6, 2024

@cyyever @jeking3 wouldn't it have been more convenient to move the TSSLSocketFactory::setManualOpenSSLInitialization's body to cpp rather than explicitly exporting the variable ? (see https://stackoverflow.com/questions/2479784/exporting-static-data-in-a-dll)
Maybe there is a similar trick to avoid to have to explicitly export GlobalOutput variable, but I still haven't looked for it.
By the way, I would have preferred to have default static linking for windows, just like previous versions, rather than to have to #define THRIFT_STATIC_DEFINE in my projects to do so.

@Jens-G
Copy link
Member

Jens-G commented Nov 6, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
releng Release Engineering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants