Thread overview
Why -I flag does not work?
Feb 09
JN
Feb 09
DanielG
February 09
For this project: https://github.com/vporton/xml-boiler-dlang/tree/85b5587f50617ad1b001c035c72a5780a1e69c24

$ DFLAGS="-I/usr/local/include/d/librdf -L-L/usr/local/lib" dub build --compiler=dmd --build=unittest
Performing "unittest" build using dmd for x86_64.
xml-boiler-dlang ~master: building configuration "library"...
source/xmlboiler/options.d(4,8): Error: module `model` is in file 'rdf/redland/model.d' which cannot be read
import path[0] = source/
import path[1] = ../../.dub/packages/ae-0.0.2331/ae/sys
import path[2] = ../../.dub/packages/ae-0.0.2331/ae/utils
import path[3] = ../../.dub/packages/ae-0.0.2331/ae/net
import path[4] = /snap/dmd/40/bin/../import/druntime
import path[5] = /snap/dmd/40/bin/../import/phobos
dmd failed with exit code 1.
$ ls /usr/local/include/d/librdf/rdf/redland/model.d
/usr/local/include/d/librdf/rdf/redland/model.d
$ dmd --version
DMD64 D Compiler v2.080.1
Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved written by Walter Bright

Why does -I flag in DFLAGS does not work? (Ubuntu Linux)
February 09
On Saturday, 9 February 2019 at 08:15:36 UTC, Victor Porton wrote:
> $ DFLAGS="-I/usr/local/include/d/librdf -L-L/usr/local/lib" dub build --compiler=dmd --build=unittest
...
> Why does -I flag in DFLAGS does not work? (Ubuntu Linux)

This does not work too:

$ DFLAGS="-I/usr/local/include/d/librdf -L-L/usr/local/lib" dmd -unittest source/xmlboiler/options.d

Why?!
February 09
On Saturday, 9 February 2019 at 08:15:36 UTC, Victor Porton wrote:
> Why does -I flag in DFLAGS does not work? (Ubuntu Linux)

I'm no expert on dub, but it's possible that it's overriding the import path anyway. One of the main points of dub is that you shouldn't have to handle the import paths yourself.

I think what could work is adding a librdf in dub.json dependencies section, and then using "dub add-local" command to point to the library. Something like:

dub add-local /usr/local/include/d/librdf ~master

and then in dependencies section:

"dependencies": {
    "librdf": "~master"
}
February 09
On Saturday, 9 February 2019 at 08:15:36 UTC, Victor Porton wrote:
> Why does -I flag in DFLAGS does not work? (Ubuntu Linux)

Try adding the -i flag as well ("include imported modules in the compilation"), or setting both importPaths and sourcePaths in dub.json.

I'm not certain that will help, but long ago I was having similar trouble and it was because I was importing, but not compiling, a certain file.

For reference: https://dub.pm/package-format-json
February 09
On Saturday, 9 February 2019 at 08:35:53 UTC, JN wrote:
> On Saturday, 9 February 2019 at 08:15:36 UTC, Victor Porton wrote:
>> Why does -I flag in DFLAGS does not work? (Ubuntu Linux)
>
> I'm no expert on dub, but it's possible that it's overriding the import path anyway. One of the main points of dub is that you shouldn't have to handle the import paths yourself.
>
> I think what could work is adding a librdf in dub.json dependencies section, and then using "dub add-local" command to point to the library. Something like:
>
> dub add-local /usr/local/include/d/librdf ~master
>
> and then in dependencies section:
>
> "dependencies": {
>     "librdf": "~master"
> }

As I understand it would pollute the Git version of dub.json with my local changes. That's no good.
February 09
On Saturday, 9 February 2019 at 10:32:36 UTC, DanielG wrote:
> On Saturday, 9 February 2019 at 08:15:36 UTC, Victor Porton wrote:
>> Why does -I flag in DFLAGS does not work? (Ubuntu Linux)
>
> Try adding the -i flag as well ("include imported modules in

-i in DFLAGS does not help.

-I works when passed on the command line but not in DFLAGS :-(

> the compilation"), or setting both importPaths and sourcePaths in dub.json.

This would pollute the Git version of the dub.json with my local changes.

> I'm not certain that will help, but long ago I was having similar trouble and it was because I was importing, but not compiling, a certain file.

It should not be compiled, only imported. It was already compiled to a shared library.
February 09
On Saturday, 9 February 2019 at 11:40:57 UTC, Victor Porton wrote:
> On Saturday, 9 February 2019 at 08:35:53 UTC, JN wrote:
>> On Saturday, 9 February 2019 at 08:15:36 UTC, Victor Porton wrote:
>>> Why does -I flag in DFLAGS does not work? (Ubuntu Linux)
>>
>> I'm no expert on dub, but it's possible that it's overriding the import path anyway. One of the main points of dub is that you shouldn't have to handle the import paths yourself.
>>
>> I think what could work is adding a librdf in dub.json dependencies section, and then using "dub add-local" command to point to the library. Something like:
>>
>> dub add-local /usr/local/include/d/librdf ~master
>>
>> and then in dependencies section:
>>
>> "dependencies": {
>>     "librdf": "~master"
>> }
>
> As I understand it would pollute the Git version of dub.json with my local changes. That's no good.

I did

// dub.json:
	"dependencies": {
		"rdf_dlang": "~>1.0.17",
		"ae": "~>0.0.2331"
	},

// dub.selections.json:
{
	"fileVersion": 1,
	"versions": {
		"ae": "0.0.2331",
		"rdf_dlang": "1.0.17"
	}
}

I also installed /usr/local/include/d/librdf/dub.json with "sourcePaths": ["/usr/local/stow/rendland-bindings/include/d/librdf"]

and did

$ dub add-local /usr/local/include/d/librdf/ 1.0.17

But nevertheless:

$ dub build --compiler=dmd --build=unittest
Dynamic libraries are not yet supported as dependencies - building as static library.
Performing "unittest" build using dmd for x86_64.
xml-boiler-dlang ~master: building configuration "library"...
source/xmlboiler/options.d(4,8): Error: module `model` is in file 'rdf/redland/model.d' which cannot be read
import path[0] = source/
import path[1] = ../../.dub/packages/ae-0.0.2331/ae/sys
import path[2] = ../../.dub/packages/ae-0.0.2331/ae/utils
import path[3] = ../../.dub/packages/ae-0.0.2331/ae/net
import path[4] = /snap/dmd/40/bin/../import/druntime
import path[5] = /snap/dmd/40/bin/../import/phobos
dmd failed with exit code 1.
February 09
On Saturday, 9 February 2019 at 08:15:36 UTC, Victor Porton wrote:
> Why does -I flag in DFLAGS does not work? (Ubuntu Linux)

https://github.com/dlang/dub/issues/1645