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

fails to build on NixOS #10

Open
mhuesch opened this issue Sep 8, 2021 · 4 comments
Open

fails to build on NixOS #10

mhuesch opened this issue Sep 8, 2021 · 4 comments

Comments

@mhuesch
Copy link

mhuesch commented Sep 8, 2021

hi!

I was looking through this repo as an example Holochain project to help me understand good structuring / practices. it has been helpful in that way - thanks 🙂

when I follow the steps in the README, I encounter an error in npm install (technically, inside of npm run build-holochain):

vayu :: ~/projects/elemental-chess ‹main› » g rev-parse HEAD
627a7b08472a9478dbb7c08a972a40adab954290

vayu :: ~/projects/elemental-chess ‹main› » nix-shell

trace: Warning: `stdenv.lib` is deprecated and will be removed in the next release. Please use `lib` instead. For more information see https://github.com/NixOS/nixpkgs/issues/108938
trace: Warning: `stdenv.lib` is deprecated and will be removed in the next release. Please use `lib` instead. For more information see https://github.com/NixOS/nixpkgs/issues/108938

[nix-shell:~/projects/elemental-chess]$ cd dna

[nix-shell:~/projects/elemental-chess/dna]$ CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown
   Compiling hc_zome_chess v0.0.1 (/home/mhueschen/projects/elemental-chess/dna/zomes/chess)
   Compiling profiles v0.0.1 (/home/mhueschen/projects/elemental-chess/dna/zomes/profiles)
   Compiling invitations v0.0.1 (/home/mhueschen/projects/elemental-chess/dna/zomes/invitations)
    Finished release [optimized] target(s) in 1.20s

[nix-shell:~/projects/elemental-chess/dna]$ hc dna pack workdir/dna
Wrote bundle /home/mhueschen/projects/elemental-chess/dna/workdir/dna/elemental-chess.dna

[nix-shell:~/projects/elemental-chess/dna]$ hc app pack workdir/happ
Wrote bundle /home/mhueschen/projects/elemental-chess/dna/workdir/happ/elemental-chess.happ

[nix-shell:~/projects/elemental-chess]$ cd ui

[nix-shell:~/projects/elemental-chess/ui]$ npm install
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> @eyss/elemental-chess@0.0.0 prepublish /home/mhueschen/projects/elemental-chess/ui
> npm run build-holochain


> @eyss/elemental-chess@0.0.0 build-holochain /home/mhueschen/projects/elemental-chess/ui
> rimraf dist && ENV=hc rollup -c rollup.config.js


