On Sun, 2004-09-05 at 15:24, Phil Mattison wrote: > Here's something that doesn't seem to work on Linux > the way I would have expected: > > I wrote a small utility program in C++ using Kdevelop. It is a > console-mode program that uses only the stdio.h run-time > library. I want to run it via exec() from a PHP script on a > shared hosting web server. It all works fine on my > development machine but not the shared host. Neither > my machine nor the shared host are running PHP in safe > mode. When I run the custom program on the shared host > via their provided SSH shell login I get an error indicating that > the stdlibc++.so.5 shared library could not be found. Ignoring > version dependency problems for the moment, I would expect > that a simple console-mode program would be self-contained > and should not require any external libraries once compiled. Take this very simple program: #include int main(){ std::cout << "hello" << std::endl; return 0; } Compiled with `g++ ex.cpp` The results of ldd show that it definitely does depend on shared libraries: `ldd a.out` : libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40027000) libm.so.6 => /lib/tls/libm.so.6 (0x400e1000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40105000) libc.so.6 => /lib/tls/libc.so.6 (0x4010e000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) That means my simple example depends on these packages: libc6 libstdc++5 libgcc1 If I compiled it with the -static flag: `g++ ex.cpp -static`, ldd shows no dependencies (like you'd expect). The cost of this is an executable size of 1069155 bytes as opposed to 13976 for the dynamically linked one. > > So first, can anybody tell me if that is correct, or would a simple > "Hello World" program require run-time linkage with resident > libraries on its host system? (If it does, Linux loses many > points in my opinion.) My understanding is Win32 does the same thing. I haven't tested this theory but I do know there are a whole lot of "external dependencies" in the project settings of a VC++ project. > Of course the login shell on the shared > host is running in a chroot jail. > > Second, could the chroot jail be the cause of the problem? > This seems like a ridiculous obstacle to something that > should be very simple. I couldn't say. Bart --------------------------------------------------- PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us To subscribe, unsubscribe, or to change you mail settings: http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss