Skip to content

Resim build failure on Arch Linux: documentation/change suggestion #1038

@rynoV

Description

@rynoV

I tried installing Resim (the simulator folder) on Arch Linux and ran into an error at the cargo install --path ./simulator step:

  error occurred: Command "sccache" "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "rocksdb/include/" "-I" "rocksdb/" "-I" "rocksdb/third-party/gtest-1.8.1/fused-src/" "-I" "snappy/" "-I" "lz4/lib/" "-I" "/home/calum/.local/share/.cargo/registry/src/github.com-1ecc6299db9ec823/zstd-sys-2.0.8+zstd.1.5.5/zstd/lib" "-I" "/home/calum/scripts/radix/radixdlt-scrypto/simulator/target/release/build/libz-sys-141b3fa7e129c0c6/out/include" "-I" "/home/calum/scripts/radix/radixdlt-scrypto/simulator/target/release/build/bzip2-sys-f5f4e66a40c6cff1/out/include" "-I" "." "-Wall" "-Wextra" "-std=c++17" "-Wsign-compare" "-Wshadow" "-Wno-unused-parameter" "-Wno-unused-variable" "-Woverloaded-virtual" "-Wnon-virtual-dtor" "-Wno-missing-field-initializers" "-Wno-strict-aliasing" "-Wno-invalid-offsetof" "-msse2" "-std=c++17" "-DSNAPPY=1" "-DLZ4=1" "-DZSTD=1" "-DZLIB=1" "-DBZIP2=1" "-DNDEBUG=1" "-DOS_LINUX" "-DROCKSDB_PLATFORM_POSIX" "-DROCKSDB_LIB_IO_POSIX" "-DROCKSDB_SUPPORT_THREAD_LOCAL" "-DHAVE_UINT128_EXTENSION=1" "-DHAVE_UINT128_EXTENSION=1" "-o" "/home/calum/scripts/radix/radixdlt-scrypto/simulator/target/release/build/librocksdb-sys-f236cfdc4d0cf710/out/rocksdb/table/block_based/data_block_hash_index.o" "-c" "rocksdb/table/block_based/data_block_hash_index.cc" with args "c++" did not execute successfully (status code exit status: 1).

There were also a bunch of errors like

  cargo:warning=In file included from rocksdb/table/block_based/data_block_hash_index.cc:9:
  cargo:warning=rocksdb/table/block_based/data_block_hash_index.h:65:7: error: ‘uint8_t’ does not name a type
  cargo:warning=   65 | const uint8_t kNoEntry = 255;
  cargo:warning=      |       ^~~~~~~
  cargo:warning=rocksdb/table/block_based/data_block_hash_index.h:1:1: note: ‘uint8_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
  cargo:warning=  +++ |+#include <cstdint>
  cargo:warning=    1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.

LLVM and C++ were installed through arch's standard repositories. It was also the same error after disabling sccache.

At first I updated the rocksdb dependency in radix-engine-stores from 0.19.0 to 0.21.0, and this fixed the build for me and the install seemed to be successful. I'm not sure if this would silently break things though.

Then my colleague pointed out that Arch's default gcc installation has some breaking changes, so the fix was:

  1. Install libc++ via pacman

  2. Set the environment variables: export CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++"

  3. In the simulator folder, add a build.rs file with contents:

    fn main() {
      println!("cargo:rustc-link-lib=c++");
    }

And this also fixed the installation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions