Is there a way to use x86 and x86_mscoff with dub simultaneously.

Sönke Ludwig via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 25 15:41:39 PDT 2017


Am 25.07.2017 um 20:47 schrieb ciechowoj:
> As Jacob Carlborg said it's for the dstep.
>
> On Tuesday, 25 July 2017 at 15:18:04 UTC, Mike Parker wrote:
>> On Tuesday, 25 July 2017 at 14:17:54 UTC, ciechowoj wrote:
>> What's wrong with the current error message? Doesn't it do that?
>
> Nope, this message looks like intended for the library author rather
> than for a library user.
>
> What I want is a message that signals that the compilation isn't
> possible with the default x86 arch and the user has to use x86_mscoff arch.
>
>> That's precisely what --arch (or simply -a) is for. But you can avoid
>> passing it explicitly by setting the $DUB_ARCH environment variable
>> (as per the dub documentation).
>
> To disable the warning I mentioned in the first post I needed to remove
> the `-m32mscoff` flag. Now the library can be compiled only with
> explicit specification of the architecture.
>
> However the default arch is what the library's end user will select most
> likely.
> And then they will receive unhelpful message about OPTLINK being unable
> to parse the VS linker command line.
>
> Ideally I would like to be able to suppress m32mscoff warning and build
> for x86_mscoff by default (or amd64).
>
> Setting $DUB_ARCH is unacceptable as well.
>
>

What you can do is to create a configuration that only works for x86_64:

     name "myproject"

     configuration "library" {
         platforms "x86_64"
         targetType "library"
         // ...
     }

This will cause the configuration resolution to fail if the wrong 
architecture is selected. The downside is that I think the error message 
will not be very helpful currently (something like "could not resolve 
configuration for myproject"), but that should be fixable.


More information about the Digitalmars-d mailing list