www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dustmite on dub project

reply Steven Schveighoffer <schveiguy gmail.com> writes:
I have a bug report in mysql-native that if you try to create the 
following file, and add mysql-native as a dependency it fails to link on 
Windows 10:

import std.stdio;
import mysql;

void main()
{
	writeln("Edit source/app.d to start your project.");
}

You might recognize that as the default dub file, with an extra import.

The link error is:

testmysql.obj : error LNK2001: unresolved external symbol 
_D5mysql12__ModuleInfoZ

So I figured I'd try dustmite, and used:

dub dustmite ..\dusted --linker-status=1

The result after almost 2 days: a bunch of directories with mostly no d 
files, and no source code in any of the d files.

What did I do wrong? Is this even worth trying again? 2 days is a long 
time to tie up my windows vm.

-Steve
Jan 26 2021
next sibling parent reply Andre Pany <andre s-e-a-p.de> writes:
On Tuesday, 26 January 2021 at 16:04:29 UTC, Steven Schveighoffer 
wrote:
 I have a bug report in mysql-native that if you try to create 
 the following file, and add mysql-native as a dependency it 
 fails to link on Windows 10:

 import std.stdio;
 import mysql;

 void main()
 {
 	writeln("Edit source/app.d to start your project.");
 }

 You might recognize that as the default dub file, with an extra 
 import.

 The link error is:

 testmysql.obj : error LNK2001: unresolved external symbol 
 _D5mysql12__ModuleInfoZ

 So I figured I'd try dustmite, and used:

 dub dustmite ..\dusted --linker-status=1

 The result after almost 2 days: a bunch of directories with 
 mostly no d files, and no source code in any of the d files.

 What did I do wrong? Is this even worth trying again? 2 days is 
 a long time to tie up my windows vm.

 -Steve
I think the behavior can be explained. Your search criteria (linked status) is not precise. It can be triggered by the real problem but also by a few empty d files. Therefore Dustmite did a good job, it reduced your code base to a minimum which still trigger a linker error. You might search the linker error text instead. Kind regards Andre
Jan 26 2021
parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 1/26/21 1:33 PM, Andre Pany wrote:
 On Tuesday, 26 January 2021 at 16:04:29 UTC, Steven Schveighoffer wrote:
 I have a bug report in mysql-native that if you try to create the 
 following file, and add mysql-native as a dependency it fails to link 
 on Windows 10:

 import std.stdio;
 import mysql;

 void main()
 {
     writeln("Edit source/app.d to start your project.");
 }

 You might recognize that as the default dub file, with an extra import.

 The link error is:

 testmysql.obj : error LNK2001: unresolved external symbol 
 _D5mysql12__ModuleInfoZ

 So I figured I'd try dustmite, and used:

 dub dustmite ..\dusted --linker-status=1

 The result after almost 2 days: a bunch of directories with mostly no 
 d files, and no source code in any of the d files.

 What did I do wrong? Is this even worth trying again? 2 days is a long 
 time to tie up my windows vm.
I think the behavior can be explained. Your search criteria (linked status) is not precise. It can be triggered by the real problem but also by a few empty d files. Therefore Dustmite did a good job, it reduced your code base to a minimum which still trigger a linker error. You might search the linker error text instead.
Yes, thanks. I think probably this would work. I would suggest however, that dub not provide an option that is almost certainly likely to result in completely useless results. I had assumed that using that would keep the linker error the same. Maybe if --linker-status or --compiler-status is provided, not do anything unless there are other options (i.e. --compiler-regex or --linker-regex) which is what I should have added as well. In the meantime, I'm going to try manually reducing the dependencies, to try and reduce down the dustmite search (mysql-native depends on a lot of vibe stuff, which is probably not necessary to reproduce this). I didn't expect 2 days of running. -Steve
Jan 26 2021
prev sibling parent reply Andre Pany <andre s-e-a-p.de> writes:
On Tuesday, 26 January 2021 at 16:04:29 UTC, Steven Schveighoffer 
wrote:
 I have a bug report in mysql-native that if you try to create 
 the following file, and add mysql-native as a dependency it 
 fails to link on Windows 10:

 import std.stdio;
 import mysql;

 void main()
 {
 	writeln("Edit source/app.d to start your project.");
 }

 You might recognize that as the default dub file, with an extra 
 import.

 The link error is:

 testmysql.obj : error LNK2001: unresolved external symbol 
 _D5mysql12__ModuleInfoZ

 So I figured I'd try dustmite, and used:

 dub dustmite ..\dusted --linker-status=1

 The result after almost 2 days: a bunch of directories with 
 mostly no d files, and no source code in any of the d files.

 What did I do wrong? Is this even worth trying again? 2 days is 
 a long time to tie up my windows vm.

 -Steve
For your specific problem, this issue is related to your dub.json: "configurations": [ { "excludedSourceFiles": [ "source/mysql/package.d" ], "name": "application", "targetType": "executable", "versions": [ "VibeCustomMain" ] }, { "excludedSourceFiles": [ "source/app.d", "source/mysql/package.d" ], "name": "library", "targetType": "library" } ], If you remove the excludedSourceFiles from config "library", it is working. But at the moment I am puzzled, what is going on here. Kind regards André
Jan 26 2021
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 1/26/21 2:41 PM, Andre Pany wrote:

 For your specific problem, this issue is related to your dub.json:
 
      "configurations": [
          {
              "excludedSourceFiles": [
                  "source/mysql/package.d"
              ],
              "name": "application",
              "targetType": "executable",
              "versions": [
                  "VibeCustomMain"
              ]
          },
          {
              "excludedSourceFiles": [
                  "source/app.d",
                  "source/mysql/package.d"
              ],
              "name": "library",
              "targetType": "library"
          }
      ],
 
 If you remove the excludedSourceFiles from config "library", it is working.
 But at the moment I am puzzled, what is going on here.
Wait, this makes no sense. I'm going to have to figure out why those are added. And THANK YOU for seeing that. That is definitely the issue (ModuleInfoZ is the module info for a module) what really bugs me is that this only seemed to be happening with DMD 2.095. The simple app worked with a different version of the compiler (2.094 I think, but I have to reinstall to figure it out). I feel like this was added by the previous author to fix some quirky issue with either dub or the compiler. It could be related to documentation too. -Steve
Jan 26 2021
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 1/26/21 2:59 PM, Steven Schveighoffer wrote:
 On 1/26/21 2:41 PM, Andre Pany wrote:
 
 For your specific problem, this issue is related to your dub.json:

      "configurations": [
          {
              "excludedSourceFiles": [
                  "source/mysql/package.d"
              ],
              "name": "application",
              "targetType": "executable",
              "versions": [
                  "VibeCustomMain"
              ]
          },
          {
              "excludedSourceFiles": [
                  "source/app.d",
                  "source/mysql/package.d"
              ],
              "name": "library",
              "targetType": "library"
          }
      ],

 If you remove the excludedSourceFiles from config "library", it is 
 working.
 But at the moment I am puzzled, what is going on here.
Wait, this makes no sense. I'm going to have to figure out why those are added. And THANK YOU for seeing that. That is definitely the issue (ModuleInfoZ is the module info for a module)
Hold on, where do you see this? mysql-native has dub.sdl, and it doesn't have these in there. -Steve
Jan 26 2021
parent reply Andre Pany <andre s-e-a-p.de> writes:
On Tuesday, 26 January 2021 at 20:09:27 UTC, Steven Schveighoffer 
wrote:
 On 1/26/21 2:59 PM, Steven Schveighoffer wrote:
 On 1/26/21 2:41 PM, Andre Pany wrote:
 
 For your specific problem, this issue is related to your 
 dub.json:

      "configurations": [
          {
              "excludedSourceFiles": [
                  "source/mysql/package.d"
              ],
              "name": "application",
              "targetType": "executable",
              "versions": [
                  "VibeCustomMain"
              ]
          },
          {
              "excludedSourceFiles": [
                  "source/app.d",
                  "source/mysql/package.d"
              ],
              "name": "library",
              "targetType": "library"
          }
      ],

 If you remove the excludedSourceFiles from config "library", 
 it is working.
 But at the moment I am puzzled, what is going on here.
Wait, this makes no sense. I'm going to have to figure out why those are added. And THANK YOU for seeing that. That is definitely the issue (ModuleInfoZ is the module info for a module)
Hold on, where do you see this? mysql-native has dub.sdl, and it doesn't have these in there. -Steve
I executed `dub init sample` and added in the interactive console the dependency `mysql-native`. It added `mysql-native ~> 3.0.0`. In the local dub package folder I opened dub.json of package mysql-native. I assume dub converts dub.sdl to dub.json while fetching packages. Here I found the content of this https://github.com/mysql-d/mysql-native/blob/master/dub.sdl just as JSON formatted. For this package I can reproduce the linker error. Kind regards André
Jan 26 2021
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 1/26/21 3:17 PM, Andre Pany wrote:
 On Tuesday, 26 January 2021 at 20:09:27 UTC, Steven Schveighoffer wrote:
 Hold on, where do you see this? mysql-native has dub.sdl, and it 
 doesn't have these in there.
I executed `dub init sample` and added in the interactive console the dependency `mysql-native`. It added `mysql-native ~> 3.0.0`. In the local dub package folder I opened dub.json of package mysql-native. I assume dub converts dub.sdl to dub.json while fetching packages. Here I found the content of this https://github.com/mysql-d/mysql-native/blob/master/dub.sdl just as JSON formatted.
Oh wow. Weird. No, the dub.sdl does NOT contain the exclusion of the package.d file (see in the file you actually linked). So dub-registry is doing this? or is it dub? Now I need to load a previous version of dmd and see if this works. -Steve
Jan 26 2021
next sibling parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 1/26/21 3:36 PM, Steven Schveighoffer wrote:
 On 1/26/21 3:17 PM, Andre Pany wrote:
 On Tuesday, 26 January 2021 at 20:09:27 UTC, Steven Schveighoffer wrote:
 Hold on, where do you see this? mysql-native has dub.sdl, and it 
 doesn't have these in there.
I executed `dub init sample` and added in the interactive console the dependency `mysql-native`. It added `mysql-native ~> 3.0.0`. In the local dub package folder I opened dub.json of package mysql-native. I assume dub converts dub.sdl to dub.json while fetching packages. Here I found the content of this https://github.com/mysql-d/mysql-native/blob/master/dub.sdl just as JSON formatted.
Oh wow. Weird. No, the dub.sdl does NOT contain the exclusion of the package.d file (see in the file you actually linked). So dub-registry is doing this? or is it dub? Now I need to load a previous version of dmd and see if this works.
It's dub. https://github.com/dlang/dub/pull/2039 Not sure if I agree with this change. -Steve
Jan 26 2021
prev sibling parent reply Andre Pany <andre s-e-a-p.de> writes:
On Tuesday, 26 January 2021 at 20:36:58 UTC, Steven Schveighoffer 
wrote:
 On 1/26/21 3:17 PM, Andre Pany wrote:
 On Tuesday, 26 January 2021 at 20:09:27 UTC, Steven 
 Schveighoffer wrote:
 Hold on, where do you see this? mysql-native has dub.sdl, and 
 it doesn't have these in there.
I executed `dub init sample` and added in the interactive console the dependency `mysql-native`. It added `mysql-native ~> 3.0.0`. In the local dub package folder I opened dub.json of package mysql-native. I assume dub converts dub.sdl to dub.json while fetching packages. Here I found the content of this https://github.com/mysql-d/mysql-native/blob/master/dub.sdl just as JSON formatted.
Oh wow. Weird. No, the dub.sdl does NOT contain the exclusion of the package.d file (see in the file you actually linked). So dub-registry is doing this? or is it dub? Now I need to load a previous version of dmd and see if this works. -Steve
I think dub is doing this. I remember there was a recent PR doing some things with excludeSourceFiles: https://github.com/dlang/dub/pull/2039/files Kind regards André
Jan 26 2021
parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 1/26/21 3:47 PM, Andre Pany wrote:
 On Tuesday, 26 January 2021 at 20:36:58 UTC, Steven Schveighoffer wrote:
 On 1/26/21 3:17 PM, Andre Pany wrote:
 On Tuesday, 26 January 2021 at 20:09:27 UTC, Steven Schveighoffer wrote:
 Hold on, where do you see this? mysql-native has dub.sdl, and it 
 doesn't have these in there.
I executed `dub init sample` and added in the interactive console the dependency `mysql-native`. It added `mysql-native ~> 3.0.0`. In the local dub package folder I opened dub.json of package mysql-native. I assume dub converts dub.sdl to dub.json while fetching packages. Here I found the content of this https://github.com/mysql-d/mysql-native/blob/master/dub.sdl just as JSON formatted.
Oh wow. Weird. No, the dub.sdl does NOT contain the exclusion of the package.d file (see in the file you actually linked). So dub-registry is doing this? or is it dub? Now I need to load a previous version of dmd and see if this works.
I think dub is doing this. I remember there was a recent PR doing some things with excludeSourceFiles: https://github.com/dlang/dub/pull/2039/files
Hah, I found it too. Thanks so much, this likely saved me another 2 days of dustmiting. -Steve
Jan 26 2021