digitalmars.D.learn - How do I fix the spawnvp link bug under Linux?
- Grzegorz Adam Hankiewicz <gradhanews ya.com> Dec 28 2005
- BCS <BCS_member pathlink.com> Dec 28 2005
- Grzegorz Adam Hankiewicz <gradhanews ya.com> Dec 29 2005
- Carlos Santander <csantander619 gmail.com> Dec 28 2005
- Grzegorz Adam Hankiewicz <gradhanews ya.com> Dec 29 2005
- John Reimer <terminal.node gmail.com> Dec 29 2005
I'm having trouble creating a binary from this source:
import std.stdio;
import std.process;
int main()
{
writefln("Hello world! I'm going to run something!");
system("something");
return 0;
}
$ dmd hello.d
gcc hello.o -o hello -lphobos -lpthread -lm
/usr/local/lib/libphobos.a(process.o): In function
`_D3std7process7spawnvpFiAaAAaZi':
std/process.d:(.gnu.linkonce.t_D3std7process7spawnvpFiAaAAaZi+0x44):
undefined reference to `spawnvp'
collect2: ld returned 1 exit status
--- errorlevel 1
Googling for "phobos spawnvp" just shows a message that this was
introduced on dmd 0.113, John R. acknowledged this as a bug, but
I'm using 0.141 and still get the same error. Is this going to be
fixed in a future release of dmd or do I have to get dirty and do it
myself? In which case, what do I have to do? The messages found by
Google don't show any step by step instructions on how to fix this.
Dec 28 2005
In article <pan.2005.12.28.22.01.42.983469 ya.com>, Grzegorz Adam Hankiewicz says...I'm having trouble creating a binary from this source: import std.stdio; import std.process; int main() { writefln("Hello world! I'm going to run something!"); system("something"); return 0; } $ dmd hello.d gcc hello.o -o hello -lphobos -lpthread -lm /usr/local/lib/libphobos.a(process.o): In function `_D3std7process7spawnvpFiAaAAaZi': std/process.d:(.gnu.linkonce.t_D3std7process7spawnvpFiAaAAaZi+0x44): undefined reference to `spawnvp' collect2: ld returned 1 exit status --- errorlevel 1 Googling for "phobos spawnvp" just shows a message that this was introduced on dmd 0.113, John R. acknowledged this as a bug, but I'm using 0.141 and still get the same error. Is this going to be fixed in a future release of dmd or do I have to get dirty and do it myself? In which case, what do I have to do? The messages found by Google don't show any step by step instructions on how to fix this.
I've never ben quite sure what was happening with this error but it always seems to have something to do with getting the right libraries passed to gcc. try this: gcc hello.o -o hello <path_to_dmd>/lib/libphobos.a -lpthread -lm
Dec 28 2005
El Wed, 28 Dec 2005 23:11:02 +0000, BCS escribió:$ dmd hello.d gcc hello.o -o hello -lphobos -lpthread -lm /usr/local/lib/libphobos.a(process.o): In function `_D3std7process7spawnvpFiAaAAaZi': std/process.d:(.gnu.linkonce.t_D3std7process7spawnvpFiAaAAaZi+0x44): undefined reference to `spawnvp' collect2: ld returned 1 exit status --- errorlevel 1
try this: gcc hello.o -o hello <path_to_dmd>/lib/libphobos.a -lpthread -lm
Same result. Unsurprising, since libphobos.a doesn't include any spawnvp code: [~/test/dmd/dmd/lib]$ nm libphobos.a |grep spawnvp 00000000 T _D3std7process7spawnvpFiAaAAaZi U spawnvp
Dec 29 2005
Grzegorz Adam Hankiewicz escribió:I'm having trouble creating a binary from this source: import std.stdio; import std.process; int main() { writefln("Hello world! I'm going to run something!"); system("something"); return 0; } $ dmd hello.d gcc hello.o -o hello -lphobos -lpthread -lm /usr/local/lib/libphobos.a(process.o): In function `_D3std7process7spawnvpFiAaAAaZi': std/process.d:(.gnu.linkonce.t_D3std7process7spawnvpFiAaAAaZi+0x44): undefined reference to `spawnvp' collect2: ld returned 1 exit status --- errorlevel 1 Googling for "phobos spawnvp" just shows a message that this was introduced on dmd 0.113, John R. acknowledged this as a bug, but I'm using 0.141 and still get the same error. Is this going to be fixed in a future release of dmd or do I have to get dirty and do it myself? In which case, what do I have to do? The messages found by Google don't show any step by step instructions on how to fix this.
Open std/process.d and std/c/process.d, and put version(Windows) around everything that starts with spawn. Then, recompile Phobos and copy it (libphobos.a) to the appropiate directory. -- Carlos Santander Bernal
Dec 28 2005
El Wed, 28 Dec 2005 22:16:06 -0500, Carlos Santander escribió:Open std/process.d and std/c/process.d, and put version(Windows) around everything that starts with spawn. Then, recompile Phobos and copy it (libphobos.a) to the appropiate directory.
Thanks, that fixes it.
Dec 29 2005
spawnvp doesn't exist on linux. see: http://www.digitalmars.com/d/archives/digitalmars/D/bugs/2994.html Carlos has the solution. :)
Dec 29 2005









Grzegorz Adam Hankiewicz <gradhanews ya.com> 