rust-lang / rust-lang/rust

link rustc_driver failure , raise Undefined symbols for architecture x86_64

Open
#153,218 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug O-macos T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Summary

I want build rust 1.83 on my macos 10.13.
I'v installed llvm@18 on my os.

Command used
brew install rust --cc llvm_clang --debug
Expected behaviour

rust being install successful.

Actual behaviour

it raise exception.

  = note: Undefined symbols for architecture x86_64:
            "vtable for std::__1::basic_ostringstream, std::__1::allocator >", referenced from:
                __ZNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1B8ne180100Ev in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
            NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
            "std::__1::basic_stringbuf, std::__1::allocator >::str() const", referenced from:
                _LLVMRustPrintTargetCPUs in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
            "VTT for std::__1::basic_ostringstream, std::__1::allocator >", referenced from:
                _LLVMRustPrintTargetCPUs in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
                __ZNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1B8ne180100Ev in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
                std::__1::basic_ostringstream, std::__1::allocator >::~basic_ostringstream() in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
            "vtable for std::__1::basic_stringbuf, std::__1::allocator >", referenced from:
                _LLVMRustPrintTargetCPUs in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
                __ZNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1B8ne180100Ev in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
                std::__1::basic_ostringstream, std::__1::allocator >::~basic_ostringstream() in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
            NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: could not compile `rustc_driver` (lib) due to 1 previous error
Bootstrap configuration (bootstrap.toml)

I could not find bootstrap.toml in temporary build folder.

I can only find (config.toml) in root folder.

config.toml

# Use different pre-set defaults than the global defaults.
#
# See `src/bootstrap/defaults` for more information.
# Note that this has no default value (x.py uses the defaults in `config.example.toml`).
profile = 'dist'

[llvm]

# Whether to build LLVM as a dynamically linked library (as opposed to statically linked).
# Under the hood, this passes `--shared` to llvm-config.
# NOTE: To avoid performing LTO multiple times, we suggest setting this to `true` when `thin-lto` is enabled.
link-shared = true

[build]

# Whether to build documentation by default. If false, rustdoc and
# friends will still be compiled but they will not be used to generate any
# documentation.
#
# You can still build documentation when this is disabled by explicitly passing paths,
# e.g. `x doc library`.
docs = false

# Indicate whether the vendored sources are used for Rust dependencies or not.
#
# Vendoring requires additional setup. We recommend using the pre-generated source tarballs if you
# want to use vendoring. See
# https://forge.rust-lang.org/infra/other-installation-methods.html#source-code.
vendor = true

# Set of tools to be included in the installation.
#
# If `extended = false`, the only one of these built by default is rustdoc.
#
# If `extended = true`, they are all included.
#
# If any enabled tool fails to build, the installation fails.
tools = ['analysis', 'cargo', 'clippy', 'rustdoc', 'rustfmt', 'rust-analyzer-proc-macro-srv', 'rust-demangler', 'src']
#    "cargo",
#    "clippy",
#    "rustdoc",
#    "rustfmt",
#    "rust-analyzer",
#    "rust-analyzer-proc-macro-srv",
#    "analysis",
#    "src",
#    "wasm-component-ld",
#    "miri", "cargo-miri" # for dev/nightly channels
#]

# Build the profiler runtime (required when compiling with options that depend
# on this runtime, such as `-C profile-generate` or `-C instrument-coverage`).
profiler = true

# Indicates whether the native libraries linked into Cargo will be statically
# linked or not.
cargo-native-static = false

# Arguments passed to the `./configure` script, used during distcheck. You
# probably won't fill this in but rather it's filled in by the `./configure`
# script. Useful for debugging.
configure-args = ['--prefix=/usr/local/Cellar/rust/1.83.0_1', '--sysconfdir=/usr/local/etc', '--tools=analysis,cargo,clippy,rustdoc,rustfmt,rust-analyzer-proc-macro-srv,rust-demangler,src', '--llvm-root=/usr/local/opt/llvm@18', '--enable-llvm-link-shared', '--enable-profiler', '--enable-vendor', '--disable-cargo-native-static', '--disable-docs', '--disable-lld', '--set=rust.jemalloc', '--release-description=Homebrew', '--release-channel=stable']

[install]

# Where to install the generated toolchain. Must be an absolute path.
prefix = '/usr/local/Cellar/rust/1.83.0_1'

# Where to install system configuration files.
# If this is a relative path, it will get installed in `prefix` above
sysconfdir = '/usr/local/etc'

