www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking a .h file

reply infinityplusb <brian infinityplusb.com> writes:
I'm trying to use Dagon (https://github.com/gecko0307/dagon) for 
what I thought would be a simple enough project.
Initially the one thing I needed to do was to install Nuklear and 
Freetype 2.8.1 `Under other OSes you have to install them 
manually` as I'm running on Ubuntu.

I'm using dub and thought this would be a simple matter of adding 
some parameters to the .sdl file, however I'm finding it tricky 
figuring out what to add (or if I'm oversimplifying or 
overcomplicating things).

So I've found either a .h file here 
(https://github.com/vurtun/nuklear) or here has something I can 
compile to a .so file (https://github.com/Timu5/bindbc-nuklear).
However no matter where I put files or whatever dub.sdl 
parameters I use, I can't seem to get it to work.
My current sdl looks like:

name "test"
description "Test"
targetType "executable"
dependency "dagon" version="0.10.0"
libs "nuklear" platform="posix"
lflags "-L/usr/local/lib/"


My latest error is
```
error while loading shared libraries: libnuklear.so.4.0.2: cannot 
open shared object file: No such file or directory

```

If it's a simple dub config thing, can someone handhold me 
through what the best way to get this to work is? Otherwise which 
file (.h or .so) should I put where for it to get picked up?

TIA
May 23 2019
parent reply Timur Gafarov <gecko0307 gmail.com> writes:
23.05.2019 13:12, infinityplusb пишет:
 I'm trying to use Dagon (https://github.com/gecko0307/dagon) for what I 
 thought would be a simple enough project.
 Initially the one thing I needed to do was to install Nuklear and 
 Freetype 2.8.1 `Under other OSes you have to install them manually` as 
 I'm running on Ubuntu.
 
 I'm using dub and thought this would be a simple matter of adding some 
 parameters to the .sdl file, however I'm finding it tricky figuring out 
 what to add (or if I'm oversimplifying or overcomplicating things).
 
 So I've found either a .h file here (https://github.com/vurtun/nuklear) 
 or here has something I can compile to a .so file 
 (https://github.com/Timu5/bindbc-nuklear).
 However no matter where I put files or whatever dub.sdl parameters I 
 use, I can't seem to get it to work.
 My current sdl looks like:
 
 name "test"
 description "Test"
 targetType "executable"
 dependency "dagon" version="0.10.0"
 libs "nuklear" platform="posix"
 lflags "-L/usr/local/lib/"
 
 
 My latest error is
 ```
 error while loading shared libraries: libnuklear.so.4.0.2: cannot open 
 shared object file: No such file or directory
 
 ```
 
 If it's a simple dub config thing, can someone handhold me through what 
 the best way to get this to work is? Otherwise which file (.h or .so) 
 should I put where for it to get picked up?
 
 TIA
bindbc-nuklear expects nuklear.so in /usr/local/lib. Or you can compile Dagon without optional libraries, using "Minimal" subconfiguration in your dub.json: "subConfigurations": { "dagon": "Minimal" } Fonts and GUI will be unavailable then. You can also use "NoNuklear" and "NoFreetype" subconfigurations.
May 25 2019
next sibling parent infinityplusb <brian infinityplusb.com> writes:
On Saturday, 25 May 2019 at 12:59:50 UTC, Timur Gafarov wrote:
 bindbc-nuklear expects nuklear.so in /usr/local/lib. Or you can 
 compile Dagon without optional libraries, using "Minimal" 
 subconfiguration in your dub.json:

 "subConfigurations": {
     "dagon": "Minimal"
 }

 Fonts and GUI will be unavailable then. You can also use 
 "NoNuklear" and "NoFreetype" subconfigurations.
That is what the documentation says, but that doesn't seem to work for me. I'm using an dub.sdl file rather than a dub.json, and using ``` dependency "dagon" version="0.10.0" subConfigurations { "dagon" "Minimal" } ``` but then I get
 Error: Nuklear library is not found. Please, install Nuklear.
 Program exited with code 1
I'll try with a dub.json but my understanding is both sdl and json should produce the same thing?
May 27 2019
prev sibling parent infinityplusb <brian infinityplusb.com> writes:
On Saturday, 25 May 2019 at 12:59:50 UTC, Timur Gafarov wrote:
 bindbc-nuklear expects nuklear.so in /usr/local/lib.
That's important! I changed my symlink in `/usr/local/lib` from `libnuklear.so` to `nuklear.so` and it works now.
May 27 2019