www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - [dub] Error: module `main` from file source\main.d is specified twice

reply Anonymouse <asdf asdf.net> writes:
I'm trying to set up AppVeyor to build and test my project.

After some dancing to get a 64-bit dmd.exe in there (which should 
really be included in the 7z in 2018) everything seems like it 
should work, but compiling with dub build fails. dub test works 
but claims that it's excluding main.d twice. Everything just 
works locally.

appveyor.yml: 
https://github.com/zorael/kameloso/blob/b278468eb69f221c0db6b96274cec2b0fd25612f/appveyor.yml#L92
dub.json: 
https://github.com/zorael/kameloso/blob/b278468eb69f221c0db6b96274cec2b0fd25612f/dub.json#L8

Slightly summarized:
 $ dub test -c cygwin


 $ dub build -c cygwin
 Performing "debug" build using dmd for x86_64.
 requests 0.7.4: building configuration "std"...
 kameloso 1.0.0-rc.1+commit.322.gb278468e: building 
 configuration "cygwin"...
 Error: module `kameloso.main` from file source\kameloso\main.d 
 is specified twice on the command line
 dmd failed with exit code 1.
Job log: https://ci.appveyor.com/project/zorael/kameloso/build/job/kd6lqu2kxg4vxqmv dub.json does have a mainSourceFile entry, so I thought to remove that, but if I do it breaks dub test with "only one `main` allowed".
 $ dub test -c vanilla
 Executable configuration "vanilla" of package kameloso defines 
 no main source file, this may cause certain build modes to 
 fail. Add an explicit "mainSourceFile" to the package 
 description to fix this.
 Generating test runner configuration 'kameloso-test-vanilla' 
 for 'vanilla' (executable).
 Excluding package.d file from test due to 
 https://issues.dlang.org/show_bug.cgi?id=11847
 Performing "unittest" build using dmd for x86_64.
 kameloso 1.0.0-rc.1+commit.316.gc9216fa3: building 
 configuration "kameloso-test-vanilla"...
 source\kameloso\main.d(744,6): Error: only one `main`, 
 `WinMain`, or `DllMain` allowed. Previously found `main` at 
 C:\Users\appveyor\AppData\Local\Temp\1\dub_test_root-5d1d92fa-e527-43b0-a181-184253ffcc9d.d(45,12)
 dmd failed with exit code 1.
Job log: https://ci.appveyor.com/project/zorael/kameloso/build/1.0.0-rc.2.143/job/8tox3hym32leik7u What can I do?
Jun 22 2018
parent reply Jacob Carlborg <doob me.com> writes:
On 2018-06-22 21:41, Anonymouse wrote:
 I'm trying to set up AppVeyor to build and test my project.

 After some dancing to get a 64-bit dmd.exe in there (which should really
 be included in the 7z in 2018) everything seems like it should work, but
 compiling with dub build fails. dub test works but claims that it's
 excluding main.d twice. Everything just works locally.

 appveyor.yml:
 https://github.com/zorael/kameloso/blob/b278468eb69f221c0db6b96274cec2b0fd25612f/appveyor.yml#L92

 dub.json:
 https://github.com/zorael/kameloso/blob/b278468eb69f221c0db6b96274cec2b0fd25612f/dub.json#L8


 Slightly summarized:
 $ dub test -c cygwin


 $ dub build -c cygwin
 Performing "debug" build using dmd for x86_64.
 requests 0.7.4: building configuration "std"...
 kameloso 1.0.0-rc.1+commit.322.gb278468e: building configuration
 "cygwin"...
 Error: module `kameloso.main` from file source\kameloso\main.d is
 specified twice on the command line
 dmd failed with exit code 1.
Job log: https://ci.appveyor.com/project/zorael/kameloso/build/job/kd6lqu2kxg4vxqmv dub.json does have a mainSourceFile entry, so I thought to remove that, but if I do it breaks dub test with "only one `main` allowed".
 $ dub test -c vanilla
 Executable configuration "vanilla" of package kameloso defines no main
 source file, this may cause certain build modes to fail. Add an
 explicit "mainSourceFile" to the package description to fix this.
 Generating test runner configuration 'kameloso-test-vanilla' for
 'vanilla' (executable).
 Excluding package.d file from test due to
 https://issues.dlang.org/show_bug.cgi?id=11847
 Performing "unittest" build using dmd for x86_64.
 kameloso 1.0.0-rc.1+commit.316.gc9216fa3: building configuration
 "kameloso-test-vanilla"...
 source\kameloso\main.d(744,6): Error: only one `main`, `WinMain`, or
 `DllMain` allowed. Previously found `main` at
 C:\Users\appveyor\AppData\Local\Temp\1\dub_test_root-5d1d92fa-e527-43b0-a181-184253ffcc9d.d(45,12)

 dmd failed with exit code 1.
Job log: https://ci.appveyor.com/project/zorael/kameloso/build/1.0.0-rc.2.143/job/8tox3hym32leik7u What can I do?
It might be this issue [1], should be fixed in the latest version of Dub. [1] https://github.com/dlang/dub/issues/1454 -- /Jacob Carlborg
Jun 23 2018
parent Anonymouse <asdf asdf.net> writes:
On Saturday, 23 June 2018 at 08:10:08 UTC, Jacob Carlborg wrote:
 On 2018-06-22 21:41, Anonymouse wrote:
 What can I do?
It might be this issue [1], should be fixed in the latest version of Dub. [1] https://github.com/dlang/dub/issues/1454
Thanks.
Jun 23 2018