[rust]

# The "channel" for the Rust build to produce. The stable/beta channels only
# allow using stable features, whereas the nightly and dev channels allow using
# nightly features
#
# If using tarball sources, default value for `channel` is taken from the `src/ci/channel` file;
# otherwise, it's "dev".
channel = 'stable'

# A descriptive string to be appended to `rustc --version` output, which is
# also used in places like debuginfo `DW_AT_producer`. This may be useful for
# supplementary build information, like distro-specific package versions.
#
# The Rust compiler will differentiate between versions of itself, including
# based on this string, which means that if you wish to be compatible with
# upstream Rust you need to set this to "". However, note that if you are not
# actually compatible -- for example if you've backported patches that change
# behavior -- this may lead to miscompilations or other bugs.
description = 'Homebrew'

# Indicates whether LLD will be compiled and made available in the sysroot for rustc to execute, and
# whether to set it as rustc's default linker on `x86_64-unknown-linux-gnu`. This will also only be
# when *not* building an external LLVM (so only when using `download-ci-llvm` or building LLVM from
# the in-tree source): setting `llvm-config` in the `[target.x86_64-unknown-linux-gnu]` section will
# make this default to false.
lld = false

# Link the compiler and LLVM against `jemalloc` instead of the default libc allocator.
# This option is only tested on Linux and OSX.
jemalloc = true

[target.x86_64-apple-darwin]

# Path to the `llvm-config` binary of the installation of a custom LLVM to link
# against. Note that if this is specified we don't compile LLVM at all for this
# target.
llvm-config = '/usr/local/opt/llvm@18/bin/llvm-config'

[dist]



Operating system

macOS 10.13, intel x86_64 cpu

HEAD

it does not use git repo, it's tar file from
"https://static.rust-lang.org/dist/rustc-1.83.0-src.tar.gz"

and
"https://github.com/rust-lang/cargo/archive/refs/tags/0.84.0.tar.gz"

Additional context

the build script is homebrew Formula rust.rb

resource "rustc-bootstrap"
on_intel do
url "https://static.rust-lang.org/dist/2024-10-17/rustc-1.82.0-x86_64-apple-darwin.tar.xz", using: :nounzip

resource "cargo-bootstrap" do
on_intel do
url "https://static.rust-lang.org/dist/2024-10-17/cargo-1.82.0-x86_64-apple-darwin.tar.xz", using: :nounzip

resource "rust-std-bootstrap" do
on_macos do
on_intel do
url "https://static.rust-lang.org/dist/2024-10-17/rust-std-1.82.0-x86_64-apple-darwin.tar.xz", using: :nounzip

Build Log

Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 1.01s
WARNING: The `change-id` is missing in the `config.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 131075` at the top of `config.toml`
Building stage0 library artifacts (x86_64-apple-darwin)
   Compiling compiler_builtins v0.1.133
   Compiling memchr v2.5.0
   Compiling profiler_builtins v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/profiler_builtins)
   Compiling std v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/std)
   Compiling alloc v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/alloc)
   Compiling cfg-if v1.0.0
   Compiling adler v1.0.2
   Compiling rustc-demangle v0.1.24
   Compiling unwind v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/unwind)
   Compiling rustc-std-workspace-alloc v1.99.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/rustc-std-workspace-alloc)
   Compiling panic_abort v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/panic_abort)
   Compiling panic_unwind v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/panic_unwind)
   Compiling gimli v0.29.0
   Compiling miniz_oxide v0.7.4
   Compiling std_detect v0.1.5 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/stdarch/crates/std_detect)
   Compiling hashbrown v0.15.0
   Compiling object v0.36.4
   Compiling addr2line v0.22.0
   Compiling rustc-std-workspace-std v1.99.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/rustc-std-workspace-std)
   Compiling proc_macro v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/proc_macro)
   Compiling unicode-width v0.1.14
   Compiling getopts v0.2.21
   Compiling test v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/test)
   Compiling sysroot v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/library/sysroot)
    Finished `release` profile [optimized] target(s) in 21.71s
Building compiler artifacts (stage0 -> stage1, x86_64-apple-darwin)
   Compiling cfg-if v1.0.0
   Compiling once_cell v1.19.0
   Compiling stable_deref_trait v1.2.0
   
