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

rust-cross build failure due to missing llvm symbols using cxx11 references #47

Closed
codyps opened this issue Apr 13, 2016 · 4 comments · Fixed by #93
Closed

rust-cross build failure due to missing llvm symbols using cxx11 references #47

codyps opened this issue Apr 13, 2016 · 4 comments · Fixed by #93
Labels

Comments

@codyps
Copy link
Member

codyps commented Apr 13, 2016

Doesn't happen on all systems. I've observed this on arch linux, but not on gentoo. Might depend on whether the system gcc has the new cxx11 abi enabled.

Probably due to uninative.bbclass from selectively disabling gcc's new cxx11 abi & cross.bbclass having a different *_CXXFLAGS compared to native.bbclass

# https://wiki.debian.org/GCC5
# We may see binaries built with gcc5 run or linked into gcc4 environment
# so use the older libstdc++ standard for now until we don't support gcc4
# on the host system.
BUILD_CXXFLAGS_append = " -D_GLIBCXX_USE_CXX11_ABI=0"

Full error output

| error: linking with `gcc` failed: exit code: 1
| note: "gcc" "-Wl,--enable-new-dtags" "-Wl,--as-needed" "-m64" "-L" "x86_64-linux/stage0/lib/rustlib/x86_64-linux/lib" "x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/bin/rustc.0.o" "-o" "x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/bin/rustc" "-Wl,--gc-sections" "-Wl,-O1" "-nodefaultlibs" "-L" "x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-L" "/home/cody/obj/y/tmp/sysroots/x86_64-linux/usr/lib" "-L" "x86_64-linux/stage0/lib/rustlib/x86_64-linux/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_driver-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_passes-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_borrowck-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_privacy-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_typeck-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_lint-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_resolve-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "syntax_ext-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_plugin-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_metadata-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_trans-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_platform_intrinsics-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_mir-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_data_structures-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_back-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "flate-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "getopts-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "arena-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "fmt_macros-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "graphviz-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_front-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "syntax-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "term-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rustc_llvm-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "rbml-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "serialize-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "log-ca1c970e" "-L" "/home/cody/obj/y/tmp/work/x86_64-linux/rust-cross-arm/1.7.0-r0/build/x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib" "-l" "std-ca1c970e" "-l" "pthread" "-l" "edit" "-l" "dl" "-l" "m" "-l" "stdc++" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-Wl,-rpath,$ORIGIN/../lib" "-Wl,-rpath,/usr/local/lib/rustlib/x86_64-linux/lib" "-l" "compiler-rt" "-L/home/cody/obj/y/tmp/sysroots/x86_64-linux/usr/lib" "-L/home/cody/obj/y/tmp/sysroots/x86_64-linux/lib" "-Wl,-rpath-link,/home/cody/obj/y/tmp/sysroots/x86_64-linux/usr/lib" "-Wl,-rpath-link,/home/cody/obj/y/tmp/sysroots/x86_64-linux/lib" "-Wl,-rpath,/home/cody/obj/y/tmp/sysroots/x86_64-linux/usr/lib" "-Wl,-rpath,/home/cody/obj/y/tmp/sysroots/x86_64-linux/lib" "-Wl,-O1" "-Wl,-rpath=../../lib"
| note: x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib/librustc_llvm-ca1c970e.so: undefined reference to `llvm::TargetRegistry::lookupTarget(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
| x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib/librustc_llvm-ca1c970e.so: undefined reference to `llvm::RTDyldMemoryManager::getSymbolAddressInProcess(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
| x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib/librustc_llvm-ca1c970e.so: undefined reference to `llvm::sys::DynamicLibrary::getPermanentLibrary(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
| x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib/librustc_llvm-ca1c970e.so: undefined reference to `llvm::createPrintModulePass(llvm::raw_ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
| x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib/librustc_llvm-ca1c970e.so: undefined reference to `llvm::report_fatal_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
| x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib/librustc_llvm-ca1c970e.so: undefined reference to `llvm::SectionMemoryManager::finalizeMemory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
| x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib/librustc_llvm-ca1c970e.so: undefined reference to `llvm::Triple::normalize[abi:cxx11](llvm::StringRef)'
| x86_64-linux/stage0/lib/arm-poky-linux-gnueabi/rustlib/x86_64-linux/lib/librustc_llvm-ca1c970e.so: undefined reference to `llvm::RTDyldMemoryManager::getPointerToNamedFunction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
@codyps codyps changed the title build failures due to missing llvm symbols using cxx11 references rust-cross build failure due to missing llvm symbols using cxx11 references Apr 13, 2016
@codyps codyps added the bug label Apr 19, 2016
@hmvp
Copy link

hmvp commented Jul 14, 2016

I am seeing this on Ubuntu 16.04 x86_64 with up to date krogoth build for beaglebone

@cardoe
Copy link
Contributor

cardoe commented Jul 18, 2016

You probably didn't see this on Gentoo because you weren't using gcc-5 there at the time. It's starting to crop up. https://bugs.gentoo.org/show_bug.cgi?id=571600

@hmvp
Copy link

hmvp commented Jul 20, 2016

diff --git a/src/librustc_back/target/linux_base.rs b/src/librustc_back/target/linux_base.rs
index d1ab71e..13071b6 100644
--- a/src/librustc_back/target/linux_base.rs
+++ b/src/librustc_back/target/linux_base.rs
@@ -29,6 +29,9 @@ pub fn opts() -> TargetOptions {

             // Always enable NX protection when it is available
             "-Wl,-z,noexecstack".to_string(),
+
+            //Don't use new C++ ABI just like Yocto does
+            "-D_GLIBCXX_USE_CXX11_ABI=0".to_string()
         ],
         position_independent_executables: true,
         exe_allocation_crate: super::maybe_jemalloc(),

as patch seems to help
This could probably be done nicer

@codyps
Copy link
Member Author

codyps commented Aug 8, 2016

I've done this in my yocto config to avoid failures here. This disables all use of the CXX11 ABI. Probably not necessary to be this heavy handed.

BUILD_CXXFLAGS_append = " -D_GLIBCXX_USE_CXX11_ABI=0"
TARGET_CXXFLAGS_append = " -D_GLIBCXX_USE_CXX11_ABI=0"
CXXFLAGS_append = " -D_GLIBCXX_USE_CXX11_ABI=0"

BUILD_CXXFLAGS_remove_pn-gcc-runtime = "-D_GLIBCXX_USE_CXX11_ABI=0"
TARGET_CXXFLAGS_remove_pn-gcc-runtime = "-D_GLIBCXX_USE_CXX11_ABI=0"
CXXFLAGS_remove_pn-gcc-runtime = "-D_GLIBCXX_USE_CXX11_ABI=0"

Note that without the _remove bits gcc-runtime tries to build 2 non-cxx11-abi variants instead of one with cxx11-abi and one without. This duplication shows up as a link failure due to duplicate symbols.

@cardoe cardoe closed this as completed in #93 Oct 2, 2016
ashie pushed a commit to webdino/meta-rust that referenced this issue Nov 23, 2018
firefox: Fix missing references to hardcoded PYTHON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants