www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Using systemDependencies in DUB

reply Dechcaudron <no-reply no-email.com> writes:
Hi,

I'm trying to use dub to compile a quick experiment that uses 
Deimos libclang bindings, which of course requires linking 
against an installed libclang. I believe this is what I need to 
include in dub.json:

  "systemDependencies": "libclang-6.0"

But it just won't link against the lib in the compilation 
process. Using the -v option reveals the linking stage call:

/usr/bin/dmd 
-of.dub/build/application-debug-linux.posix-x86_64-dmd_2081-7C29937BC9011750CF
15D7325224156/damnc .dub/build/application-debug-linux.posix-x86_64-dmd_2081-7C29937BC9011750CFA1
D7325224156/damnc.o -L--no-as-needed -g

It does not mention libclang at all. I've tried with all "clang", 
"libclang-6.0.so.1", but I just don't seem to be able to make it 
work. Would anyone mind helping me out?

BTW, I am aware Deimos bindings for libclang are based on v3.7 
and not 6.0, but 3.7 is not available for Ubuntu 18.04 and I was 
wagering the interface probably hasn't changed much.
Jun 24 2018
parent reply Timoses <timosesu gmail.com> writes:
On Sunday, 24 June 2018 at 11:44:06 UTC, Dechcaudron wrote:
 Hi,

 I'm trying to use dub to compile a quick experiment that uses 
 Deimos libclang bindings, which of course requires linking 
 against an installed libclang. I believe this is what I need to 
 include in dub.json:

  "systemDependencies": "libclang-6.0"

 But it just won't link against the lib in the compilation 
 process. Using the -v option reveals the linking stage call:

 /usr/bin/dmd 
 -of.dub/build/application-debug-linux.posix-x86_64-dmd_2081-7C29937BC9011750CF
15D7325224156/damnc .dub/build/application-debug-linux.posix-x86_64-dmd_2081-7C29937BC9011750CFA1
D7325224156/damnc.o -L--no-as-needed -g

 It does not mention libclang at all. I've tried with all 
 "clang", "libclang-6.0.so.1", but I just don't seem to be able 
 to make it work. Would anyone mind helping me out?

 BTW, I am aware Deimos bindings for libclang are based on v3.7 
 and not 6.0, but 3.7 is not available for Ubuntu 18.04 and I 
 was wagering the interface probably hasn't changed much.
Hm, the description sounds like it might not be used for passing linker arguments, but serves for adding documentation to linker errors: "A textual description of the required system dependencies (external C libraries) required by the package. This will be visible on the registry and will be displayed in case of linker errors - this setting does not support platform suffixes". What about the "libs" build settings (or "lflags")? (http://code.dlang.org/package-format?lang=json) "libs": "clang"
Jun 24 2018
parent Dechcaudron <no-reply no-email.com> writes:
On Sunday, 24 June 2018 at 12:15:42 UTC, Timoses wrote:
 What about the "libs" build settings (or "lflags")? 
 (http://code.dlang.org/package-format?lang=json)

     "libs": "clang"
There it was, hidden in plain sight. Thanks for the extra pair of eyes Timoses. I don't know how I missed it. Successfully linking against 6.0 now. Cheers!
Jun 24 2018