skip long log to reduce post size.

   Compiling rustc_hir_typeck v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/compiler/rustc_hir_typeck)
   Compiling rustc_borrowck v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/compiler/rustc_borrowck)
   Compiling rustc_passes v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/compiler/rustc_passes)
   Compiling rustc_interface v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/compiler/rustc_interface)
   Compiling rustc_driver_impl v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/compiler/rustc_driver_impl)
   Compiling rustc_driver v0.0.0 (/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/compiler/rustc_driver)
error: linking with `cc` failed: exit status: 1

  |
  = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET -u XROS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/bin:/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/bin:/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/bin:/usr/local/Homebrew/Library/Homebrew/shims/mac/super:/usr/local/opt/openssl@3/bin:/usr/local/opt/libgit2@1.8/bin:/usr/local/opt/lz4/bin:/usr/local/opt/xz/bin:/usr/local/opt/zstd/bin:/usr/local/opt/llvm@18/bin:/usr/local/opt/pkgconf/bin:/usr/local/opt/python@3.9/bin:/usr/local/opt/python@3.9/libexec/bin:/usr/bin:/bin:/usr/sbin:/sbin" VSLANG="1033" ZERO_AR_DATE="1" "cc" "-Wl,-exported_symbols_list" "-Wl,/private/tmp/rustcRhdL7g/list" "-arch" "x86_64" "-m64" "/private/tmp/rustcRhdL7g/symbols.o" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/deps/rustc_driver-f95b5e658c91b7ee.rustc_driver.889d9b77049e32a9-cgu.0.rcgu.o" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/deps/rustc_driver-f95b5e658c91b7ee.6qwd3s8qwowechi8rleewsxw6.rcgu.rmeta" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/deps/rustc_driver-f95b5e658c91b7ee.dkiskpjvobyynmlg3nn6jgt7n.rcgu.o" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/deps/librustc_driver_impl-a700fc44515a0e81.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/deps/libctrlc-7a60cb697c45b146.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/deps/libnix-f36c83a9e46a3b69.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/deps/librustc_log-e431f427b6ca3e15.rlib" 

skip very very long log to reduce post size.

 "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-c247b06ad2381d83.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-d634e0823f345828.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-42ac2c9b5bb6f7e2.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-f731e2538d1a7c17.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/libminiz_oxide-8ca0222f8e241076.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/libadler-13f6186f076879b8.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/libunwind-360e191d6f030e3a.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-da42bddee97705a7.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/liblibc-828537a73cf5b344.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/liballoc-b0690bbd600b391c.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-f1363a23a236dad8.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/libcore-ea1fb75823a63a15.rlib" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-2bd8a1aedecf36a6.rlib" "-lz" "-lLLVM-18" "-lc++" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/build/psm-b4e3eaf56eb782b8/out" "-L" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/build/blake3-bf8fb3eee317eacd/out" "-L" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/build/blake3-bf8fb3eee317eacd/out" "-L" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/build/rustc_llvm-caa2cf5c24c78a7c/out" "-L" "/usr/local/Cellar/llvm@18/18.1.8/lib" "-o" "/private/tmp/rust-20260228-44768-s8aiyx/rustc-1.83.0-src/build/x86_64-apple-darwin/stage0-rustc/x86_64-apple-darwin/release/deps/librustc_driver-f95b5e658c91b7ee.dylib" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-Wl,-install_name" "-Wl,@rpath/librustc_driver-f95b5e658c91b7ee.dylib" "-nodefaultlibs" "-Wl,-rpath,@loader_path/../lib"

  = note: Undefined symbols for architecture x86_64:
            "vtable for std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
                __ZNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1B8ne180100Ev in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
            NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
            "std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const", referenced from:
                _LLVMRustPrintTargetCPUs in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
            "VTT for std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
                _LLVMRustPrintTargetCPUs in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
                __ZNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1B8ne180100Ev in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
                std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_ostringstream() in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
            "vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from:
                _LLVMRustPrintTargetCPUs in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
                __ZNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1B8ne180100Ev in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
                std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_ostringstream() in librustc_codegen_llvm-ca4c576b704b5d25.rlib(7372e21ddc8be4fd-PassWrapper.o)
            NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: could not compile `rustc_driver` (lib) due to 1 previous error




Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Homebrew Formula rust.rb and the reported config.toml, then reproduce the brew install rust --cc llvm_clang --debug build on macOS 10.13. Inspect the failure while compiling rustc_driver and its x86_64 linker invocation. Done means identifying a reproducible cause and confirming that the Rust build completes successfully with the documented configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, rust
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.