Hello, I am working on SDC and wanted to use dub to build it. So far it went smoothly, but when I want to link the final executable it get a linker-error because I need to link in the llvm-libs. These libs are determent by runnig llvm-config --libs
. How can I use dub to link them ?
Am 30.07.2014 21:05, schrieb Stefan Koch:
Hello, I am working on SDC and wanted to use dub to build it. So far it went smoothly, but when I want to link the final executable it get a linker-error because I need to link in the llvm-libs. These libs are determent by runnig
llvm-config --libs
. How can I use dub to link them ?
Right now I think the only solution would be to manually add the output
of llvm-config to the "libs" field of dub.json. It could almost work
with "preBuildCommands" and an environment variable, but there is
currently no way to break up an environment variable into individual
pieces. But generally shouldn't SDC automatically pass those libs to the
linker if they are required for linking?
On Wed, 30 Jul 2014 22:38:40 +0200, Sönke Ludwig wrote:
But generally shouldn't SDC automatically pass those libs to the
linker if they are required for linking?
they are required to link SDC itself not for the binarys it produces.
This preBuildCommand and than modifieng the dub.json is abit clumsy ...
I think I will extend dub to be able to add stuff form external sources to the flags.
I now have another problem
dmd does not link my dependencies.
the dub json looks like this
{
"name": "sdc",
"description": "SDC's driver",
"copyright": "Copyright © 2014, deadlnix",
"authors": ["deadlnix"],
"mainSourceFile" : "sdc/main.d",
"libs" : ["d","d-llvm"],
"importPaths" : ["libd-llvm/src","libd-llvm/libd/src","libd-llvm/import"],
"dependencies": {
"libd-llvm":{"version":"~master","path":"libd-llvm"}
},
"lflags" : ["-Llib"]
}
I had to add the dependency-libraries as libs and compile them through my old make system because otherwise the LLVM-libs (I added them manually to libs just as you suggested) are not available to libd-llvm.
libd-llvms dub.json looks like this:
{
"name": "libd-llvm",
"targetType": "library",
"description": "SDC's llvm binding'",
"copyright": "Copyright © 2014, deadlnix",
"authors": ["deadlnix"],
"importPaths" : ["import"],
"libs" : [ "LLVMTableGen","LLVMArchive","LLVMInstrumentation","LLVMLinker","LLVMIRReader","LLVMBitReader","LLVMAsmParser","LLVMipo","LLVMVectorize", "LLVMDebugInfo","LLVMOption","LLVMX86Disassembler","LLVMX86AsmParser","LLVMX86CodeGen","LLVMSelectionDAG","LLVMAsmPrinter","LLVMX86Desc","LLVMX86Info","LLVMX86AsmPrinter", "LLVMX86Utils","LLVMMCDisassembler","LLVMMCParser","LLVMInterpreter","LLVMBitWriter","LLVMMCJIT","LLVMJIT","LLVMCodeGen","LLVMObjCARCOpts","LLVMScalarOpts","LLVMInstCombine", "LLVMTransformUtils","LLVMipa","LLVMAnalysis","LLVMRuntimeDyld","LLVMExecutionEngine","LLVMTarget","LLVMMC","LLVMObject","LLVMCore","LLVMSupport","z","pthread","stdc++","dl"
],
"dependencies": {
"libd": {"version":"~master","path":"libd"}
}
}
perhaps it would be easiest if you tried it yourself.
it it all in my sdc32 repo
SLOVED.
I changed the targetType of the deos to sourceLibrary and it works like a charm
it builds incredibly fast that way
On Sat, 02 Aug 2014 10:47:06 GMT, Stefan Koch wrote:
SLOVED.
I changed the targetType of the deos to sourceLibrary and it works like a charm
it builds incredibly fast that way
Good to see that it works like this. I'll try to remember reproducing the original issue, though, because it's supposed to work with "staticLibrary"
(or "library"
), too.