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

ARROW-16902: [C++][FlightRPC] Fix DLL linkage in Flight SQL #13434

Merged
merged 8 commits into from
Jul 7, 2022

Conversation

lidavidm
Copy link
Member

Also, enable Flight SQL in Windows CI builds.

@github-actions
Copy link

@github-actions
Copy link

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

How about creating ARROW_FLIGHT_SQL_EXPORT instead of reusing ARROW_FLIGHT_EXPORT because Flight and Flight SQL provide separated DLLs?

If we reuse ARROW_FLIGHT_EXPORTING, Flight SQL uses __declspec(dllexport) not __declspec(dllimport) to use Flight API.

@lidavidm lidavidm marked this pull request as draft June 25, 2022 12:34
@lidavidm
Copy link
Member Author

Ah, thanks Kou, you're right - I'll fix this up.

@lidavidm
Copy link
Member Author

Protobuf does not interact very well with dllexport declarations (seemingly on purpose/the team considers it a bad idea: https://groups.google.com/g/protobuf/c/PDR1bqRazts) so hopefully this works to get Flight SQL on Windows (MinGW/MSVC).

The root of the issue here is that client_test.cc uses the Protobuf classes directly, which then means we have to deal with getting dllexport/dllimport annotated in all the right places in the generated Protobuf sources (and the compiler apparently does not do this fully correctly). The tests can't really be rewritten to not use the Protobuf classes directly, but given those tests rely exclusively on mocks, I wonder if they're even worth keeping. CC @jduo

@lidavidm
Copy link
Member Author

MinGW works now; something about MSVC is not working. I can reproduce the issue, but not sure why it's happening yet. (The suggestions of adding -DGMOCK_LINKED_AS_SHARED_LIBRARY lead to multiple symbol definition issues.)

@jduo
Copy link
Member

jduo commented Jun 27, 2022

Protobuf does not interact very well with dllexport declarations (seemingly on purpose/the team considers it a bad idea: https://groups.google.com/g/protobuf/c/PDR1bqRazts) so hopefully this works to get Flight SQL on Windows (MinGW/MSVC).

The root of the issue here is that client_test.cc uses the Protobuf classes directly, which then means we have to deal with getting dllexport/dllimport annotated in all the right places in the generated Protobuf sources (and the compiler apparently does not do this fully correctly). The tests can't really be rewritten to not use the Protobuf classes directly, but given those tests rely exclusively on mocks, I wonder if they're even worth keeping. CC @jduo

I'm OK with removing these tests to deal with this problem.

@lidavidm
Copy link
Member Author

I made the client_tests run only on Unix to just sidestep the problem.

@lidavidm lidavidm marked this pull request as ready for review June 28, 2022 14:34
@lidavidm
Copy link
Member Author

lidavidm commented Jul 7, 2022

Looks like this builds successfully on Windows now.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

@kou kou merged commit 9c93f82 into apache:master Jul 7, 2022
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.

None yet

3 participants