x86_64-w64-mingw32-g++: cannot execute binary file: Exec format error

17,748

The Mach-O executable format is not used or supported in Ubuntu. The standard executable format for Ubuntu (and Linux in general) is ELF.

Install the mingw32 package:

sudo apt-get install mingw32

(Also see this SO answer.)

Share:
17,748

Related videos on Youtube

muru
Author by

muru

Updated on September 18, 2022

Comments

  • muru
    muru over 1 year

    I have 64bit ubuntu virtual machine and a 64bit binary still getting the Exec format error.

    $ lsb_release -a    
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 14.04.1 LTS
    Release:    14.04
    Codename:   trusty   
    
    $ uname -a    
    Linux shrikant-VirtualBox 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux   
    
    $ file ../Mingw_instatllation/bin/x86_64-w64-mingw32-g++     
    ../Mingw_instatllation/bin/x86_64-w64-mingw32-g++: Mach-O 64-bit x86_64 executable    
    
    $ ../Mingw_instatllation/bin/x86_64-w64-mingw32-g++ test.cpp    
    bash: ../Mingw_instatllation/bin/x86_64-w64-mingw32-g++: cannot execute binary file: Exec format error
    

    Can someone either point me to a good mingw tool chain or give suggestion to solve this issue?