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

Fix read_table compilation on windows #455

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

nicklan
Copy link
Collaborator

@nicklan nicklan commented Nov 5, 2024

What changes are proposed in this pull request?

Make read_table actually compile on windows.

  1. Add a strndup implementation for windows (thanks @hntd187)
  2. Fix some types that the windows compiler doesn't like
  3. Update CMakeLists.txt with correct things (thanks @hntd187 again)
  4. Update the README with some minimal instructions.

How was this change tested?

Built and run on windows (without PRINT_DATA)

@nicklan nicklan requested a review from hntd187 November 5, 2024 21:53
Copy link

codecov bot commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.08%. Comparing base (bd2ea9f) to head (f1a9e94).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #455   +/-   ##
=======================================
  Coverage   78.08%   78.08%           
=======================================
  Files          55       55           
  Lines       11605    11605           
  Branches    11605    11605           
=======================================
  Hits         9062     9062           
  Misses       2043     2043           
  Partials      500      500           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@zachschuermann zachschuermann left a comment

Choose a reason for hiding this comment

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

one comment otherwise lgtm (with my minimal windows exposure)

@@ -79,6 +79,18 @@ EngineError* allocate_error(KernelError etype, const KernelStringSlice msg)
return (EngineError*)error;
}

#ifdef WIN32 // windows doesn't have strndup
char *strndup(const char *s, size_t n) {
size_t len = strnlen(s, n);
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this blow up if s is NULL? should check if it's null and just return null if so?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, but this shouldn't be called on nulls to start, a lot of these older windows functions don't check for null (or they have null safe variants)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, but so does strndup (it'll segfault), so this is pretty much equivalent. (yay c)

Copy link
Collaborator

@hntd187 hntd187 left a comment

Choose a reason for hiding this comment

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

Thanks for making these changes, I am sorry you had to use windows for even a day. :(

@@ -18,11 +18,11 @@ add_test(NAME read_and_print_basic_partitioned COMMAND ${TestRunner} ${DatPath}/

if(WIN32)
set(CMAKE_C_FLAGS_DEBUG "/MT")
target_link_libraries(read_table PUBLIC ws2_32 userenv bcrypt ntdll)
target_link_libraries(read_table PUBLIC ws2_32 userenv bcrypt ncrypt crypt32 secur32 ntdll RuntimeObject)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd like to also point out a lot of these are because the underlying rust libs aren't linking these statically when they build. I'm not entirely sure how to investigate or remediate this, but I am just mentioning I noticed this when figure out what to link.

@nicklan nicklan merged commit 0214a96 into delta-incubator:main Nov 6, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants