Add --no-as-needed to avoid linker errors with new GCC versions used as the linker front end. See #199.
1 parent be1dd78 commit cdb3c00c367a86886feb8930c636aafb4293b7dc
@Sönke Ludwig Sönke Ludwig authored on 29 Dec 2013
Showing 1 changed file
View
10
source/dub/compilers/dmd.d
void invokeLinker(in BuildSettings settings, in BuildPlatform platform, string[] objects)
{
import std.string;
auto tpath = Path(settings.targetPath) ~ getTargetFileName(settings, platform);
auto args = [platform.compiler, "-of"~tpath.toNativeString()] ~ objects ~ settings.sourceFiles ~ settings.lflags.map!(l => "-L"~l)().array();
auto args = [platform.compiler, "-of"~tpath.toNativeString()];
args ~= objects;
args ~= settings.sourceFiles;
version(Posix) args ~= "-L--no-as-needed"; // avoids linker errors due to libraries being speficied in the wrong order by DMD
args ~= settings.lflags.map!(l => "-L"~l)().array;
static linkerargs = ["-g", "-gc", "-m32", "-m64", "-shared"];
args ~= settings.dflags.filter!(f => linkerargs.canFind(f))().array();
logDiagnostic("%s", args.join(" "));
auto res = spawnProcess(args).wait();