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

Add support for libsqlite3 on z/OS #1239

Merged
merged 1 commit into from
May 1, 2024
Merged

Add support for libsqlite3 on z/OS #1239

merged 1 commit into from
May 1, 2024

Conversation

dustin-ward
Copy link
Contributor

Allows the use of the libsqlite3 tag on z/OS

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.16%. Comparing base (18cdded) to head (70dbb21).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1239   +/-   ##
=======================================
  Coverage   47.16%   47.16%           
=======================================
  Files          12       12           
  Lines        1533     1533           
=======================================
  Hits          723      723           
  Misses        669      669           
  Partials      141      141           

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

@dustin-ward
Copy link
Contributor Author

Looks like an unrelated test failure

@mattn
Copy link
Owner

mattn commented May 1, 2024

yeah, merging. Thank you

@mattn mattn merged commit 3c0390b into mattn:master May 1, 2024
10 of 11 checks passed
@Benjamin-Barda
Copy link

HI @dustin-ward

Did you manage to make it work on zos ? I have been banging my head for 3 weeks straight trying to make this work. Knowing that is possible would be great!!
Thank you in advance.

@dustin-ward
Copy link
Contributor Author

Hey @Benjamin-Barda

Yes it is absolutely possible to get go-sqlite3 running on zOS. You’ll have to forgive me because it’s been a while since I’ve been involved with the project, but IIRC the best way to get it working was to first compile sqlite3.c into an archive and link the final go executable with it (You might have to try a couple of different C compilers… I remember one of clang or xlclang didn’t work for me)

@Benjamin-Barda
Copy link

At the end it was a little tricky to get it running on z/OS.

I ended up modifying the vendored library by replacing in both sqlite3-bindings.c/h the following definitions

#define SQLITE_ERROR_MISSING_COLLSEQ   (SQLITE_ERROR | (1<<8))
...
...
#define SQLITE_OK_SYMLINK              (SQLITE_OK | (2<<8)) /* internal use only */

with their resolved values. This made it work with xlclang along with the following compilation flags

-std=gnu99 -m64 -D_XOPEN_SOURCE_EXTENDED=1 -D_XOPEN_SOURCE=600 -DHAVE_NANOSLEEP=0"

I know this is a bit rough but I could not get it working with a precompiled library.
I leave this here given that there are few resources for z/OS and go.

A P.R might be possible to add it but I do not know how many people would be intrested.

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.

4 participants