March 29, 2018
On Wednesday, 28 March 2018 at 20:09:24 UTC, Johan Engelen wrote:
> On Wednesday, 28 March 2018 at 17:03:07 UTC, Seb wrote:
>> 
>> dub supports dflags and lflags in the config file. lflags are the linker commands.
>
> Please read the thread.
>
> `lflags` is for passing flags to the _linker_ (i.e. those flags are prefixed with -L when passed to the _compiler_)
>
> Here, what's needed is passing flags to the _compiler_ when it is invoked to perform the link step in the build.

Please read the reply :), although it could be a bit more clear.

`dflags` is used to pass arbitrary flags to the compiler. See the bottom of the table at [1].

[1] https://code.dlang.org/package-format?lang=sdl#build-settings

--
/Jacob Carlborg
March 30, 2018
On Thursday, 29 March 2018 at 08:44:21 UTC, Jacob Carlborg wrote:
>
> Please read the reply :), although it could be a bit more clear.

I'll spell it out for you.

Both `dflags` and `lflags` are being used already. With separate compilation and linking, there seems to be no way to pass flags to the compiler during the linking step: dflags is not used and lflags is prefixed with `-L`.

-Johan

March 30, 2018
On Wednesday, 28 March 2018 at 16:42:23 UTC, Johan Engelen wrote:
> On Tuesday, 27 March 2018 at 22:10:33 UTC, Per Nordlöw wrote:
>> On Tuesday, 27 March 2018 at 22:00:42 UTC, Johan Engelen wrote:
>>> Indeed.
>>> Please try to manually link first (without dub) by modifying the command on which dub errors:
>>>
>>> ```
>>> ldmd2 -flto=thin -of.dub/build/application-release-nobounds-lto-linux.posix-x86_64-ldc_2078-F2904BE3C4DA237C077E5C2B0B23442E/knetquery .dub/build/application-release-nobounds-lto-linux.posix-x86_64-ldc_2078-F2904BE3C4DA237C077E5C2B0B23442E/knetquery.o ../../.dub/packages/gmp-d-master/gmp-d/.dub/build/library-release-nobounds-lto-linux.posix-x86_64-ldc_2078-B287F67CE5FF6145BC229790CFB09607/libgmp-d.a phobos-next/.dub/build/library-release-nobounds-lto-linux.posix-x86_64-ldc_2078-F0F2FDB01B8401C04D657BCC145D46A5/libknet_phobos-next.a -L--no-as-needed -L-lzstd -L-lgmp -L-lc -L-lreadline -L-lz -L-lbz2
>>> ```
>>>
>>> -Johan
>>
>> Yes, that works!
>
> I'm no dub expert and I don't know how to pass flags to the _compiler_ for the link step.
> Would be good to figure that out with the dub folks.

For a stopgap solution:
I think what you are doing is passing `--compiler=<yourpath>/ldmd2` (note: LDMD) to dub when building, and you get separate compilation+linking. If you'd use `--compiler=<yourpath>/ldc2` (note: LDC), then you would not get separate compilation+linking [1] and things work with just setting `dflags`.

I've asked about the problem here: https://github.com/dlang/dub/issues/1431

cheers,
  Johan

[1] https://github.com/dlang/dub/issues/809

1 2
Next ›   Last »