Closed Bug 1541999 Opened 6 years ago Closed 6 years ago

Android ARM build fails with "cargo:warning=dyld: Symbol not found: __ZN4llvm6detail14format_adapter6anchorEv" compiling third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb.c

Categories

(Firefox Build System :: Android Studio and Gradle Integration, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1536486

People

(Reporter: nalexander, Unassigned)

Details

On macOS, immediately after |mach bootstrap|, I can no longer build. I'm running Rust 1.33:

$ rustc --version
rustc 1.33.0 (2aa4c46cf 2019-02-28)

This looks like an error aligning the clang/llvm libraries with Rust itself :(

 5:28.18 error: failed to run custom build command for `lmdb-rkv-sys v0.8.2`
 5:28.19 process didn't exit successfully: `/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/release/build/lmdb-rkv-sys-dd4210e80088dc2f/build-script-build` (exit code: 101)
 5:28.19 --- stdout
 5:28.19 TARGET = Some("thumbv7neon-linux-androideabi")
 5:28.19 HOST = Some("x86_64-apple-darwin")
 5:28.19 CC_thumbv7neon-linux-androideabi = None
 5:28.19 CC_thumbv7neon_linux_androideabi = Some(" /Users/nalexander/.cargo/bin/sccache /Users/nalexander/.mozbuild/clang/bin/clang -std=gnu99 --target=arm-linux-androideabi")
 5:28.19 CFLAGS_thumbv7neon-linux-androideabi = None
 5:28.19 CFLAGS_thumbv7neon_linux_androideabi = Some("-I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/system_wrappers -include /Users/nalexander/Mozilla/gecko/config/gcc_hidden.h -DNDEBUG=1 -DTRIMMED=1 -I/Users/nalexander/Mozilla/gecko/toolkit/library/rust -I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/toolkit/library/rust -I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/include -I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/include/nspr -I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/include/nss -fPIC -include /Users/nalexander/Mozilla/objdirs/objdir-droid-compile/mozilla-config.h -DMOZILLA_CLIENT -Qunused-arguments -isystem /Users/nalexander/.mozbuild/android-ndk-r17b/sysroot/usr/include/arm-linux-androideabi -isystem /Users/nalexander/.mozbuild/android-ndk-r17b/sysroot/usr/include -gcc-toolchain /Users/nalexander/.mozbuild/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 -D__ANDROID_API__=16 -fstack-protector-strong -mno-unaligned-access -fno-short-enums -fno-exceptions -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=softfp -fstack-protector-strong -fno-strict-aliasing -fno-math-errno -pipe -g -Oz -mno-outline -fno-omit-frame-pointer -funwind-tables -DMOZILLA_CONFIG_H")
 5:28.19 CRATE_CC_NO_DEFAULTS = None
 5:28.19 DEBUG = Some("false")
 5:28.19 running: "/Users/nalexander/.cargo/bin/sccache" "/Users/nalexander/.mozbuild/clang/bin/clang" "-std=gnu99" "--target=arm-linux-androideabi" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=thumbv7neon-linux-androideabi" "-I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/system_wrappers" "-include" "/Users/nalexander/Mozilla/gecko/config/gcc_hidden.h" "-DNDEBUG=1" "-DTRIMMED=1" "-I/Users/nalexander/Mozilla/gecko/toolkit/library/rust" "-I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/toolkit/library/rust" "-I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/include" "-I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/include/nspr" "-I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/include/nss" "-fPIC" "-include" "/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/mozilla-config.h" "-DMOZILLA_CLIENT" "-Qunused-arguments" "-isystem" "/Users/nalexander/.mozbuild/android-ndk-r17b/sysroot/usr/include/arm-linux-androideabi" "-isystem" "/Users/nalexander/.mozbuild/android-ndk-r17b/sysroot/usr/include" "-gcc-toolchain" "/Users/nalexander/.mozbuild/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64" "-D__ANDROID_API__=16" "-fstack-protector-strong" "-mno-unaligned-access" "-fno-short-enums" "-fno-exceptions" "-march=armv7-a" "-mthumb" "-mfpu=neon" "-mfloat-abi=softfp" "-fstack-protector-strong" "-fno-strict-aliasing" "-fno-math-errno" "-pipe" "-g" "-Oz" "-mno-outline" "-fno-omit-frame-pointer" "-funwind-tables" "-DMOZILLA_CONFIG_H" "-o" "/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/thumbv7neon-linux-androideabi/release/build/lmdb-rkv-sys-02d2f5fd81c55ca7/out/mdb.o" "-c" "/Users/nalexander/Mozilla/gecko/third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb.c"
 5:28.19 cargo:warning=dyld: Symbol not found: __ZN4llvm6detail14format_adapter6anchorEv
 5:28.19 cargo:warning=  Referenced from: /Users/nalexander/.mozbuild/clang/bin/clang
 5:28.20 cargo:warning=  Expected in: /Users/nalexander/.rustup/toolchains/stable-x86_64-apple-darwin/lib/libLLVM.dylib
 5:28.20 cargo:warning= in /Users/nalexander/.mozbuild/clang/bin/clang
 5:28.20 Compiler killed by signal 6
 5:28.20 exit code: 254
 5:28.20 --- stderr
 5:28.20 thread 'main' panicked at '
 5:28.20 Internal error occurred: Command "/Users/nalexander/.cargo/bin/sccache" "/Users/nalexander/.mozbuild/clang/bin/clang" "-std=gnu99" "--target=arm-linux-androideabi" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=thumbv7neon-linux-androideabi" "-I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/system_wrappers" "-include" "/Users/nalexander/Mozilla/gecko/config/gcc_hidden.h" "-DNDEBUG=1" "-DTRIMMED=1" "-I/Users/nalexander/Mozilla/gecko/toolkit/library/rust" "-I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/toolkit/library/rust" "-I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/include" "-I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/include/nspr" "-I/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/dist/include/nss" "-fPIC" "-include" "/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/mozilla-config.h" "-DMOZILLA_CLIENT" "-Qunused-arguments" "-isystem" "/Users/nalexander/.mozbuild/android-ndk-r17b/sysroot/usr/include/arm-linux-androideabi" "-isystem" "/Users/nalexander/.mozbuild/android-ndk-r17b/sysroot/usr/include" "-gcc-toolchain" "/Users/nalexander/.mozbuild/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64" "-D__ANDROID_API__=16" "-fstack-protector-strong" "-mno-unaligned-access" "-fno-short-enums" "-fno-exceptions" "-march=armv7-a" "-mthumb" "-mfpu=neon" "-mfloat-abi=softfp" "-fstack-protector-strong" "-fno-strict-aliasing" "-fno-math-errno" "-pipe" "-g" "-Oz" "-mno-outline" "-fno-omit-frame-pointer" "-funwind-tables" "-DMOZILLA_CONFIG_H" "-o" "/Users/nalexander/Mozilla/objdirs/objdir-droid-compile/thumbv7neon-linux-androideabi/release/build/lmdb-rkv-sys-02d2f5fd81c55ca7/out/mdb.o" "-c" "/Users/nalexander/Mozilla/gecko/third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb.c" with args "clang" did not execute successfully (status code exit code: 254).
 5:28.20 ', /Users/nalexander/Mozilla/gecko/third_party/rust/cc/src/lib.rs:2368:5
 5:28.20 stack backtrace:
 5:28.20    0:        0x1020bb8a3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h9a87463918f2aff9
 5:28.20    1:        0x1020b7b0c - std::sys_common::backtrace::_print::h54740e69908f9100
 5:28.20    2:        0x1020ba7f1 - std::panicking::default_hook::{{closure}}::h519f1fd4b67636f1
 5:28.21    3:        0x1020ba4f7 - std::panicking::default_hook::h5442e3ae9abda811
 5:28.21    4:        0x1020baf7e - std::panicking::rust_panic_with_hook::h4a3495c63f64f755
 5:28.21    5:        0x1020baa9c - std::panicking::continue_panic_fmt::h3de7ba5e03709cd8
 5:28.21    6:        0x1020ba9f0 - std::panicking::begin_panic_fmt::hacd31b9797a72469
 5:28.21    7:        0x1020a5a58 - cc::fail::h2e7358cd85befab1
 5:28.21    8:        0x10209888c - cc::Build::compile::h1cecc7892c281b61
 5:28.21    9:        0x10208a891 - build_script_build::main::hf29fcc99b42354ad
 5:28.21   10:        0x102089ed5 - std::rt::lang_start::{{closure}}::h1d0b1ef237e52c93
 5:28.21   11:        0x1020ba907 - std::panicking::try::do_call::hbdc2ad4ee791d633
 5:28.21   12:        0x1020c247e - __rust_maybe_catch_panic
 5:28.21   13:        0x1020bb33c - std::rt::lang_start_internal::h3dc68cf5532522d7
 5:28.21   14:        0x10208a948 - main
 5:28.21 make[4]: *** [force-cargo-library-build] Error 101
 5:28.21 make[3]: *** [toolkit/library/rust/target] Error 2

myk: there have been many issues building lmdb-rs. Seen this one?

Flags: needinfo?(myk)

Yep, this is bug 1536486. It isn't actually LMDB-specific, as it happens with every Rust crate in mozilla-central that compiles a C library (f.e. libloading). The lmdb-rkv-sys crate just happens to be the first one to build and fail most of the time.

Check out the comments in bug 1536486 for more details, or work around the problem by downgrading to Rust 1.32 or compiling with the system clang (i.e. not setting CC/CXX in your mozconfig to the ~/.mozbuild installation).

Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(myk)
Resolution: --- → DUPLICATE

(In reply to Myk Melez [:myk] [@mykmelez] from comment #2)

Yep, this is bug 1536486. It isn't actually LMDB-specific, as it happens with every Rust crate in mozilla-central that compiles a C library (f.e. libloading). The lmdb-rkv-sys crate just happens to be the first one to build and fail most of the time.

Check out the comments in bug 1536486 for more details, or work around the problem by downgrading to Rust 1.32 or compiling with the system clang (i.e. not setting CC/CXX in your mozconfig to the ~/.mozbuild installation).

Thanks, myk -- 1.32 works fine for me (although now I'm worried about Bug 1536543).

(In reply to Nick Alexander :nalexander [he/him] from comment #3)

Thanks, myk -- 1.32 works fine for me (although now I'm worried about Bug 1536543).

Bug 1536543 is marked as depending on bug 1536486, so this issue should get fixed before we start requiring Rust 1.33.

Product: Firefox for Android → Firefox Build System
You need to log in before you can comment on or make changes to this bug.