RejectedSoftware Forums

Sign up

Problem with getgrgid()

Hello!I'm using d-apt in order to install dmd and vibe (my OS - Debian Squeeze).

Problem:

Vibe refuses to start with the following reason:

/opt/vibe/source/vibe/core/args.d(50): Error: undefined identifier getgrgid, did you mean function getgruid?


Line 50 of args.d looks like:

enforce(getgrgid(gid) !is null, "Invalid group id!");


So i guess, dmd can't find the declaration of getgrgid while it parses this line.
Slightly above in the same module, I found the following:

static if( __traits(compiles, {import core.sys.posix.grp;}) ){
	import core.sys.posix.grp;
} else {
	extern(C){
		struct group
		{
			char*   gr_name;
			char*   gr_passwd;
			gid_t   gr_gid;
			char**  gr_mem;
		}
		group* getgrgid(gid_t);
		group* getgrnam(in char*);
	}
}

I can see that static if condition is satisfied and module just imports core.sys.posix.grp, in which i found the commented out declaration of getgrgid() and something :(

/*
struct group
{
    char*   gr_name;
    char*   gr_passwd;
    gid_t   gr_gid;
    char**  gr_mem;
}

group* getgrnam(in char*);
group* getgrgid(gid_t);
*/

Question:

This problem can be temporarily resolved in a number of ways (or crutches), but maybe there is already an optimal solution, or "developer recommendations" or just a sensible idea?

Thanks in advance.

P.S. Sorry for my english.

Re: Problem with getgrgid()

I had the same problem until I pulled vibe from the git repositories again. Maybe you should try it like that (instead of APT)?

It doesn't really have to be "installed". Move to your application's directory and simply run the vibe binary using a relative path (something like ../vibe.d/bin/vibe for example).

Re: Problem with getgrgid()

On Fri, 08 Mar 2013 21:55:05 GMT, Matej Nanut wrote:

I had the same problem until I pulled vibe from the git repositories again. Maybe you should try it like that (instead of APT)?

It doesn't really have to be "installed". Move to your application's directory and simply run the vibe binary using a relative path (something like ../vibe.d/bin/vibe for example).

Thanks for the suggestion.
I wanted to avoid non-package installation, but if i will not find another acceptable way, i will have to do so.

Re: Problem with getgrgid()

static if( __traits(compiles, {import core.sys.posix.grp;}) ){
	import core.sys.posix.grp;
} else {

In the current DMD, there is a typo in the declaration of getgrgid in Druntime (a fix is already committed). The workaround I used is to change the check to:

static if( __traits(compiles, {import core.sys.posix.grp; getgrgid(0);}) ){

This fix is in v0.7.13, but I think the Debian package is still at v0.7.11. So three possibilities come to mind:

  • Change the installed appmain.d file manually
  • Directly git clone the vibe.d repository instead of using the .deb package, as Matej suggested
  • Use DUB to build the project and put "vibe-d": ">=0.7.13" as a dependency in package.json

Personally, I would use the third option, as it makes all public DUB packages available for use and is a lot more powerful that the vibe tool.

Re: Problem with getgrgid()

Personally, I would use the third option, as it makes all public DUB packages available for use and is a lot more powerful that the vibe tool.

It doesn't yet have a .deb package though...

Re: Problem with getgrgid()

On Fri, 08 Mar 2013 22:13:20 GMT, Sönke Ludwig wrote:

static if( __traits(compiles, {import core.sys.posix.grp;}) ){
	import core.sys.posix.grp;
} else {

In the current DMD, there is a typo in the declaration of getgrgid in Druntime (a fix is already committed). The workaround I used is to change the check to:

static if( __traits(compiles, {import core.sys.posix.grp; getgrgid(0);}) ){

Thanx for explanation.

This fix is in v0.7.13, but I think the Debian package is still at v0.7.11. So three possibilities come to mind:

You're absolutely right.

  • Change the installed appmain.d file manually
  • Directly git clone the vibe.d repository instead of using the .deb package, as Matej suggested
  • Use DUB to build the project and put "vibe-d": ">=0.7.13" as a dependency in package.json

Personally, I would use the third option, as it makes all public DUB packages available for use and is a lot more powerful that the vibe tool.

Indeed, I think it's reasonable to use the DUB as a primary version management tool.

Thank You.