digitalmars.D - undefined reference to `execvpe'
- Ameer Armaly (4/4) Aug 19 2004 Hi all.
- kinghajj (4/8) Aug 19 2004 I get that too. I don't know why: the prototype for execvpe is in std.c....
- Russ Lewis (54/66) Aug 20 2004 Phobos uses execvpe(), but it isn't implemented by glibc, at least on my...
- Matthew (3/51) Aug 20 2004 Russ, I'll take this as a basis for a permanent fix, if that's ok with y...
- Russ Lewis (3/89) Aug 20 2004 I don't mind, but I can't guarantee it isn't buggy. In particular, I
- Matthew (5/94) Aug 20 2004 No worries, mate. I just meant I'd steal the idea. I'm a pathological re...
- Jonathan Leffler (18/59) Aug 20 2004 Wouldn't it be easier to do it as 'execvp() setting the environment'?
- Matthew (3/59) Aug 20 2004 Indeed. But I don't think D supports that. (Of course, I could have prov...
- Matthew (4/93) Aug 20 2004 I'm posting the link to an alpha on the bugs ng shortly. If you can do a...
- Matthew (4/15) Aug 20 2004 It's my fault. I didn't do the due diligence for ensuring that the APIs ...
Hi all. I'm trying to use the execv function in std.process, but when the program links, it gives me an undefined reference to `execvpe' message. This is using the latest dmd on a linux system.
Aug 19 2004
In article <Pine.LNX.4.61.0408191703500.3453 debian>, Ameer Armaly says...Hi all. I'm trying to use the execv function in std.process, but when the program links, it gives me an undefined reference to `execvpe' message. This is using the latest dmd on a linux system.I get that too. I don't know why: the prototype for execvpe is in std.c.process (which std.process imports)... I even tried re-compiling the library, but it still failed.
Aug 19 2004
kinghajj wrote:In article <Pine.LNX.4.61.0408191703500.3453 debian>, Ameer Armaly says...Phobos uses execvpe(), but it isn't implemented by glibc, at least on my system. execvpe() is just like execve(), except that it searches through your $PATH to find the executable. So I added this function to my program, which seemed to make it work. Feel free to fix the code if you find any bugs: // HACK HACK HACK // phobos uses execvpe(), which is not implemented in glibc. This // implementation provides what is missing. /* execvpe() - execve() with PATH search */ import std.c.process; import std.c.stdlib; import std.string; extern (C) int execvpe(char *file_arg, char **argv, char **envp) { int ret; char[] file = file_arg[0..strlen(file_arg)]; char[] path; char[] next; char *temp = getenv("PATH"); path = temp[0..strlen(temp)]; while(path.length > 0) { temp = strchr(path, ':'); if(temp == null) next.length = 0; else { next = path[temp-cast(char*)path+1..length]; path = path[0..temp-cast(char*)path]; } // If the exectuable is found, then this never returns. // But if the executable is not found, then this returns // some nonzero value. ret = execve(path~"/"~file, argv, envp); path = next; } return ret; }Hi all. I'm trying to use the execv function in std.process, but when the program links, it gives me an undefined reference to `execvpe' message. This is using the latest dmd on a linux system.I get that too. I don't know why: the prototype for execvpe is in std.c.process (which std.process imports)... I even tried re-compiling the library, but it still failed.
Aug 20 2004
Russ, I'll take this as a basis for a permanent fix, if that's ok with you? (I've some ideas for making it a bit neater, and we would only implement the D version, but essentially it's a sound idea.) "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:cg4udj$b0j$1 digitaldaemon.com...kinghajj wrote:In article <Pine.LNX.4.61.0408191703500.3453 debian>, Ameer Armaly says...Phobos uses execvpe(), but it isn't implemented by glibc, at least on my system. execvpe() is just like execve(), except that it searches through your $PATH to find the executable. So I added this function to my program, which seemed to make it work. Feel free to fix the code if you find any bugs: // HACK HACK HACK // phobos uses execvpe(), which is not implemented in glibc. This // implementation provides what is missing. /* execvpe() - execve() with PATH search */ import std.c.process; import std.c.stdlib; import std.string; extern (C) int execvpe(char *file_arg, char **argv, char **envp) { int ret; char[] file = file_arg[0..strlen(file_arg)]; char[] path; char[] next; char *temp = getenv("PATH"); path = temp[0..strlen(temp)]; while(path.length > 0) { temp = strchr(path, ':'); if(temp == null) next.length = 0; else { next = path[temp-cast(char*)path+1..length]; path = path[0..temp-cast(char*)path]; } // If the exectuable is found, then this never returns. // But if the executable is not found, then this returns // some nonzero value. ret = execve(path~"/"~file, argv, envp); path = next; } return ret; }Hi all. I'm trying to use the execv function in std.process, but when the program links, it gives me an undefined reference to `execvpe' message. This is using the latest dmd on a linux system.I get that too. I don't know why: the prototype for execvpe is in std.c.process (which std.process imports)... I even tried re-compiling the library, but it still failed.
Aug 20 2004
I don't mind, but I can't guarantee it isn't buggy. In particular, I think that I should have added ~\0 on the execve() call. Right? Matthew wrote:Russ, I'll take this as a basis for a permanent fix, if that's ok with you? (I've some ideas for making it a bit neater, and we would only implement the D version, but essentially it's a sound idea.) "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:cg4udj$b0j$1 digitaldaemon.com...kinghajj wrote:In article <Pine.LNX.4.61.0408191703500.3453 debian>, Ameer Armaly says...Phobos uses execvpe(), but it isn't implemented by glibc, at least on my system. execvpe() is just like execve(), except that it searches through your $PATH to find the executable. So I added this function to my program, which seemed to make it work. Feel free to fix the code if you find any bugs: // HACK HACK HACK // phobos uses execvpe(), which is not implemented in glibc. This // implementation provides what is missing. /* execvpe() - execve() with PATH search */ import std.c.process; import std.c.stdlib; import std.string; extern (C) int execvpe(char *file_arg, char **argv, char **envp) { int ret; char[] file = file_arg[0..strlen(file_arg)]; char[] path; char[] next; char *temp = getenv("PATH"); path = temp[0..strlen(temp)]; while(path.length > 0) { temp = strchr(path, ':'); if(temp == null) next.length = 0; else { next = path[temp-cast(char*)path+1..length]; path = path[0..temp-cast(char*)path]; } // If the exectuable is found, then this never returns. // But if the executable is not found, then this returns // some nonzero value. ret = execve(path~"/"~file, argv, envp); path = next; } return ret; }Hi all. I'm trying to use the execv function in std.process, but when the program links, it gives me an undefined reference to `execvpe' message. This is using the latest dmd on a linux system.I get that too. I don't know why: the prototype for execvpe is in std.c.process (which std.process imports)... I even tried re-compiling the library, but it still failed.
Aug 20 2004
No worries, mate. I just meant I'd steal the idea. I'm a pathological rewriter. ;) Are you, or is anyone else, up for testing this on Linux? (I'm yet to set up D on my linux box, and I am woefully short on time. Of course, this probably means I shouldn't write any more multi-platform code before I do ...<G>) "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:cg62sj$uof$1 digitaldaemon.com...I don't mind, but I can't guarantee it isn't buggy. In particular, I think that I should have added ~\0 on the execve() call. Right? Matthew wrote:neater,Russ, I'll take this as a basis for a permanent fix, if that's ok with you? (I've some ideas for making it a bitand we would only implement the D version, but essentially it's a sound idea.) "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:cg4udj$b0j$1 digitaldaemon.com...kinghajj wrote:In article <Pine.LNX.4.61.0408191703500.3453 debian>, Ameer Armaly says...Phobos uses execvpe(), but it isn't implemented by glibc, at least on my system. execvpe() is just like execve(), except that it searches through your $PATH to find the executable. So I added this function to my program, which seemed to make it work. Feel free to fix the code if you find any bugs: // HACK HACK HACK // phobos uses execvpe(), which is not implemented in glibc. This // implementation provides what is missing. /* execvpe() - execve() with PATH search */ import std.c.process; import std.c.stdlib; import std.string; extern (C) int execvpe(char *file_arg, char **argv, char **envp) { int ret; char[] file = file_arg[0..strlen(file_arg)]; char[] path; char[] next; char *temp = getenv("PATH"); path = temp[0..strlen(temp)]; while(path.length > 0) { temp = strchr(path, ':'); if(temp == null) next.length = 0; else { next = path[temp-cast(char*)path+1..length]; path = path[0..temp-cast(char*)path]; } // If the exectuable is found, then this never returns. // But if the executable is not found, then this returns // some nonzero value. ret = execve(path~"/"~file, argv, envp); path = next; } return ret; }Hi all. I'm trying to use the execv function in std.process, but when the program links, it gives me an undefined reference to `execvpe' message. This is using the latest dmd on a linux system.I get that too. I don't know why: the prototype for execvpe is in std.c.process (which std.process imports)... I even tried re-compiling the library, but it still failed.
Aug 20 2004
Matthew wrote:No worries, mate. I just meant I'd steal the idea. I'm a pathological rewriter. ;) Are you, or is anyone else, up for testing this on Linux? (I'm yet to set up D on my linux box, and I am woefully short on time. Of course, this probably means I shouldn't write any more multi-platform code before I do ...<G>) "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:cg62sj$uof$1 digitaldaemon.com...Wouldn't it be easier to do it as 'execvp() setting the environment'? In C (sorry, I'm still more fluent in that): extern char **environ; int execvp(char *file_arg, char **argv, char **envp) { char **old_env = environ; environ = envp; execvp(file_arg, argv); // Oops - must have failed! environ = old_env; return(-1); } FYI: environ is the one variable defined by POSIX with no standard header. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler earthlink.net, jleffler us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/I don't mind, but I can't guarantee it isn't buggy. In particular, I think that I should have added ~\0 on the execve() call. Right? Matthew wrote:Russ, I'll take this as a basis for a permanent fix, if that's ok with you? (I've some ideas for making it a bit neater, and we would only implement the D version, but essentially it's a sound idea.) "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote:kinghajj wrote:In article <Pine.LNX.4.61.0408191703500.3453 debian>, Ameer Armaly says...Phobos uses execvpe(), but it isn't implemented by glibc, at least on my system. execvpe() is just like execve(), except that it searches through your $PATH to find the executable. So I added this function to my program, which seemed to make it work. Feel free to fix the code if you find any bugs: // HACK HACK HACK // phobos uses execvpe(), which is not implemented in glibc. // This implementation provides what is missing. /* execvpe() - execve() with PATH search */I'm trying to use the execv function in std.process, but when the program links, it gives me an undefined reference to `execvpe' message. This is using the latest dmd on a linux system.I get that too. I don't know why: the prototype for execvpe is in std.c.process (which std.process imports)... I even tried re-compiling the library, but it still failed.
Aug 20 2004
"Jonathan Leffler" <jleffler earthlink.net> wrote in message news:cg6e21$146m$1 digitaldaemon.com...Matthew wrote:Indeed. But I don't think D supports that. (Of course, I could have provided execvpe() in C, but that'd have been more hassle.) Nonetheless, it's worth keeping mind. ThanksNo worries, mate. I just meant I'd steal the idea. I'm a pathological rewriter. ;) Are you, or is anyone else, up for testing this on Linux? (I'm yet to set up D on my linux box, and I am woefully short on time. Of course, this probably means I shouldn't write any more multi-platform code before I do ...<G>) "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:cg62sj$uof$1 digitaldaemon.com...Wouldn't it be easier to do it as 'execvp() setting the environment'? In C (sorry, I'm still more fluent in that): extern char **environ; int execvp(char *file_arg, char **argv, char **envp) { char **old_env = environ; environ = envp; execvp(file_arg, argv); // Oops - must have failed! environ = old_env; return(-1); } FYI: environ is the one variable defined by POSIX with no standard header.I don't mind, but I can't guarantee it isn't buggy. In particular, I think that I should have added ~\0 on the execve() call. Right? Matthew wrote:Russ, I'll take this as a basis for a permanent fix, if that's ok with you? (I've some ideas for making it a bit neater, and we would only implement the D version, but essentially it's a sound idea.) "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote:kinghajj wrote:In article <Pine.LNX.4.61.0408191703500.3453 debian>, Ameer Armaly says...Phobos uses execvpe(), but it isn't implemented by glibc, at least on my system. execvpe() is just like execve(), except that it searches through your $PATH to find the executable. So I added this function to my program, which seemed to make it work. Feel free to fix the code if you find any bugs: // HACK HACK HACK // phobos uses execvpe(), which is not implemented in glibc. // This implementation provides what is missing. /* execvpe() - execve() with PATH search */I'm trying to use the execv function in std.process, but when the program links, it gives me an undefined reference to `execvpe' message. This is using the latest dmd on a linux system.I get that too. I don't know why: the prototype for execvpe is in std.c.process (which std.process imports)... I even tried re-compiling the library, but it still failed.
Aug 20 2004
I'm posting the link to an alpha on the bugs ng shortly. If you can do a test, and report back to the bugs ng, that'd be great! "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:cg62sj$uof$1 digitaldaemon.com...I don't mind, but I can't guarantee it isn't buggy. In particular, I think that I should have added ~\0 on the execve() call. Right? Matthew wrote:neater,Russ, I'll take this as a basis for a permanent fix, if that's ok with you? (I've some ideas for making it a bitand we would only implement the D version, but essentially it's a sound idea.) "Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:cg4udj$b0j$1 digitaldaemon.com...kinghajj wrote:In article <Pine.LNX.4.61.0408191703500.3453 debian>, Ameer Armaly says...Phobos uses execvpe(), but it isn't implemented by glibc, at least on my system. execvpe() is just like execve(), except that it searches through your $PATH to find the executable. So I added this function to my program, which seemed to make it work. Feel free to fix the code if you find any bugs: // HACK HACK HACK // phobos uses execvpe(), which is not implemented in glibc. This // implementation provides what is missing. /* execvpe() - execve() with PATH search */ import std.c.process; import std.c.stdlib; import std.string; extern (C) int execvpe(char *file_arg, char **argv, char **envp) { int ret; char[] file = file_arg[0..strlen(file_arg)]; char[] path; char[] next; char *temp = getenv("PATH"); path = temp[0..strlen(temp)]; while(path.length > 0) { temp = strchr(path, ':'); if(temp == null) next.length = 0; else { next = path[temp-cast(char*)path+1..length]; path = path[0..temp-cast(char*)path]; } // If the exectuable is found, then this never returns. // But if the executable is not found, then this returns // some nonzero value. ret = execve(path~"/"~file, argv, envp); path = next; } return ret; }Hi all. I'm trying to use the execv function in std.process, but when the program links, it gives me an undefined reference to `execvpe' message. This is using the latest dmd on a linux system.I get that too. I don't know why: the prototype for execvpe is in std.c.process (which std.process imports)... I even tried re-compiling the library, but it still failed.
Aug 20 2004
It's my fault. I didn't do the due diligence for ensuring that the APIs were available on Linux. It's been noted, and is on the list for a fix. (Which might be to remove it!) Alternatively, we might do a custom search, as has been suggested by Russ. (I'm just looking at that now.) "kinghajj" <kinghajj_member pathlink.com> wrote in message news:cg358e$2hh6$1 digitaldaemon.com...In article <Pine.LNX.4.61.0408191703500.3453 debian>, Ameer Armaly says...Hi all. I'm trying to use the execv function in std.process, but when the program links, it gives me an undefined reference to `execvpe' message. This is using the latest dmd on a linux system.I get that too. I don't know why: the prototype for execvpe is in std.c.process (which std.process imports)... I even tried re-compiling the library, but it still failed.
Aug 20 2004