Skip to content

unable to compile blobstore tutorial #1448

@evbo

Description

@evbo

Hi,

I just copy and pasted the tutorial for each gradual step you introduce. They all compiled except the last step, with the shared struct.

error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/usr/local/rustup/toolchains/1.85.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/bin:/home/meef_hora/.vscode-server/bin/fabdb6a30b49f79a7aba0f2ad9df9b399473380f/bin/remote-cli:/opt:/home/meef_hora/.cargo/bin:/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt" VSLANG="1033" "cc" "/tmp/rustcihyJdz/symbols.o" "<30 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "-lp4" "/home/meef_hora/workspace/vui/p4/target/debug/deps/{libcxx-6bb308f8d8421380.rlib,libfoldhash-812e36fdae58e35e.rlib,liblink_cplusplus-afd34d3560ea8fde.rlib}" "/usr/local/rustup/toolchains/1.85.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/{libstd-55e662df679d038f.rlib,libpanic_unwind-8015a5c851b5d89f.rlib,libobject-1238c66087ccc721.rlib,libmemchr-49c225520932793c.rlib,libaddr2line-b5c2000e0cd7e2da.rlib,libgimli-260b0ae067fcbc74.rlib,librustc_demangle-bdd5e3a96276e325.rlib,libstd_detect-0b86b09b624ecd98.rlib,libhashbrown-f81554601df81dba.rlib,librustc_std_workspace_alloc-1ef59f0a1b872e31.rlib,libminiz_oxide-904261fe6c2793b4.rlib,libadler-7522a3b17c9865c1.rlib,libunwind-1146c5c38405ef5e.rlib,libcfg_if-d85d8ca815fd8ede.rlib,liblibc-a407511d16763038.rlib,liballoc-dd37cd35aaa8bbc1.rlib,librustc_std_workspace_core-e352fdf6f38ada21.rlib,libcore-f87f661789447f5d.rlib,libcompiler_builtins-28e5089f2b5f6c14.rlib}" "-Wl,-Bdynamic" "-lstdc++" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/meef_hora/workspace/vui/p4/target/debug/build/p4-4031cc30d188d4ce/out" "-L" "/home/meef_hora/workspace/vui/p4/target/debug/build/cxx-a702a9235336e33a/out" "-L" "/home/meef_hora/workspace/vui/p4/target/debug/build/link-cplusplus-c2c1d9629db9d844/out" "-L" "/usr/local/rustup/toolchains/1.85.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/home/meef_hora/workspace/vui/p4/target/debug/deps/p4-46b25211ccef2e01" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /usr/bin/ld: /home/meef_hora/workspace/vui/p4/target/debug/build/p4-4031cc30d188d4ce/out/libp4.a(5fa057a746941d2e-main.rs.o): in function `cxxbridge1$new_blobstore_client':
          /home/meef_hora/workspace/vui/p4/target/debug/build/p4-4031cc30d188d4ce/out/cxxbridge/sources/p4/src/main.rs.cc:854: undefined reference to `new_blobstore_client()'
          /usr/bin/ld: /home/meef_hora/workspace/vui/p4/target/debug/build/p4-4031cc30d188d4ce/out/cxxbridge/sources/p4/src/main.rs.cc:854: undefined reference to `new_blobstore_client()'
          /usr/bin/ld: /home/meef_hora/workspace/vui/p4/target/debug/build/p4-4031cc30d188d4ce/out/libp4.a(5fa057a746941d2e-main.rs.o): in function `cxxbridge1$BlobstoreClient$put':
          /home/meef_hora/workspace/vui/p4/target/debug/build/p4-4031cc30d188d4ce/out/cxxbridge/sources/p4/src/main.rs.cc:859: undefined reference to `BlobstoreClient::put(MultiBuf&) const'
          /usr/bin/ld: /home/meef_hora/workspace/vui/p4/target/debug/build/p4-4031cc30d188d4ce/out/cxxbridge/sources/p4/src/main.rs.cc:859: undefined reference to `BlobstoreClient::put(MultiBuf&) const'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)

error: could not compile `p4` (bin "p4") due to 1 previous error

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/12/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-14' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Debian 12.2.0-14)

$ rustc --version
rustc 1.85.0 (4d91de4e4 2025-02-17)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions