Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not use this repo with dub without it installing vibe.d #44

Closed
nomad-software opened this issue Jun 26, 2014 · 9 comments
Closed

Can not use this repo with dub without it installing vibe.d #44

nomad-software opened this issue Jun 26, 2014 · 9 comments

Comments

@nomad-software
Copy link

This is my current package.json:

{
    "name": "snap",
    "authors": ["Gary Willoughby"],
    "copyright": "Copyright (c) 2014 Gary Willoughby",
    "license": "MIT",
    "dependencies": {
        "mysql-native": ">=0.0.15"
    },
    "configurations": [
        {
            "name": "application",
            "targetType": "executable",
            "mainSourceFile": "source/main.d",
        },
    ],
}

When i build with the dub command i get this:

Fetching vibe-d 0.7.20...
Placing vibe-d 0.7.20 to /home/gary/.dub/packages/...
Fetching libevent ~master...
Placing libevent ~master to /home/gary/.dub/packages/...
Fetching mysql-native 0.0.15...
Placing mysql-native 0.0.15 to /home/gary/.dub/packages/...
Fetching openssl ~master...
Placing openssl ~master to /home/gary/.dub/packages/...
Fetching libev ~master...
Placing libev ~master to /home/gary/.dub/packages/...
Building vibe-d 0.7.20 configuration "libevent", build type debug.
Running dmd...
Warning: -version=VibeDefaultMain will be required in the future to use vibe.d's default main(). Please update your build scripts.
Building mysql-native 0.0.15 configuration "library", build type debug.
Running dmd...
Building snap ~master configuration "application", build type debug.
Compiling using dmd...
Warning: -version=VibeDefaultMain will be required in the future to use vibe.d's default main(). Please update your build scripts.
source/main.d(12): Error: only one main allowed
FAIL .dub/build/application-debug-linux.posix-x86_64-dmd-5528F0DEEAED55DF7F939E81C31333E8/ snap executable
Error executing command run: dmd failed with exit code 1

How can i completely disable vibe.d from being installed and/or being used with this library?

@Abscissa
Copy link

I'm not sure there's a good solution to this until dub gains support for optional dependencies. There's already a syntax for them in the dub.json format, but last I checked it was still unfinished or unimplemented.

@Abscissa
Copy link

In the meantime, I would just manually delete the vibe.d dependency in the dub.json of your local dub-managed checkout of mysql-native.

@nomad-software
Copy link
Author

Oh dear.

Also surely this dependency is the wrong way around? Instead of a database library with a Asynchronous I/O framework as a dependency surely it should be a Asynchronous I/O framework with a mysql database library as a dependency?

@Abscissa
Copy link

mysql-native optionally supports vibe.d's sockets as an alternative to phobos's sockets (for the sake of vibe.d-based programs that want to use mysql-native). In order to use vibe.d's sockets, mysql-native must import vibe.d. Thus the dependency. It should be an optional dependency, though (and it is optional if you're not using dub).

@Abscissa
Copy link

Also, sockets are more low-level than a DB client, so it makes sense for the DB client to depend on whatever provides the sockets. Vibe.d does makes this a little confusing though since it also provides functionality that's arguably higher-level than a DB client. But mysql-native doesn't use, or even import, any of the higher-level stuff in vibe.d, just the sockets.

@Abscissa
Copy link

Pardon the constant noise, but an extra related thought:

mysql-native's dependency on vibe.d probably could be eliminated outright (well, except for the integration tests) if vibe.d provided an API for its sockets that was structurally compatible with Phobos's sockets. Then, mysql-native could just leave the choice of sockets up to the user as a template parameter.

I wasn't able to do that when I added the vibe.d support because vibe.d's sockets use ("used"?) a different API. So I needed to directly wrap vibe.d's sockets within mysql-native.

But again, dub really does need optional dependencies anyway, so that's really the better solution.

@nomad-software
Copy link
Author

mysql-native optionally supports vibe.d's sockets as an alternative to phobos's sockets

Ah right. I've used mysql-native before in a few projects (buildint manually) but wanted to use dub this time. Looks like i'll continue building manually until these issues are sorted.

@s-ludwig
Copy link

@nomad-software: I've fixed the optional dependency issue now on DUB master (dlang/dub#359). To fix the initial issue, it would alternatively be possible to add "versions": ["VibeCustomMain"] to the package description.

Also surely this dependency is the wrong way around?

Not at all. Ideally, vibe.d should be a low level foundation and the DB drivers would be separate, higher level packages. I'll start to split it up into sub packages first, but that's the long term plan.

@nomad-software
Copy link
Author

I've updated to the latest version of dub and it works great, thanks. Also i didn't need to add the "versions": ["VibeCustomMain"] option, Vibe.d wasn't downloaded at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants