Bug 4145 - Linking lcc fails on Cygwin
: Linking lcc fails on Cygwin
Status: CLOSED INVALID
Product: new-bugs
Classification: Unclassified
Component: new bugs
: unspecified
: PC Windows NT
: P normal
Assigned To: Unassigned LLVM Bugs
:
:
:
:
  Show dependency treegraph
 
Reported: 2009-05-04 02:52 CDT by Magnus Reftel
Modified: 2010-11-30 05:55 CST (History)
2 users (show)

See Also:


Attachments
Output from "make > dwarf_error.txt 2>&1" after a failing build (53.19 KB, text/plain)
2009-05-04 02:52 CDT, Magnus Reftel
Details
Same as dwarf_err.txt, but after running "make clean" (97.18 KB, text/plain)
2009-05-04 04:35 CDT, Magnus Reftel
Details
Clean build output with --enable-optimize using g++-4 (83.02 KB, text/plain)
2009-05-04 08:04 CDT, Magnus Reftel
Details
Clean build with --enable-optimize using g++ (131.87 KB, text/plain)
2009-05-04 08:04 CDT, Magnus Reftel
Details
llvm-config file for Release build with GCC 3 (20.91 KB, application/octet-stream)
2009-05-04 08:25 CDT, Magnus Reftel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Reftel 2009-05-04 02:52:28 CDT
Created attachment 2940 [details]
Output from "make > dwarf_error.txt 2>&1" after a failing build

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.
Comment 1 Anton Korobeynikov 2009-05-04 03:12:28 CDT
(In reply to comment #0)
> /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.
Comment 2 Magnus Reftel 2009-05-04 04:35:47 CDT
Created attachment 2941 [details]
Same as dwarf_err.txt, but after running "make clean"
Comment 3 Magnus Reftel 2009-05-04 04:39:26 CDT
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 [details]), 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<char>,
std::allocator<char> >::_Rep::_S_max_size by linking to
__imp___ZNSs4_Rep11_S_max_sizeE (auto-import)
Info: resolving std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_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<char> > by
linking to __imp___ZTTSt14basic_ifstreamIcSt11char_traitsIcEE (auto-import)
Info: resolving vtable for std::basic_ifstream<char, std::char_traits<char> >
by linking to __imp___ZTVSt14basic_ifstreamIcSt11char_traitsIcEE (auto-import)
Info: resolving vtable for std::basic_filebuf<char, std::char_traits<char> > by
linking to __imp___ZTVSt13basic_filebufIcSt11char_traitsIcEE (auto-import)
Info: resolving vtable for std::basic_streambuf<char, std::char_traits<char> >
by linking to __imp___ZTVSt15basic_streambufIcSt11char_traitsIcEE (auto-import)
Info: resolving vtable for std::basic_ios<char, std::char_traits<char> > by
linking to __imp___ZTVSt9basic_iosIcSt11char_traitsIcEE (auto-import)
Info: resolving std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_Rep::_S_terminal by linking to
__imp___ZNSs4_Rep11_S_terminalE (auto-import)
Info: resolving VTT for std::basic_ofstream<char, std::char_traits<char> > by
linking to __imp___ZTTSt14basic_ofstreamIcSt11char_traitsIcEE (auto-import)
Info: resolving vtable for std::basic_ofstream<char, std::char_traits<char> >
by linking to __imp___ZTVSt14basic_ofstreamIcSt11char_traitsIcEE (auto-import)
Info: resolving VTT for std::basic_ostringstream<char, std::char_traits<char>,
std::allocator<char> > by linking to
__imp___ZTTSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE (auto-import)
Info: resolving vtable for std::basic_ostringstream<char,
std::char_traits<char>, std::allocator<char> > by linking to
__imp___ZTVSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE (auto-import)
Info: resolving vtable for std::basic_stringbuf<char, std::char_traits<char>,
std::allocator<char> > by linking to
__imp___ZTVSt15basic_stringbufIcSt11char_traitsIcESaIcEE (auto-import)
Info: resolving vtable for std::basic_stringstream<char,
std::char_traits<char>, std::allocator<char> > by linking to
__imp___ZTVSt18basic_stringstreamIcSt11char_traitsIcESaIcEE (auto-import)
Info: resolving VTT for std::basic_stringstream<char, std::char_traits<char>,
std::allocator<char> > 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 to `llvm::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 to `llvm::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 to
`llvm::cl::opt<char, false, llvm::cl::parser<char> >::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 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:/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 function `opt<char [2],
llvm::cl::desc, llvm::cl::FormattingFlags, llvm::cl::NumOccurrences,
llvm::cl::initializer<char> >':
/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 to
`llvm::cl::opt<char, false, llvm::cl::parser<char> >::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 to `llvm::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.
Comment 4 Anton Korobeynikov 2009-05-04 05:31:32 CDT
(In reply to comment #3)
> 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
Comment 5 Magnus Reftel 2009-05-04 08:03:30 CDT
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.
Comment 6 Magnus Reftel 2009-05-04 08:04:24 CDT
Created attachment 2946 [details]
Clean build output with --enable-optimize using g++-4
Comment 7 Magnus Reftel 2009-05-04 08:04:49 CDT
Created attachment 2947 [details]
Clean build with --enable-optimize using g++
Comment 8 Anton Korobeynikov 2009-05-04 08:18:03 CDT
Could you please attach your llvm-config file then?
Comment 9 Magnus Reftel 2009-05-04 08:25:45 CDT
Created attachment 2948 [details]
llvm-config file for Release build with GCC 3
Comment 10 Magnus Reftel 2009-05-06 08:30:09 CDT
Revision 70771 builds fine, so the problem should have been introduced later
than that (but no later than 70826).
Comment 11 Magnus Reftel 2009-05-07 03:12:31 CDT
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.