首页 > OS X编译bochs报错 [configure: error: C compiler cannot create executables]

OS X编译bochs报错 [configure: error: C compiler cannot create executables]

根据这个链接做安装前的配置

sh .conf.macosx后出现以下信息
根据google到的信息,缺少command line tools,已经执行xcode-select --install并完成安装。

gcc版本不对? 缺乏库?

checking build system type... x86_64-apple-darwin13.1.0
checking host system type... x86_64-apple-darwin13.1.0
checking target system type... x86_64-apple-darwin13.1.0
checking if you are configuring for another platform... no
checking for standard CFLAGS on this platform... -fpascal-strings -fno-common -Wno-four-char-constants -Wno-unknown-pragmas -Dmacintosh
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/myName/Desktop/bochs-2.6':
configure: error: C compiler cannot create executables
See `config.log' for more details

不知如何提取config.log的有效信息,直接将文件挂在这里了


brew安装gcc,设置环境变量CC为gcc试试。brew有多个gcc的版本可以选择,4.8,4.7,选择一个好了,如果还出错,继续贴log吧


试试这个:
CFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" ./configure ...
如果还是不行就试试:
CC='clang -Wno-error=unused-command-line-argument-hard-error-in-future' ./configure ...

不过话说回来,如果你要装bochs,最好用Homebrew,装好这个之后用brew install bochs就行了。


configure:3691: checking whether the C compiler works
configure:3713: gcc -arch i386 -m32 -pipe -O3 -I/sw/include -fomit-frame-pointer -finline-functions -falign-loops=16 -falign-jumps=16 -falign-functions=16 -falign-labels=16 -falign-loops-max-skip=15 -falign-jumps-max-skip=15 -fprefetch-loop-arrays  -fpascal-strings -fno-common -Wno-four-char-constants -Wno-unknown-pragmas -Dmacintosh  -fpascal-strings -fno-common -Wno-four-char-constants -Wno-unknown-pragmas -Dmacintosh -arch i386 -m32 -L/sw/lib conftest.c  >&5
clang: error: unknown argument: '-falign-loops=16' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: error: unknown argument: '-falign-jumps=16' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: error: unknown argument: '-falign-labels=16' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: error: unknown argument: '-falign-loops-max-skip=15' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: error: unknown argument: '-falign-jumps-max-skip=15' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
configure:3717: $? = 1
configure:3755: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3760: error: in `/Users/rahn/Desktop/bochs-2.6':
configure:3762: error: C compiler cannot create executables

你的 gcc 实际上是 clang。configure 脚本给了一个它不支持的参数过去。可能是版本的问题。你可以试试 CFLAGS='-Wunused-command-line-argument-hard-error-in-future' ./configure

或者把 CC 设置成 clang 试试?


我觉得是缺少一些以来库,但我无法给出具体是哪些东西。
根据检索,你可以先尝试安装:
brew install sdl
然后记得在你的编译目录里运行:
make distclean
再重新编译安装。

【热门文章】
【热门文章】