llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
25.94k stars 10.58k forks source link

Linking lcc fails on Cygwin #4517

Closed llvmbot closed 5 years ago

llvmbot commented 15 years ago
Bugzilla Link 4145
Resolution INVALID
Resolved on Nov 07, 2018 00:22
Version unspecified
OS Windows NT
Attachments Output from "make > dwarf_error.txt 2>&1" after a failing build
Reporter LLVM Bugzilla Contributor
CC @asl

Extended Description

Since Wednesday or Thursday last week, builds have failed on Cygwin with error messages like the following:

/usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/ld: Dwarf Error: found dwarf version '8242', this reader only handles version 2 information. /c/temp/llvm-svn/Debug/lib/LLVMXCore.o:XCoreTargetMachine.cpp:(.rdata$_ZTVN4llvm18XCoreTargetMachineE[vtable for llvm::XCoreTargetMachine]+0x4c): undefined reference to `llvm::LLVMTargetMachine::addPassesToEmitMachineCode(llvm::PassManagerBase&, llvm::MachineCodeEmitter&, llvm::CodeGenOpt::Level)'

I'm attaching the make output from building again after a failure.

I am currently running revision 70826, but have had autobuild running since around 15:00 UTC on April 30. No builds have succeeded. The last revision that I know did not have this problem was 70374. Current svn info output:

$ svn info Path: . URL: http://llvm.org/svn/llvm-project/llvm/trunk Repository Root: http://llvm.org/svn/llvm-project Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8 Revision: 70826 Node Kind: directory Schedule: normal Last Changed Author: evancheng Last Changed Rev: 70821 Last Changed Date: 2009-05-04 05:30:11 +0200 (Mon, 04 May 2009)

And config.status --version:

$ ./config.status --version llvm config.status 2.6svn configured by ./configure, generated by GNU Autoconf 2.60, with options "'--prefix=/opt/llvm-svn' 'CC=gcc-4' 'CFLAGS=-I/opt/llvm-svn/lib/libffi-3.0.8/include/' 'LDFLAGS=-L/opt/llvm-svn/lib/' 'CPPFLAGS=-I/opt/llvm-svn/lib/libffi-3.0.8/include/' 'CXX=g++-4' 'CXXFLAGS=-I/opt/llvm-svn/lib/libffi-3.0.8/include/'"

Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it.

llvmbot commented 15 years ago

Re-tested with a pristine 70826, and it worked. There must have been some junk in my working directory that didn't go away after "make clean" but still managed to ruin my builds.

llvmbot commented 15 years ago

Revision 70771 builds fine, so the problem should have been introduced later than that (but no later than 70826).

llvmbot commented 15 years ago

llvm-config file for Release build with GCC 3

asl commented 15 years ago

Could you please attach your llvm-config file then?

llvmbot commented 15 years ago

Clean build with --enable-optimize using g++

llvmbot commented 15 years ago

Clean build output with --enable-optimize using g++-4

llvmbot commented 15 years ago

It appears not to be related to debug or to the compiler version. I've build for retail (using --enable-optimized when configuring) and build with GCC 4 and GCC 3.4.4, and I get link errors in both. The warnings about the dwarf version go away though, so it seems that was a red herring.

$ svn info Path: . URL: http://llvm.org/svn/llvm-project/llvm/trunk Repository Root: http://llvm.org/svn/llvm-project Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8 Revision: 70845 Node Kind: directory Schedule: normal Last Changed Author: evancheng Last Changed Rev: 70821 Last Changed Date: 2009-05-04 05:30:11 +0200 (Mon, 04 May 2009)

GCC 4

$ ./config.status --version llvm config.status 2.6svn configured by ./configure, generated by GNU Autoconf 2.60, with options "'--prefix=/opt/llvm-svn' '--enable-optimized' 'CC=gcc-4' 'CFLAGS=-I/opt/llvm-svn/lib/libffi-3.0.8/include' 'LDFLAGS=-L/opt/llvm-svn/lib' 'CPPFLAGS=-I/opt/llvm-svn/lib/libffi-3.0.8/include' 'CXX=g++-4' 'CXXFLAGS=-I/opt/llvm-svn/lib/libffi-3.0.8/include'"

Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it.

Attaching clean build output as 78045_optimized_gcc4.txt

GCC 3

$ ./config.status --version llvm config.status 2.6svn configured by ./configure, generated by GNU Autoconf 2.60, with options "'--prefix=/opt/llvm-svn' '--enable-optimized' 'CC=gcc' 'CFLAGS=-I/opt/llvm-svn/lib/libffi-3.0.8/include' 'LDFLAGS=-L/opt/llvm-svn/lib' 'CPPFLAGS=-I/opt/llvm-svn/lib/libffi-3.0.8/include' 'CXX=g++' 'CXXFLAGS=-I/opt/llvm-svn/lib/libffi-3.0.8/include'"

Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it.

Attaching clean build output as 78045_optimized_gcc3.txt

$ gcc --version gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

asl commented 15 years ago

Building for debug on a supported platform with the currently shipping version on the complier should work, or it should be listed as a known issue in the release notes. Note that you're using beta snapshot-based compiler which can be pretty buggy (this already happened with cygwin in the past) especially for gcc secondary priority platform. I verified that mingw debug build is ok, that's why I assume that nothing is broken in LLVM codebase itself.

There were already problems with linkers for COFF targets which prevented LLVM build someday (see note in "Broken compilers and tools" section).

I added an entry here: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090504/077100.html

llvmbot commented 15 years ago

Building for debug on a supported platform with the currently shipping version on the complier should work, or it should be listed as a known issue in the release notes.

Anyway, the problem may not be the dwarf version, but undefined references. In the clean build output (see attachment 2941), the dwarf version warnings are preceeded by the following:

llvm[2]: Linking Debug executable llc Info: resolving std::cerr by linking to imp_ZSt4cerr (auto-import) Info: resolving std::basic_string<char, std::char_traits, std::allocator >::_Rep::_S_max_size by linking to imp_ZNSs4_Rep11_S_max_sizeE (auto-import) Info: resolving std::basic_string<char, std::char_traits, std::allocator >::_Rep::_S_empty_rep_storage by linking to imp___ZNSs4_Rep20_S_empty_rep_storageE (auto-import) Info: resolving std::nothrow by linking to imp_ZSt7nothrow (auto-import) Info: resolving VTT for std::basic_ifstream<char, std::char_traits > by linking to _impZTTSt14basic_ifstreamIcSt11char_traitsIcEE (auto-import) Info: resolving vtable for std::basic_ifstream<char, std::char_traits > by linking to imp_ZTVSt14basic_ifstreamIcSt11char_traitsIcEE (auto-import) Info: resolving vtable for std::basic_filebuf<char, std::char_traits > by linking to imp_ZTVSt13basic_filebufIcSt11char_traitsIcEE (auto-import) Info: resolving vtable for std::basic_streambuf<char, std::char_traits > by linking to imp_ZTVSt15basic_streambufIcSt11char_traitsIcEE (auto-import) Info: resolving vtable for std::basic_ios<char, std::char_traits > by linking to imp_ZTVSt9basic_iosIcSt11char_traitsIcEE (auto-import) Info: resolving std::basic_string<char, std::char_traits, std::allocator >::_Rep::_S_terminal by linking to imp___ZNSs4_Rep11_S_terminalE (auto-import) Info: resolving VTT for std::basic_ofstream<char, std::char_traits > by linking to imp_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE (auto-import) Info: resolving vtable for std::basic_ofstream<char, std::char_traits > by linking to _impZTVSt14basic_ofstreamIcSt11char_traitsIcEE (auto-import) Info: resolving VTT for std::basic_ostringstream<char, std::char_traits, std::allocator > by linking to imp_ZTTSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE (auto-import) Info: resolving vtable for std::basic_ostringstream<char, std::char_traits, std::allocator > by linking to imp_ZTVSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE (auto-import) Info: resolving vtable for std::basic_stringbuf<char, std::char_traits, std::allocator > by linking to imp_ZTVSt15basic_stringbufIcSt11char_traitsIcESaIcEE (auto-import) Info: resolving vtable for std::basic_stringstream<char, std::char_traits, std::allocator > by linking to imp_ZTVSt18basic_stringstreamIcSt11char_traitsIcESaIcEE (auto-import) Info: resolving VTT for std::basic_stringstream<char, std::char_traits, std::allocator > by linking to imp_ZTTSt18basic_stringstreamIcSt11char_traitsIcESaIcEE (auto-import) Info: resolving std::cout by linking to imp_ZSt4cout (auto-import) Info: resolving std::cin by linking to __imp___ZSt3cin (auto-import/usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/ld: warning: auto-importing has been activated without --enable-auto-import specified on the command line. This should work unless it involves constant data structures referencing symbols from auto-imported DLLs./c/temp/llvm-svn/tools/llc/Debug/llc.o: In function ForceCodegenLinking': /c/temp/llvm-svn/include/llvm/CodeGen/LinkAllCodegenComponents.h:46: undefined reference tollvm::createBURRListDAGScheduler(llvm::SelectionDAGISel, llvm::CodeGenOpt::Level)' /c/temp/llvm-svn/include/llvm/CodeGen/LinkAllCodegenComponents.h:47: undefined reference to `llvm::createTDRRListDAGScheduler(llvm::SelectionDAGISel, llvm::CodeGenOpt::Level)' /c/temp/llvm-svn/include/llvm/CodeGen/LinkAllCodegenComponents.h:48: undefined reference to llvm::createTDListDAGScheduler(llvm::SelectionDAGISel*, llvm::CodeGenOpt::Level)' /c/temp/llvm-svn/include/llvm/CodeGen/LinkAllCodegenComponents.h:49: undefined reference tollvm::createFastDAGScheduler(llvm::SelectionDAGISel, llvm::CodeGenOpt::Level)' /c/temp/llvm-svn/include/llvm/CodeGen/LinkAllCodegenComponents.h:50: undefined reference to `llvm::createDefaultScheduler(llvm::SelectionDAGISel, llvm::CodeGenOpt::Level)' /c/temp/llvm-svn/tools/llc/Debug/llc.o: In function main': /c/temp/llvm-svn/tools/llc/llc.cpp:258: undefined reference tollvm::cl::opt<char, false, llvm::cl::parser >::operator char() const' /c/temp/llvm-svn/tools/llc/Debug/llc.o: In function basic_parser': /c/temp/llvm-svn/include/llvm/Support/CommandLine.h:531: undefined reference tovtable for llvm::cl::basic_parser' /c/temp/llvm-svn/tools/llc/Debug/llc.o: In function parser': /c/temp/llvm-svn/include/llvm/Support/CommandLine.h:686: undefined reference tovtable for llvm::cl::parser' /c/temp/llvm-svn/tools/llc/Debug/llc.o:/c/temp/llvm-svn/include/llvm/Support/CommandLine.h:281: undefined reference to llvm::cl::opt<char, false, llvm::cl::parser<char> >::setInitialValue(char const&)' /c/temp/llvm-svn/tools/llc/Debug/llc.o: In function~basic_parser': /c/temp/llvm-svn/include/llvm/Support/CommandLine.h:531: undefined reference to vtable for llvm::cl::basic_parser<char>' /c/temp/llvm-svn/tools/llc/Debug/llc.o: In function~parser': /c/temp/llvm-svn/include/llvm/Support/CommandLine.h:686: undefined reference to vtable for llvm::cl::parser<char>' /c/temp/llvm-svn/tools/llc/Debug/llc.o: In function~opt': /c/temp/llvm-svn/include/llvm/Support/CommandLine.h:833: undefined reference to vtable for llvm::cl::opt<char, false, llvm::cl::parser<char> >' /c/temp/llvm-svn/tools/llc/Debug/llc.o: In functionopt<char [2], llvm::cl::desc, llvm::cl::FormattingFlags, llvm::cl::NumOccurrences, llvm::cl::initializer >': /c/temp/llvm-svn/include/llvm/Support/CommandLine.h:909: undefined reference to vtable for llvm::cl::opt<char, false, llvm::cl::parser<char> >' /c/temp/llvm-svn/include/llvm/Support/CommandLine.h:912: undefined reference tollvm::cl::opt<char, false, llvm::cl::parser >::done()' /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/ld: Dwarf Error: Abbrev offset (2007759) greater than or equal to .debug_abbrev size (24497). /c/temp/llvm-svn/Debug/lib/LLVMMSP430.o:MSP430AsmPrinter.cpp:(.text+0x87c): undefined reference to llvm::AsmPrinter::AsmPrinter(llvm::raw_ostream&, llvm::TargetMachine&, llvm::TargetAsmInfo const*, llvm::CodeGenOpt::Level, bool)' /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/ld: Dwarf Error: found dwarf version '30', this reader only handles version 2 information. /c/temp/llvm-svn/Debug/lib/LLVMMSP430.o:MSP430AsmPrinter.cpp:(.text+0xab5): undefined reference tollvm::DwarfWriter::RecordSourceLine(unsigned int, unsigned int, llvm::DICompileUnit)'

The GCC version I'm using is

$ g++-4 --version g++-4 (GCC) 4.3.2 20080827 (beta) 2 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and ld is

$ ld --version GNU ld (GNU Binutils) 2.18.50.20080625 Copyright 2007 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty.

llvmbot commented 15 years ago

Same as dwarf_err.txt, but after running "make clean"

asl commented 15 years ago

/usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/ld: Dwarf Error: found dwarf version '8242', this reader only handles version 2 information. /c/temp/llvm-svn/Debug/lib/LLVMXCore.o:XCoreTargetMachine.cpp:(.rdata$_ZTVN4llvm18XCoreTargetMachineE[vtable for llvm::XCoreTargetMachine]+0x4c): undefined reference to `llvm::LLVMTargetMachine::addPassesToEmitMachineCode(llvm::PassManagerBase&, llvm::MachineCodeEmitter&, llvm::CodeGenOpt::Level)' Your gcc is broken then - it generates invalid debug information. This is not an LLVM bug. Try release version instead, maybe it will work.