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

Add rust_doc_test to ffi example #3172

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sebas-zip
Copy link

adding rust_doc_test to ffi example to show linking error. This may be related to the issue:
#78

bazel test //rust_calling_c/example_2:matrix_doc_test
INFO: Analyzed target //rust_calling_c/example_2:matrix_doc_test (0 packages loaded, 0 targets configured).
INFO: Found 1 test target...
FAIL: //rust_calling_c/example_2:matrix_doc_test (see /home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/execroot/_main/bazel-out/k8-fastbuild/testlogs/rust_calling_c/example_2/matrix_doc_test/test.log)
INFO: From Testing //rust_calling_c/example_2:matrix_doc_test:
==================== Test output for //rust_calling_c/example_2:matrix_doc_test:

running 1 test
test rust_calling_c/example_2/src/matrix.rs - Matrix (line 30) ... FAILED

failures:

---- rust_calling_c/example_2/src/matrix.rs - Matrix (line 30) stdout ----
error: linking with `/usr/bin/gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/rust_toolchain/lib/rustlib/x86_64-unknown-linux-gnu/bin" VSLANG="1033" "/usr/bin/gcc" "-m64" "/tmp/rustciT4foi/symbols.o" "/tmp/rustdoctestqoc7oG/rust_out.rust_out.a55a08873e1b84b0-cgu.0.rcgu.o" "/tmp/rustdoctestqoc7oG/rust_out.48ehprphb7s9hlkp.rcgu.o" "-Wl,--as-needed" "-L" "external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/rust_toolchain/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "external/_main~_repo_rules~libc" "-L" "rust_calling_c/example_2" "-L" "external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/rust_toolchain/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/execroot/_main/bazel-out/k8-fastbuild/bin/rust_calling_c/example_2/libmatrix-1130108680.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/execroot/_main/bazel-out/k8-fastbuild/bin/external/_main~_repo_rules~libc/liblibc-1144681119.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-d5189b81a4fa4d36.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-6a4779412a873200.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-c88c426dd6780435.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-e74540b31113a555.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-8751b61bd13c15cf.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-a8b99dba9f449259.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-f0068d76172a0372.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-c16dfaf47799564e.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-bfa26dd63e299db5.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-75a2330a693e738f.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-76779dce1f7ab63d.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-01c5cc588623cb35.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-07bb9745ec737292.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-6eacdcc91004cefb.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-ae2488b58226c836.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-52acaddcaaba04c6.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-326b78eac9ecd050.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-307ebf19f0f13d30.rlib" "/home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-d9076ee5964191bf.rlib" "-Wl,-Bdynamic" "-lc" "-lm" "-lrt" "-lutil" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/rust_toolchain/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/tmp/rustdoctestqoc7oG/rust_out" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-fuse-ld=gold" "-B/usr/bin" "-Wl,-no-as-needed" "-Wl,-z,relro,-z,now" "-pass-exit-codes" "-Wl,--push-state,-as-needed" "-lstdc++" "-Wl,--pop-state" "-Wl,--push-state,-as-needed" "-lm" "-Wl,--pop-state"
  = note: /home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/execroot/_main/bazel-out/k8-fastbuild/bin/rust_calling_c/example_2/libmatrix-1130108680.rlib(matrix-1130108680.matrix.975fc0e578b15861-cgu.0.rcgu.o):matrix.975fc0e578b15861-cgu.0:function matrix::Matrix::new: error: undefined reference to 'matrix_new'
          /home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/execroot/_main/bazel-out/k8-fastbuild/bin/rust_calling_c/example_2/libmatrix-1130108680.rlib(matrix-1130108680.matrix.975fc0e578b15861-cgu.0.rcgu.o):matrix.975fc0e578b15861-cgu.0:function <matrix::Matrix as core::ops::drop::Drop>::drop: error: undefined reference to 'matrix_free'
          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: aborting due to 1 previous error

Couldn't compile the test.

failures:
    rust_calling_c/example_2/src/matrix.rs - Matrix (line 30)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s

================================================================================
Target //rust_calling_c/example_2:matrix_doc_test up-to-date:
  bazel-bin/rust_calling_c/example_2/matrix_doc_test.rustdoc_test.sh
INFO: Elapsed time: 0.311s, Critical Path: 0.21s
INFO: 2 processes: 2 linux-sandbox.
INFO: Build completed, 1 test FAILED, 2 total actions
//rust_calling_c/example_2:matrix_doc_test                               FAILED in 0.2s
  /home/sesovero/.cache/bazel/_bazel_sesovero/1d73c83305bc70be2f9db58ce66d559e/execroot/_main/bazel-out/k8-fastbuild/testlogs/rust_calling_c/example_2/matrix_doc_test/test.log

Executed 1 out of 1 test: 1 fails locally.

Copy link

google-cla bot commented Jan 8, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

adding rust_doc_test to ffi example
@sebas-zip sebas-zip changed the title Update BUILD.bazel Add rust_doc_test to ffi example Jan 9, 2025
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

Successfully merging this pull request may close these issues.

1 participant