./index.html → dist...
(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
[!] (plugin typescript) Error: @rollup/plugin-typescript TS2724: Module '"../node_modules/@holochain-open-dev/profiles/dist"' has no exported member 'PROFILES_STORE_CONTEXT'. Did you mean 'profilesStoreContext'?
src/chess-app.ts (17:3)

17   PROFILES_STORE_CONTEXT,
     ~~~~~~~~~~~~~~~~~~~~~~

  node_modules/@holochain-open-dev/profiles/dist/context.d.ts:3:22
    3 export declare const profilesStoreContext: Context<ProfilesStore>;
                           ~~~~~~~~~~~~~~~~~~~~
    'profilesStoreContext' is declared here.

Error: @rollup/plugin-typescript TS2724: Module '"../node_modules/@holochain-open-dev/profiles/dist"' has no exported member 'PROFILES_STORE_CONTEXT'. Did you mean 'profilesStoreContext'?
    at error (/home/mhueschen/projects/elemental-chess/ui/node_modules/rollup/dist/shared/rollup.js:164:30)
    at throwPluginError (/home/mhueschen/projects/elemental-chess/ui/node_modules/rollup/dist/shared/rollup.js:19161:12)
    at Object.error (/home/mhueschen/projects/elemental-chess/ui/node_modules/rollup/dist/shared/rollup.js:19810:20)
    at emitDiagnostic (/home/mhueschen/projects/elemental-chess/ui/node_modules/@rollup/plugin-typescript/dist/index.js:493:17)
    at reportDiagnostics (/home/mhueschen/projects/elemental-chess/ui/node_modules/@rollup/plugin-typescript/dist/index.js:501:9)
    at Array.forEach (<anonymous>)
    at emitFilesAndReportErrors (/home/mhueschen/projects/elemental-chess/ui/node_modules/typescript/lib/typescript.js:108295:21)
    at Object.result.afterProgramCreate (/home/mhueschen/projects/elemental-chess/ui/node_modules/typescript/lib/typescript.js:108466:13)
    at Object.afterProgramCreate (/home/mhueschen/projects/elemental-chess/ui/node_modules/@rollup/plugin-typescript/dist/index.js:655:29)
    at synchronizeProgram (/home/mhueschen/projects/elemental-chess/ui/node_modules/typescript/lib/typescript.js:108730:22)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @eyss/elemental-chess@0.0.0 build-holochain: `rimraf dist && ENV=hc rollup -c rollup.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @eyss/elemental-chess@0.0.0 build-holochain script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mhueschen/.npm/_logs/2021-09-08T19_09_16_375Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @eyss/elemental-chess@0.0.0 prepublish: `npm run build-holochain`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @eyss/elemental-chess@0.0.0 prepublish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mhueschen/.npm/_logs/2021-09-08T19_09_16_395Z-debug.log

I wondered if this had something to do with changes in the profiles and invitations zones, which were set to track a branch, not a fixed git SHA. but I fixed them with the below patch and still get the same error.

commit 3ba8709aa22b3713eceb8ae041c90198ab54d001
Author: Michael Hueschen <m@mhueschen.space>
Date:   Wed Sep 8 12:58:13 2021 -0600

    specify zome git hash

diff --git a/dna/zomes/invitations/Cargo.toml b/dna/zomes/invitations/Cargo.toml
index a1fae31..72fcfb6 100644
--- a/dna/zomes/invitations/Cargo.toml
+++ b/dna/zomes/invitations/Cargo.toml
@@ -9,4 +9,4 @@ crate-type = ["cdylib", "rlib"]
 name = "invitations"
 
 [dependencies]
-hc_zome_invitations = {git = "https://github.com/eyss/hc_zome_invitations", branch = "main", package = "hc_zome_invitations"}
+hc_zome_invitations = {git = "https://github.com/eyss/hc_zome_invitations", rev = "7a68048b5669ad683ee8949374ebe1b81455cf00", package = "hc_zome_invitations"}
diff --git a/dna/zomes/profiles/Cargo.toml b/dna/zomes/profiles/Cargo.toml
index 9d722b2..c5a4b5c 100644
--- a/dna/zomes/profiles/Cargo.toml
+++ b/dna/zomes/profiles/Cargo.toml
@@ -9,4 +9,4 @@ name = "profiles"
 crate-type = [ "cdylib", "rlib" ]
 
 [dependencies]
-hc_zome_profiles = {git = "https://github.com/holochain-open-dev/profiles", package = "hc_zome_profiles", branch =  "main"}
+hc_zome_profiles = {git = "https://github.com/holochain-open-dev/profiles", rev =  "ba033c25b9800a78c14bceec889bc4c14b410875", package = "hc_zome_profiles"}
@jrhamilton
Copy link

Did you solve this issue? I'm also getting the following warning when running nix-shell inside developer-excercises:

trace: Warning: stdenv.lib is deprecated and will be removed in the next release. Please use lib instead. For more information see https://github.com/NixOS/nixpkgs/issues/108938

I am using Arch Linux as host.

I am wondering if this is also has anything to do with the "Bus Error (core dumped)" error I'm getting when running npm test.

@guillemcordoba
Copy link
Contributor

@mhuesch can you try again? At that moment the dependencies for this repo were being upgraded, and this one hadn't been yet.

@jrhamilton I'm curious... The warning trace: Warning: stdenv.lib I have seen sometimes when entering the nix-shell, but never given me any real problems. What is more interesting is the Bus Error (core dumped) error you are getting... Could you post a full log of the test run? And also make sure to be updated to latest version of code, and clean up your node_modules folder and npm install again :)

@jrhamilton
Copy link

jrhamilton commented Sep 15, 2021

I believe I was running out of space after /nix build after using nix-shell which may have been causing the Buss error (core dumped).

I chose to move the /nix onto a different partition.

For the curious, I completely removed Nix from my machine by using the following advice: https://github.com/NixOS/nix/issues/1402

I then re-installed: sh <(curl -L https://nixos.org/nix/install)

Before running nix-shell which builds the /nix directory, I first did the following:

ATTENTION, SCARY PROCEDURE INCOMING!

  1. Create a separate partition. I set for 30 gigs.
  2. Retreived UUID of partition: sudo blkid
  3. Create a separate temporary folder to mount partition: sudo mkdir /mnt/tmpnix
  4. Mount partition: sudo mount /dev/sdaX /mnt/tmpnix
  5. use rsync and preserve ownerships, symlinks and meta: sudo rsync -avz /nix/ /mnt/tmpnix/
  6. sudo umount /mnt/tmpnix
  7. sudo rm -rf /nix
  8. sudo mkdir /nix; sudo chown $USER:root /nix
  9. sudo mount /dev/sdaX /nix
  10. create add new /nix partition to fstab file: UUID=X-X-X-X /nix ext4 rw,relatime 0 2

Then proceed with . ~/.nix-profile/etc/profile.d/nix.sh and nix-shell

As for the trace: Warning: stdenv.lib warning, I am still getting those.

Useful links for the above process:
https://github.com/NixOS/nix/issues/1402
https://serverfault.com/questions/255120/run-rsync-as-root-but-keep-user-ownership/255123#255123

@mhuesch mhuesch changed the title failes to build on NixOS fails to build on NixOS Sep 22, 2021
@mhuesch
Copy link
Author

mhuesch commented Sep 23, 2021

thanks @guillemcordoba. I am able to build it now, as of b324537 (although with the tweak of needing to set CARGO_HOME as well as CARGO_TARGET_DIR:

commit 73154163dafdbc421efb597235246b47f30c9082
Author: Michael Hueschen <m@mhueschen.space>
Date:   Wed Sep 22 19:40:22 2021 -0600

    redefine CARGO_HOME

diff --git a/package.json b/package.json
index 8040ece..b3ed986 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
     "start:happ": "rimraf .hc* && RUST_LOG=warn hc s generate ./dna/workdir/happ/invitations.happ --run=8888 -a test-app network --bootstrap https://bootstrap-staging.holo.host/ quic -p=kitsune-proxy://SYVd4CF3BdJ4DS7KwLLgeU3_DbHoZ34Y-qroZ79DOs8/kitsune-quic/h/165.22.32.11/p/5779/--",
     "build:happ": "npm run build:dna && hc app pack ./dna/workdir/happ",
     "build:dna": "npm run build:zome && hc dna pack ./dna/workdir/dna",
-    "build:zome": "cd dna && CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown"
+    "build:zome": "cd dna && CARGO_HOME=.cargo CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown"
   },
   "devDependencies": {
     "concurrently": "^6.2.1"

when I run the UI, I am able to execute start-bob successfully, but start-alice fails:

> @eyss/elemental-chess@0.0.0 start-alice
> HC_PORT=8888 concurrently -k --names ui,hc "ENV=hcdev npm run start-ui" "APP_ID=elemental-chess ADMIN_PORT=9000 npm run start-holochain"

[ui]
[ui] > @eyss/elemental-chess@0.0.0 start-ui
[ui] > concurrently -k --names tsc,web-dev-server "npm run build-watch" "sleep 5 && web-dev-server --config web-dev-server.config.mjs"
[ui]
[hc]
[hc] > @eyss/elemental-chess@0.0.0 start-holochain
[hc] > RUST_LOG=warn WASM_LOG=trace hc s -f=$ADMIN_PORT generate -r=$HC_PORT ../dna/workdir/happ/elemental-chess.happ --app-id=$APP_ID network -b https://bootstrap-staging.holo.host quic
[hc]
[hc] hc-sandbox: Creating 1 conductor sandboxes with same settings
[hc] hc-sandbox: Config ConductorConfig { environment_path: EnvironmentRootPath("/tmp/tmp.5IT61KTalA/rVnfcJklrV_bMVyrElKb6"), use_dangerous_test_keystore: false, dpki: None, keystore_path: Some("/tmp/tmp.5IT61KTalA/rVnfcJklrV_bMVyrElKb6/keystore"), passphrase_service: None, admin_interfaces: Some([AdminInterfaceConfig { driver: Websocket { port: 0 } }]), network: Some(KitsuneP2pConfig { transport_pool: [Quic { bind_to: None, override_host: None, override_port: None }], bootstrap_service: Some(Url2 { url: "https://bootstrap-staging.holo.host/" }), tuning_params: KitsuneP2pTuningParams { gossip_loop_iteration_delay_ms: 10, default_notify_remote_agent_count: 5, default_notify_timeout_ms: 30000, default_rpc_single_timeout_ms: 30000, default_rpc_multi_remote_agent_count: 2, default_rpc_multi_timeout_ms: 30000, agent_info_expires_after_ms: 1200000, tls_in_mem_session_storage: 512, proxy_keepalive_ms: 120000, proxy_to_expire_ms: 300000, concurrent_limit_per_thread: 32, tx2_quic_max_idle_timeout_ms: 30000, tx2_pool_max_connection_count: 4096, tx2_channel_count_per_connection: 3, tx2_implicit_timeout_ms: 30000, tx2_initial_connect_retry_delay_ms: 200 }, network_type: QuicBootstrap }) }
[hc] hc-sandbox: Created directory at: /tmp/tmp.5IT61KTalA/rVnfcJklrV_bMVyrElKb6 Keep this path to rerun the same sandbox
[hc] hc-sandbox: Created config at /tmp/tmp.5IT61KTalA/rVnfcJklrV_bMVyrElKb6/conductor-config.yaml
[hc] Sep 22 19:49:13.837 ERROR lair_keystore_client: error=IpcClientConnectError("/tmp/tmp.5IT61KTalA/rVnfcJklrV_bMVyrElKb6/keystore/socket", Os { code: 2, kind: NotFound, message: "No such file or directory" }) file="/build/holochain-vendor.tar.gz/lair_keystore_client/src/lib.rs" line=42
[hc]
[hc] Conductor ready.
[ui] [tsc]
[ui] [tsc] > @eyss/elemental-chess@0.0.0 build-watch
[ui] [tsc] > rimraf dist && rollup -c rollup.config.js -w
[ui] [tsc]
[ui] [tsc] rollup v2.56.3
[ui] [tsc] bundles index.html → .dist/8888...
[hc] Sep 22 19:49:15.649  WARN holochain::conductor::api::api_cell: Using placeholder dpki
^C[hc] APP_ID=elemental-chess ADMIN_PORT=9000 npm run start-holochain exited with code SIGINT
--> Sending SIGTERM to other processes..
[ui] [web-dev-server] sleep 5 && web-dev-server --config web-dev-server.config.mjs exited with code SIGINT
[ui] --> Sending SIGTERM to other processes..
[ui] [tsc] npm run build-watch exited with code SIGINT
[ui] ENV=hcdev npm run start-ui exited with code 1

if this isn't relevant to other users feel free to ignore - it's ok if I'm not able to build the repo as I've mostly done my learning at this point, just by looking at the code.

but if it's useful I'm happy to keep digging and try to get it working.

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

No branches or pull requests

3 participants