[Issue 15531] dmd.conf linker flags should be prepended instead of appended to subsequent linker flags

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 29 07:55:23 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=15531

Heromyth <bitworld at qq.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bitworld at qq.com

--- Comment #2 from Heromyth <bitworld at qq.com> ---

Running this command on Linux:

dmd -g -ofunittest/debug/thrift/server/transport/ssl -unittest -w -wi
-I../../lib/d/src src/thrift/server/transport/ssl.d libthriftd-event.a
libthriftd-ssl.a libthriftd.a -L-L/usr/bin/dmd -L-levent -L-lcrypto -L-lssl
unittest/emptymain.d 

Would get some error messages like:

libthriftd-ssl.a(ssl_2a8_3af.o): In function
`_D6thrift9transport3ssl10TSSLSocket6isOpenMFNdZb':
src/thrift/transport/ssl.d:(.text._D6thrift9transport3ssl10TSSLSocket6isOpenMFNdZb+0x69):
undefined reference to `SSL_get_shutdown'


The underlying command line is:

cc unittest/debug/thrift/server/transport/ssl.o -o
unittest/debug/thrift/server/transport/ssl -g -m64 **-levent -lcrypto -lssl**
-L/usr/lib/x86_64-linux-gnu -Xlinker --export-dynamic libthriftd-event.a
libthriftd-ssl.a libthriftd.a -Xlinker -Bstatic -lphobos2 -Xlinker -Bdynamic
-lpthread -lm -lrt -ldl

The correct command line should be:

cc unittest/debug/thrift/server/transport/ssl.o -o
unittest/debug/thrift/server/transport/ssl -g -m64 -L/usr/lib/x86_64-linux-gnu
-Xlinker --export-dynamic libthriftd-event.a libthriftd-ssl.a libthriftd.a
**-levent -lcrypto -lssl** -Xlinker -Bstatic -lphobos2 -Xlinker -Bdynamic
-lpthread -lm -lrt -ldl

The difference is that

   -levent -lcrypto -lssl

is behind *.a.

The order of custom linker flags seem wrong.

--


More information about the Digitalmars-d-bugs mailing list