www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problems with setting up dub for publication

reply solidstate1991 <laszloszeremi outlook.com> writes:
My graphics engine contains two subpackages currently:

-PixelPerfectEngine (the engine itself)

-PixelPerfectEditor (the editor/converter, uses the engine itself 
to display screen data)

However, after I wrote the dub.json and try to compile it as a 
test, I get this output:

Building package pixelperfectengine in 
G:\Developing\PixelPerfectEngine\
Performing "debug" build using dmd for x86.
pixelperfectengine ~master: building configuration "library"...
source\PixelPerfectEditor\app.d(15,8): Error: module sdl is in 
file 'derelict\sdl2\sdl.d' which cannot be read
import path[0] = source
import path[1] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[2] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
dmd failed with exit code 1.

Here's the json file:

{
	
	"name": "pixelperfectengine",
	
	"authors": [
		"Laszlo Szeremi"
	],
	
	"description": "A 2D game engine for retro styled games",

	"copyright": "Copyright 2015-2017 by Laszlo Szeremi under Boost 
license",

	"license": "Boost",
	"subPackages": [
	{
		"name": "pixelperfectengine",
		"sourcePath": "source/pixelperfectengine",
		"importPath": "source",
		"targetpath": "lib",
		"dependencies":
			{
		
			"derelict-sdl2": "~>2.1.0",

			"derelict-util": "~>2.1.0"
	
			},

	},
	{
		"name": "pixelperfecteditor",
		"sourcePath": "source/pixelperfecteditor",
		"importPath": "source",
		"targetpath": "bin/pixelperfecteditor",
		"dependencies":
			{
			"pixelperfectengine:pixelperfectengine": "*",
			"derelict-sdl2": "~>2.1.0",

			"derelict-util": "~>2.1.0"
,
			"derelict-fi": "~>3.0.0-alpha.1"
			},
	}
	],
}

The dependencies compile by themselves (as I don't like to use 
dub because of things like this), I don't know what's the problem.
Mar 04 2017
next sibling parent solidstate1991 <laszloszeremi outlook.com> writes:
Replaced all the ~> with ==, now I'm getting error from dub 
wanting to use the alpha versions of the derelict libraries, 
which have minor compatibility issues with my project.
Mar 04 2017
prev sibling parent reply Mike Parker <aldacron gmail.com> writes:
On Saturday, 4 March 2017 at 21:14:23 UTC, solidstate1991 wrote:

 However, after I wrote the dub.json and try to compile it as a 
 test, I get this output:
I don't see anything in your config that jumps out at me as a potential cause of your problem (though, see below). Do you have the project in a git repository somewhere so I can troubleshoot?
 			{
 			"pixelperfectengine:pixelperfectengine": "*",
 			"derelict-sdl2": "~>2.1.0",

 			"derelict-util": "~>2.1.0"
 ,
 			"derelict-fi": "~>3.0.0-alpha.1"
 			},
 	}
 	],
 }
Two things, neither of which (probably) is going to cure your problem: - You don't need the derelict-util dependency. All of the derelict packages are configured to use it. That's how dub works -- each package defines its own dependencies so you don't have to worry about them. Besides which, all of the derelict packages are configured to use derelict-util 2.0.x, not 2.1. Leave it out and dub will pull in the appropriate version. - Don't mix the alpha versions of any of the Derelict packages with any of the non-alpha versions. I realize this isn't documented anywhere yet, but all of the alpha versions require derelict-util 3.0 alpha, which is binary incompatible with earlier versions of derelict-util. You should be using ~>2.0.3 for derelict-fi. When all of the alpha versions are finally finished, I'll document which versions are compatible.
 The dependencies compile by themselves (as I don't like to use 
 dub because of things like > this), I don't know what's the 
 problem.
Don't let things like this turn you off of dub. It's an excellent tool. I was reluctant to use it at first because such tools had come and gone in the D community before. But once I did, I never looked back. I rarely have issues with it and when I do it's almost always because of user error. One thing you might try is to delete the dub.selections.json that was created in your project directory (and the .dub directory for good measure), update the dependencies as I said above, and try again.
Mar 04 2017
parent Samwise <mggmugginsmc gmail.com> writes:
On Sunday, 5 March 2017 at 01:54:22 UTC, Mike Parker wrote:
 ...
I was getting the same problem and created on issue on this project's repository (https://github.com/ZILtoid1991/pixelperfectengine), which I think (although I don't know) was the reason this thread was created. Using the dub.json that I added in that PR will compile. However, since I didn't actually write any code, I doubt that if I imported anything from pixelperfect that it would still work. This is an issue I saw somewhere else... Anyway, building "pixelperfectengine:pixelperfectengine": "*" works with the hello world app.d, although like I said, probably will not if I try to import anything from pixelperfect. Building "pixelperfectengine": "~>0.9.1-rc2" does not work, it still gives me the linker error from the top of this thread. I like dub too. It has worked well for me and seems to be much lighter and less of a mess than at least some IDE's. Right now I finished fixing the d-struct package for the atom text editor, which adds dub support for that, so I don't have to use the command line hardly at all :P. In any case, dub is a great tool, and works well most of the time.
Mar 07 2017