Thread overview
DUB mysql-native
Oct 08, 2019
Vino
Oct 08, 2019
Daniel Kozak
Oct 08, 2019
Daniel Kozak
Oct 08, 2019
Vino
Oct 08, 2019
Vino
Oct 08, 2019
Daniel Kozak
October 08, 2019
Hi All,

 Please correct me what is wrong as I am not able to build a project using dub getting the error "Could not resolve configuration for package hub".

dub init HUB
C:\Users\userp\Downloads\testhub>dub init HUB
Package recipe format (sdl/json) [json]:
Name [hub]:
Description [A minimal D application.]:
Author name [userp]:
License [proprietary]:
Copyright string [Copyright © 2019, userp]:
Add dependency (leave empty to skip) []:
Successfully created an empty project in 'C:\Users\userp\Downloads\testhub\HUB'.
Package successfully created in HUB

cd HUB
dub add dub
Adding dependency dub ~>1.17.0

dub add mysql-native
Adding dependency mysql-native ~>2.3.0

dub build
Fetching libevent 2.0.2+2.0.16 (getting selected version)...
Fetching vibe-core 1.7.0 (getting selected version)...
Fetching taggedalgebraic 0.11.4 (getting selected version)...
Fetching dub 1.17.0 (getting selected version)...
Fetching vibe-d 0.8.6 (getting selected version)...
Fetching memutils 0.4.13 (getting selected version)...
Fetching stdx-allocator 2.77.5 (getting selected version)...
Fetching unit-threaded 0.7.55 (getting selected version)...
Fetching eventcore 0.8.46 (getting selected version)...
Fetching libasync 0.8.4 (getting selected version)...
Fetching mysql-native 2.3.0 (getting selected version)...
Fetching botan-math 1.0.3 (getting selected version)...
Fetching botan 1.12.10 (getting selected version)...
Fetching diet-ng 1.6.0 (getting selected version)...
Fetching openssl 1.1.6+1.0.1g (getting selected version)...
Fetching mir-linux-kernel 1.0.1 (getting selected version)...
Could not resolve configuration for package hub

From,
Vino.B
October 08, 2019
On Tue, Oct 8, 2019 at 10:55 AM Vino via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
>
> Could not resolve configuration for package hub
>
> From,
> Vino.B

It is known issue, you can not use mysql-native right now with anything else than libevent

https://github.com/mysql-d/mysql-native/issues/199

Or you can just remove

"subConfigurations": {
"vibe-d:core": "libevent"
},

from ~/.dub/packages/mysql-native-2.3.0/mysql-native/dub.json
October 08, 2019
On Tue, Oct 8, 2019 at 1:15 PM Daniel Kozak <kozzi11@gmail.com> wrote:
> ...
> It is known issue, you can not use mysql-native right now with
> anything else than libevent
>
> https://github.com/mysql-d/mysql-native/issues/199
>
> Or you can just remove
>
> "subConfigurations": {
> "vibe-d:core": "libevent"
> },
>
> from ~/.dub/packages/mysql-native-2.3.0/mysql-native/dub.json

https://github.com/mysql-d/mysql-native/commit/ec851956e579bab8d00b1ae89a5344a2babce2e3
October 08, 2019
On Tuesday, 8 October 2019 at 11:26:24 UTC, Daniel Kozak wrote:
> On Tue, Oct 8, 2019 at 1:15 PM Daniel Kozak <kozzi11@gmail.com> wrote:
>> ...
>> It is known issue, you can not use mysql-native right now with
>> anything else than libevent
>>
>> https://github.com/mysql-d/mysql-native/issues/199
>>
>> Or you can just remove
>>
>> "subConfigurations": {
>> "vibe-d:core": "libevent"
>> },
>>
>> from ~/.dub/packages/mysql-native-2.3.0/mysql-native/dub.json
>
> https://github.com/mysql-d/mysql-native/commit/ec851956e579bab8d00b1ae89a5344a2babce2e3

Hi Daniel,

   As stated I have removed those line and ran the below command

dub build --force - No issue
dub test - failed with the below error

dub build --force
Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64.
dub 1.17.0: building configuration "library"...
Serializing composite type BuildRequirements which has no serializable fields
Serializing composite type BuildOptions which has no serializable fields
taggedalgebraic 0.11.4: building configuration "library"...
eventcore 0.8.46: building configuration "winapi"...
stdx-allocator 2.77.5: building configuration "library"...
vibe-core 1.7.0: building configuration "winapi"...
vibe-d:utils 0.8.6: building configuration "library"...
vibe-d:data 0.8.6: building configuration "library"...
mysql-native 2.3.0: building configuration "library"...
..\..\..\AppData\Local\dub\packages\mysql-native-2.3.0\mysql-native\source\mysql\connection.d(1192,27): Deprecation: function std.typecons.Nullable!(PreparedServerInfo).Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly.
..\..\..\AppData\Local\dub\packages\mysql-native-2.3.0\mysql-native\source\mysql\pool.d(115,13): Deprecation: constructor vibe.core.connectionpool.ConnectionPool!(Connection).ConnectionPool.this is deprecated - Use an @safe callback instead
..\..\..\AppData\Local\dub\packages\mysql-native-2.3.0\mysql-native\source\mysql\pool.d(361,27): Deprecation: function std.typecons.Nullable!(PreparedInfo).Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly.
..\..\..\AppData\Local\dub\packages\mysql-native-2.3.0\mysql-native\source\mysql\pool.d(378,26): Deprecation: function std.typecons.Nullable!(PreparedInfo).Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly.
..\..\..\AppData\Local\dub\packages\mysql-native-2.3.0\mysql-native\source\mysql\protocol\comms.d(418,3): Deprecation: foreach: loop index implicitly converted from size_t to ushort
hub ~master: building configuration "application"...
Linking...
Copying files for dub...

dub test
No source files found in configuration 'library'. Falling back to "dub -b unittest".
Performing "unittest" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64.
dub 1.17.0: target for configuration "library" is up to date.
taggedalgebraic 0.11.4: target for configuration "library" is up to date.
eventcore 0.8.46: target for configuration "winapi" is up to date.
stdx-allocator 2.77.5: target for configuration "library" is up to date.
vibe-core 1.7.0: target for configuration "winapi" is up to date.
vibe-d:utils 0.8.6: target for configuration "library" is up to date.
vibe-d:data 0.8.6: target for configuration "library" is up to date.
mysql-native 2.3.0: target for configuration "library" is up to date.
hub ~master: target for configuration "application" is up to date.
To force a rebuild of up-to-date targets, run again with --force.
Copying files for dub...
Running .\hub.exe
Program exited with code -1073741515

Error:
The code execution cannot proceed because msvcr100.dll was not found. Reinstalling the program  may fix this problem.

Execution HUB/source/app.d
import std.array : array;
import std.variant;
import mysql;
import std.stdio;

void main(string[] args)
{
	auto connectionStr = "host=dev.server1.com;port=3910;user=testuser;pwd=XXXX#;db=test";
	if(args.length > 1)
		connectionStr = args[1];
	Connection conn = new Connection(connectionStr);
	scope(exit) conn.close();

	ResultRange range = conn.query("SELECT host_name FROM `devservers`");
	Row row = range.front;
	Variant host_name = row[0];
	writeln(host_name);
}

Code Execution
cd HUB/source
rdmd app.d

app.d(3): Error: module `mysql` is in file 'mysql.d' which cannot be read
import path[0] = .
import path[1] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[2] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
Failed: ["C:\\D\\dmd2\\windows\\bin\\dmd.exe", "-v", "-o-", "app.d", "-I."]

From,
Vino.B

October 08, 2019
On Tuesday, 8 October 2019 at 14:02:03 UTC, Vino wrote:
> On Tuesday, 8 October 2019 at 11:26:24 UTC, Daniel Kozak wrote:
>> [...]
>
> Hi Daniel,
>
>    As stated I have removed those line and ran the below command
>
> [...]

Hi Daniel,

  Was able to resolve the dub test issue using the you tube video "https://www.youtube.com/watch?v=zvrf7nlq5Og", but not able to execute the code

Code Execution
cd HUB/source
app.d(3): Error: module `mysql` is in file 'mysql.d' which cannot be read
import path[0] = .
import path[1] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[2] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
Failed: ["C:\\D\\dmd2\\windows\\bin\\dmd.exe", "-v", "-o-","app.d", "-I."]

From,
Vino.B
October 08, 2019
On Tuesday, 8 October 2019 at 14:19:10 UTC, Vino wrote:
> On Tuesday, 8 October 2019 at 14:02:03 UTC, Vino wrote:
>> On Tuesday, 8 October 2019 at 11:26:24 UTC, Daniel Kozak wrote:
>>> [...]
>>
>> Hi Daniel,
>>
>>    As stated I have removed those line and ran the below command
>>
>> [...]
>
> Hi Daniel,
>
>   Was able to resolve the dub test issue using the you tube video "https://www.youtube.com/watch?v=zvrf7nlq5Og", but not able to execute the code
>
> Code Execution
> cd HUB/source
> app.d(3): Error: module `mysql` is in file 'mysql.d' which cannot be read
> import path[0] = .
> import path[1] = C:\D\dmd2\windows\bin\..\..\src\phobos
> import path[2] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
> Failed: ["C:\\D\\dmd2\\windows\\bin\\dmd.exe", "-v", "-o-","app.d", "-I."]
>
> From,
> Vino.B

You can not use rdmd on app.d with dependencies. You have to use dub. I am not sure what are you trying to do, but if you are able to build your app with dub, than you just can run it ./hub