Subspace node build failed

Issue Report

cargo build --bin subspace-node
reports error at the end, while cargo check is passed

Environment

  • Operating System: Ubuntu 22.04 LTS
  • Pulsar/Advanced CLI/Docker: CLI

Problem

[Paste any errors or relevant logs here]
   Compiling fs4 v0.7.0
   Compiling Inflector v0.11.4
   Compiling gethostname v0.2.3
   Compiling thousands v0.2.0
"/home/qjyu/source/subspace/target/debug/deps/libfutures_channel-20f40362cf5845f0.rlib" "/home/qjyu/source/subspace/target/debug/deps/libpin_project_lite-e7704e5c7ccfd1ec.rlib" "/home/qjyu/source/subspace/target/debug/deps/libfutures_sink-6df7335d1378df9a.rlib" "/home/qjyu/source/subspace/target/debug/deps/libfutures_task-79c059327d7eb0b2.rlib" "/home/qjyu/source/subspace/target/debug/deps/libpin_utils-339fc95f834a67dc.rlib" "/home/qjyu/source/subspace/target/debug/deps/libfutures_core-b250fad77b0f2a81.rlib" "/home/qjyu/source/subspace/target/debug/deps/libparking_lot-d46fc27cf9023d6c.rlib" "/home/qjyu/source/subspace/target/debug/deps/libparking_lot_core-c3828c6cae585531.rlib" "/home/qjyu/source/subspace/target/debug/deps/libsmallvec-1a1f000e47a09001.rlib" "/home/qjyu/source/subspace/target/debug/deps/liblock_api-35c7117bd1aed165.rlib" "/home/qjyu/source/subspace/target/debug/deps/libscopeguard-003ee3b9b09cebdb.rlib" "/home/qjyu/source/subspace/target/debug/deps/libparity_scale_codec-741801d110038fb0.rlib" "/home/qjyu/source/subspace/target/debug/deps/libarrayvec-f9bab1f49304b6ef.rlib" "/home/qjyu/source/subspace/target/debug/deps/libbytes-71e25a16d173a543.rlib" "/home/qjyu/source/subspace/target/debug/deps/libbyte_slice_cast-1b835034bf5607e5.rlib" "/home/qjyu/source/subspace/target/debug/deps/libclap-f8bdfa31f6f330c3.rlib" "/home/qjyu/source/subspace/target/debug/deps/libclap_builder-52d41552e3b779a7.rlib" "/home/qjyu/source/subspace/target/debug/deps/libterminal_size-7cd8d911c3ad95df.rlib" "/home/qjyu/source/subspace/target/debug/deps/librustix-891dfe6349739e8b.rlib" "/home/qjyu/source/subspace/target/debug/deps/libbitflags-21f7b5cf0912bdf7.rlib" "/home/qjyu/source/subspace/target/debug/deps/liblinux_raw_sys-57b4b02ea99efaaf.rlib" "/home/qjyu/source/subspace/target/debug/deps/libstrsim-dc8145b3de3a0df7.rlib" "/home/qjyu/source/subspace/target/debug/deps/libanstream-f84261393812f867.rlib" "/home/qjyu/source/subspace/target/debug/deps/libanstyle_query-2692d8e6b4f98603.rlib" "/home/qjyu/source/subspace/target/debug/deps/libcolorchoice-c616dfc51be944b7.rlib" "/home/qjyu/source/subspace/target/debug/deps/libanstyle_parse-783d83033c961323.rlib" "/home/qjyu/source/subspace/target/debug/deps/libutf8parse-f46d75c45027b5b7.rlib" "/home/qjyu/source/subspace/target/debug/deps/libclap_lex-2cb77b7246933da8.rlib" "/home/qjyu/source/subspace/target/debug/deps/libanstyle-f4bf1ccf07d9edae.rlib" "/home/qjyu/source/subspace/target/debug/deps/libbip39-410510f93479437f.rlib" "/home/qjyu/source/subspace/target/debug/deps/libserde-f7c11437d884c8e3.rlib" "/home/qjyu/source/subspace/target/debug/deps/librand-372a6699e03afcc4.rlib" "/home/qjyu/source/subspace/target/debug/deps/librand_chacha-730b1908144f174d.rlib" "/home/qjyu/source/subspace/target/debug/deps/libppv_lite86-2e7f3c881e7293c7.rlib" "/home/qjyu/source/subspace/target/debug/deps/librand_core-1732fb2b2fcaf588.rlib" "/home/qjyu/source/subspace/target/debug/deps/libgetrandom-1563a2b16564e385.rlib" "/home/qjyu/source/subspace/target/debug/deps/liblibc-b71abe545012e9ff.rlib" "/home/qjyu/source/subspace/target/debug/deps/libcfg_if-0128a598f57c42f0.rlib" "/home/qjyu/source/subspace/target/debug/deps/libunicode_normalization-59c40a792da47fad.rlib" "/home/qjyu/source/subspace/target/debug/deps/libtinyvec-a28cafa3c8699823.rlib" "/home/qjyu/source/subspace/target/debug/deps/libtinyvec_macros-66661c55905090ec.rlib" "/home/qjyu/source/subspace/target/debug/deps/libbitcoin_hashes-11a64e31da3243f1.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-41777efa78699460.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-c112ec61d40d65ca.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-20279e89ddf4a3cc.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-04ebab3d6657d9b7.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-43ee38a2c180d260.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-d8bc9f4e15c9d54f.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-e6b80df35ce800f7.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-e1bb29bdfec551bd.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-7d60d25f346b95e2.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-f568bda7d014913a.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-a759d15c36457a02.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-dd7d06242b5022a0.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-f4343bfa39e809a4.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-af1cb76e71c5600e.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-8c4c4e24ed6290fa.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-58f5eb9eff701be9.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-9686387289eaa322.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-632ae0f28c5e55ff.rlib" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-b7903030bc1640bf.rlib" "-Wl,-Bdynamic" "-lz" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/qjyu/.rustup/toolchains/nightly-2024-02-29-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/qjyu/source/subspace/target/debug/deps/subspace_node-a14e0b450c93bf64" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: collect2: fatal error: ld terminated with signal 9 [Killed]
          compilation terminated.
          

