Malformed Mach-o on recently compiled binaries

Discussion in 'Mac Programming' started by cruxyl, Feb 21, 2011.

  1. cruxyl macrumors newbie

    Joined:
    Feb 21, 2011
    #1
    I am running OSX 10.6.6 with xcode 3.2.4. I have been creating c++ source and compiling it with g++ on this machine (successfully) for several months. I haven't compiled anything for a week or two until today; when I tried to execute the binary (which compiled fine), I get a "Malformed Mach-o file" message. I compiled several other source files (that had previously compiled and executed fine) and they also failed with the Malformed message. Binaries that I'd previously compiled continue to execute fine.

    lipo -info on the (nix) binary returns this message ...

    Non-fat file: nix is architecture: x86_64

    What's the problem and how do I resolve it?
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    I dont know, but perhaps try the following.

    Try to compile and run the simplest of hello world C++ programs. Try to compile and run the simplest of hello world C programs.

    Confirm the path of g++ with "which g++". Do you have any cross-compilers installed? What happens if instead of g++ you explicitly use "/usr/bin/g++".

    Try completely removing Xcode with "sudo /Developer/Library/uninstall-devtools --mode=all" and reinstalling Xcode.
     
  3. cruxyl thread starter macrumors newbie

    Joined:
    Feb 21, 2011
    #3
    Thanks. Compiled a helloworld.c pgm and got same error.
    Which g++ -> /usr/bin/g++.
    I'm going to uninstall Xcode and install Xcode 3.2.5.
     
  4. cruxyl thread starter macrumors newbie

    Joined:
    Feb 21, 2011
    #4
    Fixed. Problem in a script that set the "-c" option on the GCC compiler. This script worked previously; so the behavior must have changed ...
     

Share This Page