www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Linker Error Building DMD

reply dsimcha <dsimcha yahoo.com> writes:
I have to get DMD 2.054 running on an ancient Linux distro, which means
compiling it myself to get around various GLIBC issues.  Everything compiles
fine, but when the makefile tries to link, I get the following linker error
message.  I don't even know where to start trying to troubleshoot this.
Strangely, though, it happens even when I try to build 2.054 on newer distros
and similarly nasty linker errors when I try to compile in 32-bit mode.

gcc -m64 -lstdc++ -lpthread  access.o array.o attrib.o bcomplex.o bit.o
blockopt.o cast.o code.o cg.o cg87.o cgcod.o cgcs.o cgelem.o cgen.o cgreg.o
cgsched.o class.o cod1.o cod2.o cod3.o cod4.o cod5.o constfold.o irstate.o
dchar.o cond.o debug.o declaration.o dsymbol.o dt.o dump.o e2ir.o ee.o eh.o
el.o dwarf.o enum.o evalu8.o expression.o func.o gdag.o gflow.o glocal.o
gloop.o glue.o gnuc.o go.o gother.o html.o iasm.o id.o identifier.o
impcnvtab.o import.o inifile.o init.o inline.o lexer.o link.o lstring.o
mangle.o mars.o rmem.o module.o msc.o mtype.o nteh.o cppmangle.o opover.o
optimize.o os.o out.o outbuf.o parse.o ph.o ptrntab.o root.o rtlsym.o s2ir.o
scope.o statement.o stringtable.o struct.o csymbol.o template.o tk.o tocsym.o
todt.o type.o typinf.o util.o var.o version.o strtold.o utf.o staticassert.o
unialpha.o toobj.o toctype.o toelfdebug.o entity.o doc.o macro.o hdrgen.o
delegatize.o aa.o ti_achar.o toir.o interpret.o traits.o builtin.o clone.o
aliasthis.o man.o arrayop.o port.o response.o async.o json.o speller.o aav.o
unittests.o imphint.o argtypes.o ti_pvoid.o libelf.o elfobj.o -o dmd
cast.o: In function `CastExp::getIntRange()':
cast.c:(.text+0x541): undefined reference to `IntRange::cast(Type*)'
cast.o: In function `IntegerExp::getIntRange()':
cast.c:(.text+0x59a): undefined reference to `IntRange::cast(Type*)'
cast.o: In function `MulExp::getIntRange()':
cast.c:(.text+0x61b): undefined reference to
`SignExtendedNumber::operator*(SignExtendedNumber const&) const'
cast.c:(.text+0x633): undefined reference to
`SignExtendedNumber::operator*(SignExtendedNumber const&) const'
cast.c:(.text+0x650): undefined reference to
`SignExtendedNumber::operator*(SignExtendedNumber const&) const'
cast.c:(.text+0x665): undefined reference to
`SignExtendedNumber::operator*(SignExtendedNumber const&) const'
cast.c:(.text+0x67e): undefined reference to
`IntRange::fromNumbers4(SignExtendedNumber const*)'
cast.c:(.text+0x689): undefined reference to `IntRange::cast(Type*)'
cast.o: In function `AddExp::getIntRange()':
cast.c:(.text+0x729): undefined reference to
`SignExtendedNumber::operator+(SignExtendedNumber const&) const'
cast.c:(.text+0x74b): undefined reference to
`SignExtendedNumber::operator+(SignExtendedNumber const&) const'
cast.c:(.text+0x791): undefined reference to `IntRange::cast(Type*)'
cast.o: In function `Expression::getIntRange()':
cast.c:(.text+0x7d9): undefined reference to `IntRange::fromType(Type*)'
cast.o: In function `ModExp::getIntRange()':
cast.c:(.text+0x851): undefined reference to `IntRange::absNeg() const'
cast.c:(.text+0x8a6): undefined reference to `SignExtendedNumber::operator++()'
cast.c:(.text+0x8ae): undefined reference to `SignExtendedNumber::operator-()
const'
cast.c:(.text+0x900): undefined reference to `IntRange::cast(Type*)'
cast.c:(.text+0x927): undefined reference to
`SignExtendedNumber::operator<(SignExtendedNumber const&) const'
cast.c:(.text+0x954): undefined reference to
`SignExtendedNumber::operator<(SignExtendedNumber const&) const'
cast.o: In function `DivExp::getIntRange()':
cast.c:(.text+0x9c4): undefined reference to `IntRange::containsZero() const'
cast.c:(.text+0xa1b): undefined reference to
`SignExtendedNumber::operator/(SignExtendedNumber const&) const'
cast.c:(.text+0xa33): undefined reference to
`SignExtendedNumber::operator/(SignExtendedNumber const&) const'
cast.c:(.text+0xa48): undefined reference to
`SignExtendedNumber::operator/(SignExtendedNumber const&) const'
cast.c:(.text+0xa65): undefined reference to
`SignExtendedNumber::operator/(SignExtendedNumber const&) const'
cast.c:(.text+0xa7e): undefined reference to
`IntRange::fromNumbers4(SignExtendedNumber const*)'
cast.c:(.text+0xa89): undefined reference to `IntRange::cast(Type*)'
cast.o: In function `Expression::implicitConvTo(Type*)':
cast.c:(.text+0x3909): undefined reference to `IntRange::fromType(Type*, bool)'
cast.c:(.text+0x3916): undefined reference to `IntRange::fromType(Type*, bool)'
cast.c:(.text+0x3921): undefined reference to `IntRange::contains(IntRange
const&) const'
cast.c:(.text+0x3934): undefined reference to `IntRange::contains(IntRange
const&) const'
cast.o: In function `XorExp::getIntRange()':
cast.c:(.text+0x44bb): undefined reference to
`IntRange::splitBySign(IntRange&, bool&, IntRange&, bool&) const'
cast.c:(.text+0x44d9): undefined reference to
`IntRange::splitBySign(IntRange&, bool&, IntRange&, bool&) const'
cast.c:(.text+0x454e): undefined reference to `IntRange::cast(Type*)'
cast.c:(.text+0x45c8): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.c:(.text+0x460c): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.c:(.text+0x464a): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.c:(.text+0x467f): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.o: In function `OrExp::getIntRange()':
cast.c:(.text+0x473b): undefined reference to
`IntRange::splitBySign(IntRange&, bool&, IntRange&, bool&) const'
cast.c:(.text+0x4759): undefined reference to
`IntRange::splitBySign(IntRange&, bool&, IntRange&, bool&) const'
cast.c:(.text+0x47ce): undefined reference to `IntRange::cast(Type*)'
cast.c:(.text+0x4848): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.c:(.text+0x488c): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.c:(.text+0x48ca): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.c:(.text+0x48ff): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.o: In function `AndExp::getIntRange()':
cast.c:(.text+0x49bb): undefined reference to
`IntRange::splitBySign(IntRange&, bool&, IntRange&, bool&) const'
cast.c:(.text+0x49d9): undefined reference to
`IntRange::splitBySign(IntRange&, bool&, IntRange&, bool&) const'
cast.c:(.text+0x4a4e): undefined reference to `IntRange::cast(Type*)'
cast.c:(.text+0x4ac8): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.c:(.text+0x4b0c): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.c:(.text+0x4b4a): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.c:(.text+0x4b7f): undefined reference to
`IntRange::unionOrAssign(IntRange const&, bool&)'
cast.o: In function `NegExp::getIntRange()':
cast.c:(.text+0x4bdb): undefined reference to `SignExtendedNumber::operator-()
const'
cast.c:(.text+0x4bfb): undefined reference to `SignExtendedNumber::operator-()
const'
cast.c:(.text+0x4c3b): undefined reference to `IntRange::cast(Type*)'
cast.o: In function `MinExp::getIntRange()':
cast.c:(.text+0x4cb8): undefined reference to
`SignExtendedNumber::operator-(SignExtendedNumber const&) const'
cast.c:(.text+0x4cdb): undefined reference to
`SignExtendedNumber::operator-(SignExtendedNumber const&) const'
cast.c:(.text+0x4d21): undefined reference to `IntRange::cast(Type*)'
cast.o: In function `UshrExp::getIntRange()':
cast.c:(.text+0x4dab): undefined reference to `IntRange::castUnsigned(Type*)'
cast.c:(.text+0x4e16): undefined reference to
`SignExtendedNumber::operator>>(SignExtendedNumber const&) const'
cast.c:(.text+0x4e3f): undefined reference to
`SignExtendedNumber::operator>>(SignExtendedNumber const&) const'
cast.c:(.text+0x4e91): undefined reference to `IntRange::cast(Type*)'
cast.o: In function `ShrExp::getIntRange()':
cast.c:(.text+0x4f68): undefined reference to
`SignExtendedNumber::operator>>(SignExtendedNumber const&) const'
cast.c:(.text+0x4f9a): undefined reference to
`SignExtendedNumber::operator>>(SignExtendedNumber const&) const'
cast.c:(.text+0x4fe2): undefined reference to `IntRange::cast(Type*)'
cast.o: In function `ShlExp::getIntRange()':
cast.c:(.text+0x50b8): undefined reference to
`SignExtendedNumber::operator<<(SignExtendedNumber const&) const'
cast.c:(.text+0x50ea): undefined reference to
`SignExtendedNumber::operator<<(SignExtendedNumber const&) const'
cast.c:(.text+0x5132): undefined reference to `IntRange::cast(Type*)'
cast.o: In function `ComExp::getIntRange()':
cast.c:(.text+0x51db): undefined reference to `IntRange::cast(Type*)'
collect2: ld returned 1 exit status
Aug 04 2011
parent reply David Nadlinger <see klickverbot.at> writes:
On 8/4/11 5:31 PM, dsimcha wrote:
 I have to get DMD 2.054 running on an ancient Linux distro, which means
 compiling it myself to get around various GLIBC issues.  Everything compiles
 fine, but when the makefile tries to link, I get the following linker error
 message. […]

Are you using an up-to-date Makefile (the posix.mak is used on all Posix-like systems now)? It seems like intrange.c resp. intrange.o is missing entirely from your build. David
Aug 04 2011
parent dsimcha <dsimcha yahoo.com> writes:
== Quote from David Nadlinger (see klickverbot.at)'s article
 On 8/4/11 5:31 PM, dsimcha wrote:
 I have to get DMD 2.054 running on an ancient Linux distro, which means
 compiling it myself to get around various GLIBC issues.  Everything compiles
 fine, but when the makefile tries to link, I get the following linker error
 message. […]

Posix-like systems now)? It seems like intrange.c resp. intrange.o is missing entirely from your build. David

(Slaps self in forehead.) Thanks. I was using a crufty old linux.mak file that was for some reason still in my DMD src directory. Using the proper posix.max file, everything works.
Aug 04 2011