Compiling to shared library with static dependencies

Tanel L via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 12:46:15 PST 2016


Hi, thanks for the answer.

I had tried disabling all imports, but now I created a clean new 
project to test this - it worked.

After that I moved the compiling and linking over to DUB, with 
dependencies:

dependency "dcv" version="0.1.7"
dependency "mir" version="0.22.0"
targetPath "output"
targetType "dynamicLibrary"
dflags "-defaultlib=phobos2"

The library source:
import std.stdio;
import dcv;
import core.runtime:Runtime;
extern (C) int doit(int a, int b) {
	return a*b + dcv.imread("1.jpg").width.to!int;
}

This created an .so with huge amount of all kinds of external so 
deps, but it still failed with the same error:
OSError: libdynlibtest.so: undefined symbol: _d_eh_personality

Otherwise:
Linux Mint 18 (basically Ubuntu 16.04)
LDC - the LLVM D compiler (1.1.0-beta6):
   based on DMD v2.071.2 and LLVM 3.9.0
   built with LDC - the LLVM D compiler (1.0.0)
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
DUB version 1.1.1, built on Nov 30 2016

Thank you for helping! :)



More information about the Digitalmars-d mailing list