DUB fails to build a dynamic library on Linux

Gabor Mezo via Digitalmars-d digitalmars-d at puremagic.com
Sun Dec 14 06:50:08 PST 2014


Hello,

I've created a simple db dynamic lib project.

dub.json:

{
	"name": "node-d-sample",
	"description": "A minimal D application.",
	"copyright": "Copyright © 2014, gabor",
	"authors": ["gabor"],
	"dependencies": {
	},
	"libs": [ "phobos2" ],
	"targetName": "node-d-sample",
	"targetPath": "lib",
	"targetType": "dynamicLibrary"
}

I have only one source, lib.d:

extern (C)
{
	int ping()
	{
		return 555;
	}
}

My system is a Mint x64, dub latest, dmd latest.

If I invoke "dub", then:

Building node-d-sample ~master configuration "library", build 
type debug.
Compiling using dmd...
Linking...
/usr/bin/ld: 
.dub/build/library-debug-linux.posix-x86_64-dmd_2066-44F775BF77E519551012EFF79429BBA3/node-d-sample.o: 
relocation R_X86_64_32 against `.rodata' can not be used when 
making a shared object; recompile with -fPIC
.dub/build/library-debug-linux.posix-x86_64-dmd_2066-44F775BF77E519551012EFF79429BBA3/node-d-sample.o: 
error adding symbols: Bad value
collect2: error: ld returned 1 exit status
--- errorlevel 1
FAIL 
.dub/build/library-debug-linux.posix-x86_64-dmd_2066-44F775BF77E519551012EFF79429BBA3/ 
node-d-sample dynamicLibrary
Error executing command run: dmd failed with exit code 1.


More information about the Digitalmars-d mailing list