www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - spawnvp on linux

reply "Carlos Santander B." <csantander619 gmail.com> writes:
Is spawnvp supported on linux? I have no idea what it does, but this is 
causing me problems (notice that I don't even use spawnvp):

//--------------------------------
import std.process;

void main ()
{
     system("ls");
}
//--------------------------------

$ dmd test.d
gcc test.o -o test -lphobos -lpthread -lm
/usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../libphobos.a(process.o)(.gnu.linkonce.t_D3std7process7spa
nvpFiAaAAaZi+0x44): 
En la función `_D3std7process7spawnvpFiAaAAaZi':
: undefined reference to `spawnvp'
collect2: ld devolvió el estado de salida 1
--- errorlevel 1
$

It looks like spawvnp can't be found by ld. This didn't happen with DMD 
0.112 (0.111) because it didn't have spawvp.

Using DMD 0.113 on Fedora Core 2, gcc version 3.3.3.

_______________________
Carlos Santander Bernal
Feb 17 2005
next sibling parent John Reimer <brk_6502 yahoo.com> writes:
On Thu, 17 Feb 2005 17:15:03 -0500, Carlos Santander B. wrote:

 Is spawnvp supported on linux? I have no idea what it does, but this is 
 causing me problems (notice that I don't even use spawnvp):
 
 //--------------------------------
 import std.process;
 
 void main ()
 {
      system("ls");
 }
 //--------------------------------
 
 $ dmd test.d
 gcc test.o -o test -lphobos -lpthread -lm
 /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../libphobos.a(process.o)(.gnu.linkonce.t_D3std7process7spa
nvpFiAaAAaZi+0x44): 
 En la función `_D3std7process7spawnvpFiAaAAaZi':
 : undefined reference to `spawnvp'
 collect2: ld devolvió el estado de salida 1
 --- errorlevel 1
 $
 
 It looks like spawvnp can't be found by ld. This didn't happen with DMD 
 0.112 (0.111) because it didn't have spawvp.
 
 Using DMD 0.113 on Fedora Core 2, gcc version 3.3.3.
 
 _______________________
 Carlos Santander Bernal
spawnvp() doesn't appear to be part of Linux. There are other calls that are available: fork() (the old *nix standby) , posix_spawn(), and posix_spawnp(). This looks like a bug in phobos. - John R.
Feb 17 2005
prev sibling parent reply Mark Junker <mjscod gmx.de> writes:
Carlos Santander B. schrieb:
 Is spawnvp supported on linux? I have no idea what it does, but this is 
 causing me problems (notice that I don't even use spawnvp):
I'm quite sure it exists.
 /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../libphobos.a(process.o)(.gnu.linkonce.t_D3std7process7spa
nvpFiAaAAaZi+0x44): 
 En la función `_D3std7process7spawnvpFiAaAAaZi':
 : undefined reference to `spawnvp'
Do you see the "FiAaAAaZi" after spawnvp? This indicates a C++ name mangling. spawnvp is a C function. libphobos (process.o) seems to use it without an extern "C" for the function declaration - or it's not declared at all. It really looks like a bug in libphobos (process.o). Regards, Mark
Feb 17 2005
next sibling parent reply John Reimer <brk_6502 yahoo.com> writes:
On Fri, 18 Feb 2005 00:54:48 +0100, Mark Junker wrote:

 Carlos Santander B. schrieb:
 Is spawnvp supported on linux? I have no idea what it does, but this is 
 causing me problems (notice that I don't even use spawnvp):
I'm quite sure it exists.
I couldn't find it on my Linux system. It doesn't appear in spawn.h or any other files or in the 'man' docs. Were you able to find it?
 /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../libphobos.a(process.o)(.gnu.linkonce.t_D3std7process7spa
nvpFiAaAAaZi+0x44): 
 En la función `_D3std7process7spawnvpFiAaAAaZi':
 : undefined reference to `spawnvp'
Do you see the "FiAaAAaZi" after spawnvp? This indicates a C++ name mangling. spawnvp is a C function. libphobos (process.o) seems to use it without an extern "C" for the function declaration - or it's not declared at all. It really looks like a bug in libphobos (process.o).
It's defined in std.c.process, and it's declared extern(C). I doesn't seem to exist on Linux, so that doesn't help. - John R.
Feb 17 2005
parent Mark Junker <mjscod gmx.de> writes:
John Reimer schrieb:

I'm quite sure it exists.
I couldn't find it on my Linux system. It doesn't appear in spawn.h or any other files or in the 'man' docs. Were you able to find it?
It seems that you're right. According to Borlands documentation, it only exists on Win32 ...
 It's defined in std.c.process, and it's declared extern(C).  I doesn't
 seem to exist on Linux, so that doesn't help.
Ah, now I understand ... sorry ... can it be that std.process.spawnvp() is declared but not defined for Linux? So the compiler should emit an error? Regards, Mark
Feb 17 2005
prev sibling parent "Carlos Santander B." <csantander619 gmail.com> writes:
Mark Junker wrote:
 Carlos Santander B. schrieb:
 /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../libphobos.a(process.o)(.gnu.linkonce.t_D3std7process7spa
nvpFiAaAAaZi+0x44): 
 En la función `_D3std7process7spawnvpFiAaAAaZi':
 : undefined reference to `spawnvp'
Do you see the "FiAaAAaZi" after spawnvp? This indicates a C++ name mangling. spawnvp is a C function. libphobos (process.o) seems to use it without an extern "C" for the function declaration - or it's not declared at all. It really looks like a bug in libphobos (process.o). Regards, Mark
Partially wrong: the "FiAaAAaZi" means D name mangling. What ld is saying that std.process.spawnvp() is looking for spawnvp(), which doesn't exist. That is correct, because std.process.spawnvp() calls std.c.process.spawvp() which is declared (as John said) as extern(C). _______________________ Carlos Santander Bernal
Feb 17 2005