Anyone used LLVM-D with Dub?

Alan alanpotteiger at gmail.com
Wed Oct 2 17:37:37 PDT 2013


On Wednesday, 2 October 2013 at 18:43:06 UTC, Moritz Maxeiner 
wrote:
> On Wednesday, 2 October 2013 at 02:22:42 UTC, Alan wrote:
>> Hello! I'm working on a project and I was going to use LLVM 
>> with the LLVM-D wrapper which has it's own Dub package and 
>> everything https://github.com/Calrama/llvm-d
>> I've installed the package with Dub, added it to my 
>> packages/builds dependencies.
>> When I build however I get an error:
>> Linking...
>> /usr/bin/ld: error: /home/apott/projects/Hyphen/temp.o: 
>> multiple definition of 
>> '_D4llvm1d2ir10basicblock10BasicBlock16removeFromParentMFZv'
>> /usr/bin/ld: /home/apott/projects/Hyphen/temp.o: previous 
>> definition here
>> /home/apott/projects/Hyphen/temp.o:../../.dub/packages/llvm-d-master/llvm/d/ir/globalvariable.d:function 
>> _D4llvm1d2ir8constant8Constant6__vtblZ: error: undefined 
>> reference to 
>> '_D4llvm1d2ir8constant8Constant27replaceUsesOfWithOnConstantMFC4llvm1d2ir5value5ValueC4llvm1d2ir5value5ValueC4llvm1d2ir3use3UseZv'
>> /home/apott/projects/Hyphen/temp.o:../../.dub/packages/llvm-d-master/llvm/d/ir/globalvariable.d:function 
>> _D4llvm1d2ir11globalvalue11GlobalValue6__vtblZ: error: 
>> undefined reference to 
>> '_D4llvm1d2ir8constant8Constant27replaceUsesOfWithOnConstantMFC4llvm1d2ir5value5ValueC4llvm1d2ir5value5ValueC4llvm1d2ir3use3UseZv'
>> /home/apott/projects/Hyphen/temp.o:../../.dub/packages/llvm-d-master/llvm/d/ir/globalvariable.d:function 
>> _D4llvm1d2ir12llvmfunction8Function6__vtblZ: error: undefined 
>> reference to 
>> '_D4llvm1d2ir8constant8Constant27replaceUsesOfWithOnConstantMFC4llvm1d2ir5value5ValueC4llvm1d2ir5value5ValueC4llvm1d2ir3use3UseZv'
>> /home/apott/projects/Hyphen/temp.o:../../.dub/packages/llvm-d-master/llvm/d/ir/globalvariable.d:function 
>> _D4llvm1d2ir9constants10UndefValue6__vtblZ: error: undefined 
>> reference to 
>> '_D4llvm1d2ir8constant8Constant27replaceUsesOfWithOnConstantMFC4llvm1d2ir5value5ValueC4llvm1d2ir5value5ValueC4llvm1d2ir3use3UseZv'
>> collect2: error: ld returned 1 exit status
>> --- errorlevel 1
>> Error: Link command failed with exit code 1
>>
>> I want to know if anyone here has any experience witht his by 
>> any chance? The source of the problem? Is it a bug? Thanks for 
>> any suggestions.
>
> I don't have any experience with using dub's dependency 
> settings for projects, but regarding llvm-d itself:
>
> 1) The D API itself is not ready for active use (that's what 
> the C binding are currently in place for), but it does compile 
> and link properly in my tests, which include:
>   - Building with the provided VisualStudio solution file into 
> a static libary on Windows.
>   - Changing (locally) the "sourceLibrary" setting to 
> "staticLibrary" in package.json and running "dub build", which 
> provides a working static library for me with the current 
> master.
>
> For some reason, however, building ("dub build") with 
> "sourceLibrary" leads to an assertion error I could not track 
> down, as I was not able to make more sense out of the output 
> produced by "dub build --vverbose" than that an exception had 
> occured.
>
> 2) I can build and run all of llvm-d's samples the following 
> way:
>
> 1. Clone the repo
> 2. cd into the local clone
> 3. Run the samples with rdmd, e.g. "rdmd samples/fibonacci.d".
>
>
> Could you give me a minimal example I can use to reproduce the 
> error you've encountered? Also, you can always open an issue at 
> llvm-d's github repo, that's the easiest way to report problems 
> about llvm-d (other than mailing me).
>
>
> On Wednesday, 2 October 2013 at 10:04:19 UTC, 1100110 wrote:
>>
>> It's been broken for a while for me.
>>
>> I tried to figure out what the issue was, but it was over my 
>> head...
>
> What exactly has been broken for you? As stated above, I can 
> run all the examples fine, but if that is not the case for 
> someone else, I need to know about it in order to try and fix 
> it.
>
> On Wednesday, 2 October 2013 at 10:23:55 UTC, Dicebot wrote:
>>
>> I think in this case reporting to `llvm-d` author makes more 
>> sense.
>>
>> AFAIK "calrama" is common nickname for Moritz Maxeiner, I will 
>> send him an e-mail linking this thread.
>
> Thanks for mailing me, I would not have seen this thread here 
> otherwise (I usually look at the first pages of "digitalmars.D" 
> and "digitalmars.D.announce" every couple of days).

I just put the package in the dependencies and import it in my 
code then it does that, haven't even used any functions yet. 
(When building of course)


More information about the Digitalmars-d mailing list