wood burning stoves 2.0*
The moose likes Linux / UNIX and the fly likes Mac OS X and SunOS problems running files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Mac OS X and SunOS problems running files" Watch "Mac OS X and SunOS problems running files" New topic
Author

Mac OS X and SunOS problems running files

Markus Olsson
Greenhorn

Joined: Nov 18, 2010
Posts: 12
Hi, this is my first time posting here so any suggestions on improvement is greatly appreciated.

Now to my problem:

I have received a c++ program from a third-party company.
To compile it, they have included a Makefile with a couple of basic commands. Now my local computer that I'm working on is using "Mac OS X 10.6.5" and my server is running "SunOS 5.11 snv_111b i86pc i386 i86pc (from uname -a)".

I can run the make install command on my mac and move the files to the server computer but there I am unable to run the program. The error I'm getting is either "cannot execute binary file" or "cannot execute [Exec format error]" depending on which user ofc.

I've found a lot of people saying to test use the "ldd" command, I've tried that as well with "unsupported or unknown file type" as response.
Also tried the file command, in mac it returns: "Mach-O 64-bit executable x86_64" and on my SunOS server just "data".

I am unable to run the make install command on the server due to "make: Fatal error: Don't know how to make target".

I'm guessing that when I'm running the Makefile on my mac it compiles the program for mac somehow, but can't understand why I can't run the Makefile on the server.

I need to somehow either be able to compile it on the server or compile it for another os on my local computer?
An erorr I'm getting when trying to run the Makefile with a different command is: "sh: line 1: /usr/bin/g++: not found
*** Error code 127
".

I currently do not have the root password for the server.
I haven't been working with unix-based system very long.

*Edit*
To clearify what I'm wondering is,

Is it so that a Mach-O file is not supposed to be able to run on SunOS? Is it something I can easily change or does it have to be compiled on SunOS to be run on SunOS?
Do I need g++ to run a file compiled by it?
I can't find the g++ in the /bin/ on the server, does SunOS use that as standard or does it use something else?

Can I assume that if I'd told the server administrator to install g++ I'd be able to run the makefile compile the program and then I'd be able to run it? Or am I missing something completely here?

Also I'd like to get a greater understanding for how these things actually work.
Jason Cone
Greenhorn

Joined: Jul 21, 2004
Posts: 25
Markus Olsson wrote:I need to somehow either be able to compile it on the server or compile it for another os on my local computer?

Right. Compiling it on the server is probably easier (by far).

An erorr I'm getting when trying to run the Makefile with a different command is: "sh: line 1: /usr/bin/g++: not found
*** Error code 127
".

That means the GNU compiler isn't installed, or isn't in the expected location. I'm not familiar with SunOS 5.11, but you might check in /usr/sfw/bin and /usr/local/bin. If it's really not installed, you'll need to download and install gcc.
Markus Olsson
Greenhorn

Joined: Nov 18, 2010
Posts: 12
I don't seem to have a /usr/local/ directory at all. And I found no g++ in the /usr/sfw/bin either.
I tried a "find ~ -type f | grep g++" and found nothing so I assume I don't have g++.
Is there any other standard compilations I can use instead? Or is installing g++ the only / best way to do this?

Thanks for the quick response!
Jason Cone
Greenhorn

Joined: Jul 21, 2004
Posts: 25
Markus Olsson wrote:Is it so that a Mach-O file is not supposed to be able to run on SunOS?

You can only run a compiled program on the architecture for which it is compiled.

Is it something I can easily change or does it have to be compiled on SunOS to be run on SunOS?

You can't change it; you need to compile it for SunOS and that particular architecture.

Do I need g++ to run a file compiled by it?

No.

Can I assume that if I'd told the server administrator to install g++ I'd be able to run the makefile compile the program and then I'd be able to run it? Or am I missing something completely here?

If gcc/g++ is installed you should be able to run the makefile and compile the program. You might need to tweak some of the makefile options (like path locations) if they are different from those on the computer you're compiling on.
Jason Cone
Greenhorn

Joined: Jul 21, 2004
Posts: 25
Markus Olsson wrote:Is there any other standard compilations I can use instead? Or is installing g++ the only / best way to do this?

Installing gcc/g++ is probably your best bet.
Markus Olsson
Greenhorn

Joined: Nov 18, 2010
Posts: 12
Thanks Jason for all those good and quick replies!
You've been of great assistance.
Regards,
Markus
Jason Cone
Greenhorn

Joined: Jul 21, 2004
Posts: 25
Markus Olsson wrote:Thanks Jason for all those good and quick replies!
You've been of great assistance.
Regards,
Markus

You're welcome. Good luck!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mac OS X and SunOS problems running files
 
Similar Threads
ERROR in PlasmaCloud.java double displacement = StdRandom.gaussian(0, stddev);
Problem with PATH variable: javac: file not found error
compiler help
JDK1.3 installation within windows 2000 advance server
Compile and run java program in Macintosh