undefined reference to symbol '_end'
mimocrocodil
4denizzz at gmail.com
Fri Aug 12 13:23:50 PDT 2011
I am trying to link my program with libpq:
$ dmd main.d dbwork.d -ofmain -v -L-lpq
[skipped good output]
import std.c.linux.socket (/usr/include/d/dmd/phobos/std/c/linux/socket.d)
import core.sys.posix.netdb (/usr/include/d/dmd/druntime/import/core/sys/posix/netdb.di)
import core.sys.posix.netinet.in_ (/usr/include/d/dmd/druntime/import/core/sys/posix/netinet/in_.di)
import core.sys.posix.netinet.tcp (/usr/include/d/dmd/druntime/import/core/sys/posix/netinet/tcp.di)
import dpq2.libpq (dpq2/libpq.di)
importall dbwork
semantic main
semantic dbwork
semantic2 main
semantic2 dbwork
semantic3 main
semantic3 dbwork
code main
function main
function enforce
code dbwork
function do_request
function writeln
function __dgliteral1233
gcc main.o -o main -m64 -lpq -Xlinker -L/usr/lib64 -Xlinker -L/usr/lib32 -Xlinker --no-warn-search-mismatch -Xlinker --export-dynamic -lrt -lphobos2 -
lpthread -lm
/usr/bin/ld: /usr/lib64/libphobos2.a(memory_350_620.o): undefined reference to symbol '_end'
/usr/bin/ld: note: '_end' is defined in DSO /lib64/libcom_err.so.2 so try adding it to the linker command line
/lib64/libcom_err.so.2: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
--- errorlevel 1
If I am disable linking with libpq (just remove -L-lpq from command line) compiling works fine. What's happening?
Also:
$ nm /usr/lib/libphobos2.a | grep _end
0000000000000000 T _D4core4stdc6stdarg6va_endFPvZv
U _deh_end
U _end
U __libc_stack_end
U _end
U _D4core4stdc6stdarg6va_endFPvZv
"U" means "The symbol is undefined".
More information about the Digitalmars-d-learn
mailing list