[Bug 1563861] [NEW] gdc: Fails to link any code using std.net.curl
Matthias Klumpp
matthias at tenstral.net
Wed Mar 30 13:28:24 UTC 2016
Public bug reported:
Hi!
The GDC D compiler in Ubuntu is currently unable to link anything using
std.net.curl, likely due to an ordering issue in the linker command-
line, since Ubuntus libcurl is compiled with --as-needed
To reproduce, take the following simple program:
test.d
```
import std.stdio;
import std.net.curl;
void main(string[] args)
{
auto data = get ("ubuntu.com");
writeln (data);
}
```
And compile with `gdc -lcurl -otest test.d`
Linking will file with lots of messages like
```
/usr/lib/gcc/x86_64-linux-gnu/5/libgphobos2.a(curl.o): In function `_D3std3net4curl4Curl18_sharedStaticCtor2FZv':
/build/gcc-5-hPAq_C/gcc-5-5.3.1/build/x86_64-linux-gnu/libphobos/src/../../../../src/libphobos/src/std/net/curl.d:3498: undefined reference to `curl_global_init'
```
A possible solution to this problem would be to link all D programs against libcurl, as has apparently been done in LDC: https://github.com/ldc-developers/ldc/pull/977
Maybe having GDC fix up the linker command line would also work.
Backporting the (massive) patch for Phobos for dynamically loading
libcurl would also be an option, but I guess it wouldn't be an easy
solution.
This being broken in Ubuntu means that Ubuntu can't compile several
important tools, like the dub D package manager, which compiles fine in
Debian ( https://packages.debian.org/source/stretch/dub ).
Since std.net is a part of the standard library, and it's kind of
expected from a standard library to function, I've set the priority of
this bug to "High".
Thanks in advance for the help! I am also thinking about reporting this
bug upstream, but since compiling in other distros (e.g. Debian) works,
I don't know how quickly one could expect people there to take care of
this issue.
** Affects: gcc-5 (Ubuntu)
Importance: High
Status: New
** Package changed: gcc-defaults (Ubuntu) => gcc-5 (Ubuntu)
** Summary changed:
- Fails to link any code using std.net.curl
+ gdc: Fails to link any code using std.net.curl
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/1563861
Title:
gdc: Fails to link any code using std.net.curl
Status in gcc-5 package in Ubuntu:
New
Bug description:
Hi!
The GDC D compiler in Ubuntu is currently unable to link anything
using std.net.curl, likely due to an ordering issue in the linker
command-line, since Ubuntus libcurl is compiled with --as-needed
To reproduce, take the following simple program:
test.d
```
import std.stdio;
import std.net.curl;
void main(string[] args)
{
auto data = get ("ubuntu.com");
writeln (data);
}
```
And compile with `gdc -lcurl -otest test.d`
Linking will file with lots of messages like
```
/usr/lib/gcc/x86_64-linux-gnu/5/libgphobos2.a(curl.o): In function `_D3std3net4curl4Curl18_sharedStaticCtor2FZv':
/build/gcc-5-hPAq_C/gcc-5-5.3.1/build/x86_64-linux-gnu/libphobos/src/../../../../src/libphobos/src/std/net/curl.d:3498: undefined reference to `curl_global_init'
```
A possible solution to this problem would be to link all D programs against libcurl, as has apparently been done in LDC: https://github.com/ldc-developers/ldc/pull/977
Maybe having GDC fix up the linker command line would also work.
Backporting the (massive) patch for Phobos for dynamically loading
libcurl would also be an option, but I guess it wouldn't be an easy
solution.
This being broken in Ubuntu means that Ubuntu can't compile several
important tools, like the dub D package manager, which compiles fine
in Debian ( https://packages.debian.org/source/stretch/dub ).
Since std.net is a part of the standard library, and it's kind of
expected from a standard library to function, I've set the priority of
this bug to "High".
Thanks in advance for the help! I am also thinking about reporting
this bug upstream, but since compiling in other distros (e.g. Debian)
works, I don't know how quickly one could expect people there to take
care of this issue.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1563861/+subscriptions
More information about the foundations-bugs
mailing list