Skip to content

./a.out: cannot execute binary file: Exec format error #45

Open

Description

@masterneko

Makefile:

all: main.cpp
    @gcc -xc++ -lstdc++ -shared-libgcc main.cpp
    @echo Finished macOS compile

main.cpp:

#include <iostream>

int main()
{
    std::cout << "Hello world" << std::endl;
    return 0;
}
$ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=x86_64-apple-darwin  multiarch/crossbuild bash
$ make
Finished macOS compile
$ ./a.out
bash: ./a.out: cannot execute binary file: Exec format error

Activity

  1. tonisives commented on Feb 3, 2021

    @tonisives

    i specified the actualt image id:

    docker run --rm -v $(pwd):/workdir -e CROSS_TRIPLE=windows 846ea4d99d1a make helloworld

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions