ldc-developers/ldc — Issue #70: ldc fail to build an app who use gl3n lib
Author: bioinfornatics
Created: 2012-01-23 21:52:22+00:00
State: open

get gl3n

```bash
$ hg clone https://bitbucket.org/dav1d/gl3n
$ cd gl3n
$ make PREFIX=/usr
....
$ su -c 'make PREFIX=/usr LIB_DIR=/usr/lib64 install'
...
```

create this little d file test_gl3n.d
```d
import gl3n.linalg;
import gl3n.interpolate;
import gl3n.math;
import gl3n.util;
import std.stdio;

void main() {
version(unittest) writefln("unittest!");

vec2 v = vec2(1.0f, 2.0f);
v.x = 3.0f;
v.y = 3.0f;

vec3 x = vec3(v, 1.0f);
x.y = 1.0f;

vec2[] va = [vec2(1.0f, 1.0f), vec2(2.0f, 2.0f)];

writefln("%s", va[0].vt.stringof);
writefln("%s", v);
}
```

Try to build

```bash
ldc2 -I=/usr/include/d/gl3n/ -L=/usr/lib64/libgl3n.a test_gl3n.d
0 ldc2 0x0000000000f3a3ff
1 ldc2 0x0000000000f3a9c1
2 libpthread.so.0 0x000000317a80f500
3 ldc2 0x0000000000701e7c DtoResolveFunction(FuncDeclaration*) + 476
4 ldc2 0x000000000068ea70 DtoResolveStruct(StructDeclaration*) + 352
5 ldc2 0x000000000069f235 VarExp::toElem(IRState*) + 1365
6 ldc2 0x000000000069ff21 AssignExp::toElem(IRState*) + 193
7 ldc2 0x00000000006a7cc0 CommaExp::toElem(IRState*) + 160
8 ldc2 0x00000000006fe1fc DtoDeclarationExp(Dsymbol*) + 636
9 ldc2 0x000000000069ec51 DeclarationExp::toElem(IRState*) + 65
10 ldc2 0x000000000069eb94 Expression::toElemDtor(IRState*) + 68
11 ldc2 0x00000000006bfe9a ExpStatement::toIR(IRState*) + 90
12 ldc2 0x00000000006bf7cb CompoundStatement::toIR(IRState*) + 91
13 ldc2 0x00000000006bf7cb CompoundStatement::toIR(IRState*) + 91
14 ldc2 0x00000000006bf7cb CompoundStatement::toIR(IRState*) + 91
15 ldc2 0x00000000007026c3 DtoDefineFunction(FuncDeclaration*) + 1923
16 ldc2 0x0000000000703f49 Ir::emitFunctionBodies() + 57
17 ldc2 0x00000000006d5745 Module::genLLVMModule(llvm::LLVMContext&, Ir*) + 773
18 ldc2 0x00000000005bf386 main + 6278
19 libc.so.6 0x000000317a42169d __libc_start_main + 237
20 ldc2 0x00000000005cdbdd
Segfault
```