简体   繁体   English

-bash:opt:在MAC OS X Yosemite中找不到命令

[英]-bash: opt: command not found in MAC OS X Yosemite

I am trying to run a LLVM pass and have the following version of gcc: 我正在尝试运行LLVM传递,并具有以下版本的gcc:

Configured with: 配置有:

-- prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

I downloaded the LLVM 3.2 source from the official site and have that unzipped in my project folder. 我从官方站点下载了LLVM 3.2源码,并将其解压缩到我的项目文件夹中。

From the project folder I am trying to run the following command: 从项目文件夹中,我试图运行以下命令:

opt -load /Users/jigs/Downloads/CS_298/llvm-3.1.src/lib/Transforms/LLVMHello.dylib -hello -S morph_1.s mul -o=morph_output.s

I get an error saying opt does not exist. 我收到一条错误消息,说opt不存在。 I am pretty sure opt is a part of LLVM source but it does not work. 我很确定opt是LLVM源代码的一部分,但是它不起作用。

The opt tool should appear in the bin directory after building (yours will be version 3.xx) , so I believe you are looking in the wrong place altogether. opt工具应该在构建后出现在bin目录中(您的版本将是3.xx) ,所以我相信您的位置完全错误。 The opt in tools is a directory, so that's certainly not going to do much for you. opt工具是一个目录,因此对您来说当然不会做太多事情。

/llvm-3.7.0.src/build/bin

$ ./opt -version

LLVM (http://llvm.org/):
  LLVM version 3.7.0
  DEBUG build with assertions.
  Built Sep  8 2015 (17:54:06).
  Default target: x86_64-apple-darwin14.5.0
  Host CPU: ivybridge

If you don't have a bin directory present after compiling/building from source then something likely isn't correct within your makefile perhaps. 如果从源编译/构建后没有bin目录,则可能是您的makefile某些内容不正确。

TIP : Often you can tell where the executables are that were built by looking at the most recently modified directory within the source tree. 提示 :通常,您可以通过查看源代码树中最近修改的目录来判断可执行文件的生成位置。 Also, I think the easiest and most hassle free way to build LLVM from source is to use CMake — it conveniently includes a CMakeLists.txt config. 另外,我认为从源代码构建LLVM的最简单,最轻松的方法是使用CMake它方便地包含CMakeLists.txt配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM