Giter Site home page Giter Site logo

Comments (10)

ThetaSinner avatar ThetaSinner commented on June 11, 2024 1

Okay so the reason that this is happening is super simple, I did it wrong :)

So the stdenv makes Nix use mold as the linker but it does not make Rust use it. I'm not sure why the way I tested it resulted in a successful build but I'm assuming I got a step wrong somewhere.

A working flake is:

{
  description = "Template for Holochain app development";

  inputs = {
    versions.url  = "github:holochain/holochain?dir=versions/weekly";

    holochain-flake.url = "github:holochain/holochain";
    holochain-flake.inputs.versions.follows = "versions";

    nixpkgs.follows = "holochain-flake/nixpkgs";
    flake-parts.follows = "holochain-flake/flake-parts";
  };

  outputs = inputs:
    inputs.flake-parts.lib.mkFlake
      {
        inherit inputs;
      }
      {
        systems = builtins.attrNames inputs.holochain-flake.devShells;
        perSystem =
          { inputs'
          , config
          , pkgs
          , system
          , ...
          }: {
            devShells.default = pkgs.mkShell.override { stdenv = inputs'.holochain-flake.devShells.holonix.stdenv; } {
              inputsFrom = [ inputs'.holochain-flake.devShells.holonix ];
              packages = [
                pkgs.nodejs-18_x
                # more packages go here
              ];
              shellHook = '' export RUSTFLAGS="-C link-arg=-fuse-ld=mold" '';
            };
          };
      };
}

So creating a new shell and using inputsFrom does not inherit the stdenv, mold won't be available. Then the shellHook is also necessary to tell Rust to use the provided mold.

Note that this flake will only work correctly on Linux so it's not really fit for purpose at the moment. It is useful for understanding the missing pieces but that's about it for the moment.

I'll have a think about a reasonable way to put this together. I think an alternative mkShell exposed from this repo might be good so we can customise for the user and the RUSTFLAGS we can set in the holonix shell hook but that's a bit risky for clashes with project settings...

from holochain.

steveej avatar steveej commented on June 11, 2024 1

thanks for updating the example repo!

i now have a reproduction of the issue, identified the root cause, and also found a workaround that we can apply to holonix.

the root cause is that holochain's test_utils feature effectively introduces a dependency on openssl with the default feature set, causing it to link against the system's openssl.

openssl v0.10.57
└── openssl feature "default"
    └── native-tls v0.2.11
        └── native-tls feature "default"
            ├── hyper-tls v0.5.0
            │   └── hyper-tls feature "default"
            │       └── reqwest v0.11.17
            │           ├── reqwest feature "__tls"
            │           │   └── reqwest feature "default-tls"
            │           │       └── reqwest feature "default"
            │           │           ├── kitsune_p2p_bootstrap v0.2.0-beta-dev.12
            │           │           │   ├── kitsune_p2p_bootstrap feature "default"
            │           │           │   │   ├── holochain v0.3.0-beta-dev.21
            │           │           │   │   │   ├── holochain feature "arbitrary"
            │           │           │   │   │   │   └── holochain feature "test_utils"
            │           │           │   │   │   │       [dev-dependencies]
            │           │           │   │   │   │       └── posts v0.0.1 (/home/steveej/src/others/bug-reproduction-serialize-unit-value/dnas/demo/zomes/coordinator/posts)
            │           │           │   │   │   │           └── posts feature "default" (command-line)

a possible workaround to holonix is to add openssl to LD_LIBRARY_PATH. i'm preparing that workaround in #2942.

from holochain.

steveej avatar steveej commented on June 11, 2024 1

fixed by #2942 with a fix to CI regression tests coming in #3048.

@mattyg after a nix flake update this ought to just work should work for you now too 🙂 please re-open or file a new issue if that's not the case.

from holochain.

ThetaSinner avatar ThetaSinner commented on June 11, 2024

It looks like the stdenv part is being looked at here #2942

from holochain.

steveej avatar steveej commented on June 11, 2024

i implemented a basic version of switching to mold on linux in the devShells.

@mattyg please test it on the repo, see the changes here. either me or GitHub are confused as it won't let me create a PR from my branch.

from holochain.

mattyg avatar mattyg commented on June 11, 2024

i implemented a basic version of switching to mold on linux in the devShells.

@mattyg please test it on the repo, see the changes here. either me or GitHub are confused as it won't let me create a PR from my branch.

Thank you! Now the tests build and run but I'm getting this error linking to libssl

/home/matt/Projects/Holochain/bug-reproduction-serialize-unit-value/target/debug/deps/test-fc6f51688c9afa1e: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory

from holochain.

steveej avatar steveej commented on June 11, 2024

i can't reproduce the above. i'm getting seemingly unrelated compiler errors:

error[E0277]: the trait bound `SweetCell: hdk::prelude::Serialize` is not satisfied
  --> dnas/demo/zomes/coordinator/posts/tests/test.rs:28:50
   |
28 |         .call(&alice.zome("posts"), "get_usize", ah)

it'd be great if you could lay out the exact revision of this reop and commands that you use to reproduce the error you're seeing.

from holochain.

mattyg avatar mattyg commented on June 11, 2024

sorry i had local changes to the example repo -- pushed

from holochain.

steveej avatar steveej commented on June 11, 2024

@mattyg would you mind double-checking that https://github.com/steveej/bug-reproduction-nix-zome-build/tree/new-main works as expected for you now?

from holochain.

mattyg avatar mattyg commented on June 11, 2024

yep it works now - thank you!

from holochain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.