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

odpic: init at 2.3.2 #41354

Merged
merged 6 commits into from Jun 9, 2018
Merged

odpic: init at 2.3.2 #41354

merged 6 commits into from Jun 9, 2018

Conversation

mulderr
Copy link
Contributor

@mulderr mulderr commented Jun 1, 2018

Motivation for this change

Adds Oracle Database Programming Interface for C (ODPI-C) library.

Should also allow to fix build of odpic-raw (Haskell bindings) which is currently failing due to missing dependency:

Setup: Missing dependency on a foreign library:
  * Missing C library: odpic
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mulderr
Copy link
Contributor Author

mulderr commented Jun 2, 2018

@pesterhazy @flokli As maintainers of oracle-instantclient you may also be interested in this.

@flokli
Copy link
Contributor

flokli commented Jun 2, 2018

@mulderr funny thing, odpi also comes as a submodule of cx_python (IIRC). Maybe you want to apply the patch from there here as well, or even use this separate odpi drv for everything.

@mulderr
Copy link
Contributor Author

mulderr commented Jun 3, 2018

This one right?

Documentation says that ODPI-C can be used in two different ways. As a shared library or by including the source directly in another project. I think cx_Oracle does the latter while odpic-raw currently expects the former.

The patch is just fixing the path to libclntsh? I decided to override RPATH instead. The net effect should be identical but browsing through nixpkgs patchelf seems to be the goto solution.

Hm, while I don't have immediate use for it (other than to make odpic-raw work), it makes sense to me that this should be offered as a separate library in case anyone wants to use it from C/C++ etc.

Luckily, correct me if I'm wrong, this shouldn't break cx_Oracle in any way? So any project that was using odpic directly can keep using a version independent of the one in nixpkgs - for example via git submodules as cx_Oracle does.

@flokli
Copy link
Contributor

flokli commented Jun 4, 2018

Overriding rpath is also possible, and probably cleaner than maintaining a patch in nixpkgs. Agreed :-)

Since oracle/python-cx_Oracle@9baa55b, it's possible to build cx_oracle with an external odpic library, so I updated my drv accordingly to use the new odpi drv:

flokli@cx_oracle-odpi-c

Could you cherry-pick that on top of your PR?

@mulderr
Copy link
Contributor Author

mulderr commented Jun 4, 2018

Sure! Some checks are apparently failing though. Looking into it now.

Edit: my bad. A typo in the metadata which I thought I already fixed before. Should be ok.

[ oracle-instantclient ];

dontPatchELF = true;
installPhase = ''
Copy link
Member

Choose a reason for hiding this comment

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

We should be able to reuse the "install" phase by setting prefix correctly:

https://github.com/oracle/odpi/blob/master/Makefile#L23

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd like to point out that 2.3.2 didn't even have an install target ;) Good call though. I'll update this to 2.4.0.

makeFlags = [ "PREFIX=$(out)" ];

postFixup = ''
patchelf --set-rpath "${libPath}" $out/lib/libodpic.so
Copy link
Member

Choose a reason for hiding this comment

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

stdenv.hostPlatform.extensions.sharedLibrary instead of so

@flokli
Copy link
Contributor

flokli commented Jun 8, 2018

speaking of stdenv.hostPlatform.extensions.sharedLibrary and portability:

Took the opportunity to wire darwin support into the oracle-instantclient and odpic drvs in 620c574 and 3ebfb98490f.
@matthewbauer given that's my first darwin contribution, could you have a closer look?

Whats your opinion on the makefile patch for odpi, and what about fixDarwinDylibNames not picking up $out/lib/libodpic.dylib.2.4.0 automatically (as libodpic.dylib is a symlink and thus skipped)?

Anyways, with this PR plus above mentioned two commits, I was able to use sqlalchemy to connect to oracle databases from a Mac with Nix installed, too :-)

@flokli
Copy link
Contributor

flokli commented Jun 8, 2018

@mulderr patches for odpic were upstreamed (oracle/odpi#65),
I updated my oracle-instantclient-darwin branch to include the patch.

Would you mind cherry-picking my commits in here?

@mulderr
Copy link
Contributor Author

mulderr commented Jun 9, 2018

@flokli Done.

Fair warning though, I don't use Macs or have one handy to test so it's impossible for me to verify. If it works for you then cool. Might as well take care of this right away.

@flokli
Copy link
Contributor

flokli commented Jun 9, 2018 via email

@mulderr
Copy link
Contributor Author

mulderr commented Jun 9, 2018

No worries. Patch removed.

@flokli
Copy link
Contributor

flokli commented Jun 9, 2018

LGTM. @matthewbauer, @FRidh, merge?

@matthewbauer matthewbauer merged commit e8072de into NixOS:master Jun 9, 2018
@mulderr
Copy link
Contributor Author

mulderr commented Jun 10, 2018

Thanks for all the input and for merging! Awesome.

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

5 participants