views:

78

answers:

3

Hello,

I have a following problem: I compiled my application on Linux Ubuntu 9.10 using CodeBlocks. It is a C program (which uses few libraries, like libmysql, jasper...) I copied the compiled program to a remote system running Debian 2.6.18, chmodded +x the application but when calling ./my_app bash still says "No such file or directory"

Do I need to compile my program at the target system? Im sure all libraries the program needs are installed at the target system.

Thanks for any advice.

+2  A: 

You are probably missing a shared library on your target system. Run ldd <binary name> (which lists the required dynamic libraries) on your binary and check if the libraries listed exist on your target machine.

Hassan Syed
Is bash raising the error in such case?
Enrico Carlesso
Well it would be a possible error message as the working directory is part of the search path for a library.
Hassan Syed
I tried LDD, but it says not a dynamic executable. So what does this mean?
NumberFour
@NumberFour: that sounds like the file has been corrupted. Run "file" on it, and compare its output to what the machine where you built it says. You could also run md5sum on it in both locations, to see if the binary has changed.
unwind
I ran the md5sum on both files in Ubuntu and Debian, both checksums are same... so the file is not corrupted as I can run it on Ubuntu.
NumberFour
Are you using the same toolchain (or compatible toolchains) on both platforms ? I remeber that GCC 3 and GCC 4 were incompatible.
Hassan Syed
+1  A: 

I am pretty much sure the problem has nothing to do with the libraries (you'd have got a different error message).

Make sure your program doesn't attempt to open any files that do not exist on the target system. It could do that, and then fail silently with the only "No such file ... " message.

Roman D
The program would fail with a different error if it couldn't find something. And at least it would print something to the output... its just not executed at all.The fact is Im trying to execute it through the SSH (Putty) console, but that might not be a problem I suppose.
NumberFour
OK, but in case of a missing library it should have failed with a different error, too.SSH should not be the root cause as well. It did work for me a million times...
Roman D
+1  A: 

Your diagnostic attempt (LDD) and your reported error messages (no such file, not a dynamic executable) aren't very helpful. The output of "file my_app" would probably be more indicative. But you needn't go to the effort. From a person claimng to speak for Ubuntu in the Wiki:

A lot has been said about the fact that Debian is not binary-compatible with Ubuntu.
...
Just to be clear, I'll say it again, for the record. We don't aim for "binary compatibility" with any other distribution. Why? ...
In short, because we believe in Free Software as a collaborative process focused on SOURCE CODE, and consider it superior to the proprietary process which is focused on specific applications and binary bits.

So, yes, you do need to re-compile.

gary
So re-compiling was the only way apparently. Thanks for your answer.
NumberFour