Skip to content

[FreeBSD] ld: error: unable to find library -lstdc++ #978

@yesudeep

Description

@yesudeep

Error

❯ bazel run //codelab/rust/scratch:scratch
...  
ERROR: /usr/home/yesudeep/code/foo/codelab/rust/scratch/BUILD.bazel:3:12: Compiling Rust bin scratch (1 files) failed: (Exit 1): process_wrapper failed: error executing command
  (cd /tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/execroot/foo && \
  exec env - \
    CARGO_CFG_TARGET_ARCH=x86_64 \
    CARGO_CFG_TARGET_OS=freebsd \
    CARGO_CRATE_NAME=scratch \
    CARGO_MANIFEST_DIR='${pwd}/codelab/rust/scratch' \
    CARGO_PKG_AUTHORS='' \
    CARGO_PKG_DESCRIPTION='' \
    CARGO_PKG_HOMEPAGE='' \
    CARGO_PKG_NAME=scratch \
    CARGO_PKG_VERSION=0.0.0 \
    CARGO_PKG_VERSION_MAJOR=0 \
    CARGO_PKG_VERSION_MINOR=0 \
    CARGO_PKG_VERSION_PATCH=0 \
    CARGO_PKG_VERSION_PRE='' \
    SYSROOT=../rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib \
  bazel-out/freebsd-opt-exec-2B5CBBC6/bin/external/rules_rust/util/process_wrapper/process_wrapper --subst 'pwd=${pwd}' -- external/rust_freebsd_x86_64/bin/rustc codelab/rust/scratch/scratch.rs '--crate-name=scratch' '--crate-type=bin' '--error-format=human' '--codegen=metadata=' '--out-dir=bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch' '--codegen=extra-filename=' '--codegen=opt-level=0' '--codegen=debuginfo=0' '--remap-path-prefix=${pwd}=.' '--emit=dep-info,link' '--color=always' '--target=x86_64-unknown-freebsd' -L external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib '--edition=2018' '--codegen=linker=/usr/bin/clang' --codegen 'link-args=-lm -lstdc++ -Wl,-z,relro,-z,now -no-canonical-prefixes')
Execution platform: @local_config_platform//:host
error: linking with `/usr/bin/clang` failed: exit status: 1
  |
  = note: "/usr/bin/clang" "-m64" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch.scratch.66a51977-cgu.0.rcgu.o" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch.scratch.66a51977-cgu.1.rcgu.o" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch.scratch.66a51977-cgu.2.rcgu.o" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch.scratch.66a51977-cgu.3.rcgu.o" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch.scratch.66a51977-cgu.4.rcgu.o" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch.scratch.66a51977-cgu.5.rcgu.o" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch.scratch.66a51977-cgu.6.rcgu.o" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch.scratch.66a51977-cgu.7.rcgu.o" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch.scratch.66a51977-cgu.8.rcgu.o" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch.scratch.66a51977-cgu.9.rcgu.o" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch.31uotomb0vn9wysp.rcgu.o" "-Wl,--as-needed" "-L" "external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib" "-L" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libstd-b30bbf77755791c2.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libpanic_unwind-a9d8d858c21e2190.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libminiz_oxide-6b69eeaae029b34f.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libadler-9b9a93bd0a1464a3.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libobject-5bb70223a7b81142.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libaddr2line-a31bb9e194197994.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libgimli-82ad57ce06d1f631.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libstd_detect-b7f1176bedf3cef3.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_demangle-092610b56f0e8d38.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libhashbrown-1ec2448e6cb185c7.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_std_workspace_alloc-18a51318c42ecd87.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libunwind-e1f94f993dba976d.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libcfg_if-b1ec89f63116d06e.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/liblibc-360c3f004d8f92d4.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/liballoc-73bd9201dab27b29.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_std_workspace_core-7ed01b22cd58e1ab.rlib" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libcore-b93c50b98471e952.rlib" "-Wl,--end-group" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib/libcompiler_builtins-b9fe0c01ec48febd.rlib" "-Wl,-Bdynamic" "-lexecinfo" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lrt" "-lutil" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/tmp/ramdisk/bazel/21298c98f6c16e14c7170c698f3518aa/external/rust_freebsd_x86_64/lib/rustlib/x86_64-unknown-freebsd/lib" "-o" "bazel-out/freebsd-fastbuild/bin/codelab/rust/scratch/scratch" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-lm" "-lstdc++" "-Wl,-z,relro,-z,now" "-no-canonical-prefixes"
  = note: ld: error: unable to find library -lstdc++
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: aborting due to previous error

Target //codelab/rust/scratch:scratch failed to build

System info:

❯ uname -a
FreeBSD ghostname 13.0-STABLE FreeBSD 13.0-STABLE GENERIC  amd64

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