[Issue 19243] New: [REG 2.081] Can no longer override pragma(lib) with -L switch
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Sep 13 07:04:23 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19243
Issue ID: 19243
Summary: [REG 2.081] Can no longer override pragma(lib) with -L
switch
Product: D
Version: D2
Hardware: All
OS: Linux
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dlang-bugzilla at thecybershadow.net
Consider a program written against the OpenSSL 1.0 API, e.g.:
////////////////////////////////// test.d //////////////////////////////////
pragma(lib, "ssl");
pragma(lib, "crypto");
extern (C)
{
struct SSL_METHOD;
struct SSL_CTX;
void SSL_load_error_strings();
void SSL_library_init();
void OPENSSL_add_all_algorithms_noconf();
alias OpenSSL_add_all_algorithms = OPENSSL_add_all_algorithms_noconf;
SSL_METHOD* SSLv23_client_method();
SSL_CTX* SSL_CTX_new(in SSL_METHOD*);
}
shared static this()
{
SSL_load_error_strings();
SSL_library_init();
OpenSSL_add_all_algorithms();
}
T sslEnforce(T)(T v, string message)
{
if (v) return v;
throw new Exception(message);
}
unittest
{
auto method = SSLv23_client_method().sslEnforce("SSLv23_client_method");
SSL_CTX_new(method)
.sslEnforce("SSL_CTX_new");
}
////////////////////////////////////////////////////////////////////////////
pragma(lib) allows it to be linked to the necessary libraries automatically,
without having to specify them on the compiler/linker command line.
However, on some systems, the default libraries (i.e. e.g. /usr/lib/libssl.so)
might be the wrong version. We can override them with -L switches, i.e.:
$ dmd -main -unittest -g -L/usr/lib/libssl.so.1.0.0
-L/usr/lib/libcrypto.so.1.0.0 -run test.d
This no longer works in 2.081. The change introduced by the PR linked below
changes how linker arguments on the compiler's command line are processed,
breaking existing build scripts.
The example above can be reproduced on Arch Linux with the openssl-1.0 package
installed. The dmd command above succeeds with DMD 2.080 but fails with 2.081.
Introduced in https://github.com/dlang/dmd/pull/8172
--
More information about the Digitalmars-d-bugs
mailing list