error: could not compile `subspace-node` (bin "subspace-node") due to 1 previous error

Did an OOM (Out of Memory) occur? If not, please specify. If unknown, please paste the output of ‘dmesg’.

1 Like

[49971.096167] [ 163201] 1001 163201 84641 172 352256 27360 0 cargo
[49971.096169] [ 163313] 0 163313 4359 583 73728 0 0 sshd
[49971.096171] [ 163371] 1001 163371 4359 463 73728 192 0 sshd
[49971.096172] [ 163374] 1001 163374 2813 32 61440 416 0 sh
[49971.096174] [ 164038] 1001 164038 42126 640 126976 4352 0 rustup
[49971.096176] [ 164042] 1001 164042 452144 51 3149824 136768 0 rustc
[49971.096178] [ 164328] 1001 164328 1023 32 49152 96 0 cc
[49971.096179] [ 164329] 1001 164329 787 32 45056 32 0 collect2
[49971.096181] [ 164330] 1001 164330 962289 713917 7745536 246880 0 ld
[49971.096182] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1001.slice/session-51.scope,task=ld,pid=164330,uid=1001
[49971.096244] Out of memory: Killed process 164330 (ld) total-vm:3849156kB, anon-rss:2855540kB, file-rss:128kB, shmem-rss:0kB, UID:1001 pgtables:7564kB oom_score_adj:0
[50015.962200] workqueue: drain_vmap_area_work hogged CPU for >10000us 8 times, consider switching to WQ_UNBOUND

Build again with another 16GB memory system, still OOM.
What else can I do to build the node?

Building a node with 16GB of memory shouldn’t cause this problem, but if it indeed fails due to OOM, trying to enable swap should help. Please set a 32GB swap and try again. If the problem persists, then try other solutions. …

Amount of memory depends on number of CPU cores available. If you have a lot of CPU cores, compiler can do more work and might require more RAM in the process. What CPU is that?