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

libyamlcpp: Disable build & install of Google Test #67186

Merged
merged 1 commit into from Sep 4, 2019

Conversation

xbreak
Copy link
Contributor

@xbreak xbreak commented Aug 21, 2019

Motivation for this change

The source repo includes a copy of Google Test which is build and installed by default, which then may lead to the wrong Google Test being used by packages using yaml-cpp (I just ran into this issue where headers came from the gtest Nix package and libraries from libyamlcpp).

Since no tests are executed for this package I've not thought about how change this impacts the ability to build & run unit tests in the future.

Before:

$ /nix/store/lbmc9yif9jjwm67vxqyzcp28nagfdv0b-libyaml-cpp-0.6.2/
└── lib
    ├── libgmock_main.so
    ├── libgmock.so
    ├── libgtest_main.so
    ├── libgtest.so
    ├── libyaml-cpp.so -> libyaml-cpp.so.0.6
    ├── libyaml-cpp.so.0.6 -> libyaml-cpp.so.0.6.2
    └── libyaml-cpp.so.0.6.2

After this commit:

$ tree /nix/store/gymr0ml4rmznz3m8b4k5a57c474cn3kg-libyaml-cpp-0.6.2
/nix/store/gymr0ml4rmznz3m8b4k5a57c474cn3kg-libyaml-cpp-0.6.2
└── lib
    ├── libyaml-cpp.so -> libyaml-cpp.so.0.6
    ├── libyaml-cpp.so.0.6 -> libyaml-cpp.so.0.6.2
    └── libyaml-cpp.so.0.6.2

Size:

# Before
$ nix path-info -Sh /nix/store/lbmc9yif9jjwm67vxqyzcp28nagfdv0b-libyaml-cpp-0.6.2
/nix/store/lbmc9yif9jjwm67vxqyzcp28nagfdv0b-libyaml-cpp-0.6.2     34.3M
$ nix path-info -Sh  /nix/store/sg9qvaf7px4qmy9zpf1w9bqsqgifa8kl-libyaml-cpp-0.6.2-dev
/nix/store/sg9qvaf7px4qmy9zpf1w9bqsqgifa8kl-libyaml-cpp-0.6.2-dev         35.9M

# After
$ nix path-info -Sh /nix/store/gymr0ml4rmznz3m8b4k5a57c474cn3kg-libyaml-cpp-0.6.2
/nix/store/gymr0ml4rmznz3m8b4k5a57c474cn3kg-libyaml-cpp-0.6.2     32.8M
$ nix path-info -Sh /nix/store/2x0gd7kwcx10b88k96a64k44wcgmkk7i-libyaml-cpp-0.6.2-dev
/nix/store/2x0gd7kwcx10b88k96a64k44wcgmkk7i-libyaml-cpp-0.6.2-dev         32.9M

Nix-review packages built: brise calamares dcm2niix facter fcitx-engines.rime interception-tools ip2unix librime libyamlcpp libyamlcpp_0_3 mongodb openxcom osm2xmap powerdns

scylladb is broken on master for me so it also failed with this change.

Things done

Disabled Google Test with option -DYAML_CPP_BUILD_TESTS=OFF.

  • 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 nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @andir

The source repo includes a copy of Google Test, which is build
and installed by default, which may lead to the wrong Google Test
being used by packages using yaml-cpp.
@xbreak
Copy link
Contributor Author

xbreak commented Sep 2, 2019

@andir: Would you mind taking a look?

@andir
Copy link
Member

andir commented Sep 2, 2019

This looks fine as is but I'd prefer if we would run tests and just not install the test libraries.

@xbreak
Copy link
Contributor Author

xbreak commented Sep 2, 2019

Ok, I'll see what happens with doCheck = true and then exclude the unit tests and the embedded gtest from installation.

Update:
@andir: I made some experiements and this package is not very friendly to packagers. We'd need to patchelf the unit test (including version-dependent paths to the embedded gtest version) and then manually fixup the installation to remove gtest, gmock from the different outputs. It doesn't look very maintainable to me. If it's alright with you I'd prefer if this PR fixes the immediate problem with the installed gtest which introduces header and library collisions and defer the rest to later.

@andir
Copy link
Member

andir commented Sep 3, 2019

As an intermittent solution that would probably be fine. Do you have the time to raise a few upstream bugs about it not being nice to packagers?

@xbreak
Copy link
Contributor Author

xbreak commented Sep 3, 2019

I'll see what I can do, but I can't promise anything as I'm quite busy just getting the transition to Nix to work out.

@andir
Copy link
Member

andir commented Sep 3, 2019

No worries. Just trying to do the right thing here :)

@xbreak
Copy link
Contributor Author

xbreak commented Sep 4, 2019

@andir: Is there something else pending on my side or can this be merged as-is?

@andir andir merged commit 29e4048 into NixOS:master Sep 4, 2019
@andir
Copy link
Member

andir commented Sep 4, 2019

No, it is good as it is. I was just hoping to see the upstream comments (linked to here) before merging it.

@xbreak xbreak deleted the libyaml-cpp/no-gtest branch September 5, 2019 10:58
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

2 participants