[llvm-dev] error building LLVM opt tool under Cygwin

Eli Friedman via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 28 15:15:31 PST 2019

> -----Original Message-----
> From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of s n via llvm-dev
> Sent: Wednesday, February 27, 2019 9:31 PM
> To: llvm-dev at lists.llvm.org
> Subject: [EXT] [llvm-dev] error building LLVM opt tool under Cygwin
> Hello, I downloaded and built llvm-7.0.1 as per the instructions on the
> website docs. It seems that I can run many of the tools in build/bin (eg
> llvm-diff or count etc) with the exception of opt where I get "-bash:
> ./opt.exe: cannot execute binary file: Exec format error". I tried
> rebuilding just opt but still no luck. An ideas?

"Exec format error" means the file is corrupted, or not an executable.  Not sure how you would get that result without the build producing some sort of error message.  You could try "file opt.exe" to rule out the possibility that it's something that isn't an executable.  Maybe try cleaning and rebuilding.  Also, use a verbose build ("make VERBOSE=1" or "ninja -v") to see the command that actually produces opt.exe.

In general, Cygwin is not well tested; if you can, I'd recommend using mingw or Visual Studio instead.

> This is frustrating because opt is the tool I am most interested in, and
> the reason I built llvm at all instead of relying on the binary
> distribution.
> On a somewhat unrelated note, what does make install actually do. I ran
> "cmake -DMAKE_INSTALL_PREFIX=..../llvm-project/install -P
> cmake_Install.cmake" and it ran for a long time, but I couldn't tell
> what it actually did. eg I couldn't see any directory called
> ..../llvm=project/install"

The correct option is "-DCMAKE_INSTALL_PREFIX=..."; like you would expect, it's supposed to set the install prefix.


More information about the llvm-dev mailing list