各位程序员,我从这里下载了 crafty http://craftychess.com/crafty-25.0.zip并尝试从命令行在 Mac(安装了 Xcode)上构建它。
我执行 make -j unix-clang 并得到以下错误:
error: *.profraw: No such file or directory
make[1]: *** [unix-clang] Error 1
make: *** [default] Error 2
在 Makefile 中 unix-clang 是这样定义的:
unix-clang:
@/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-profdata merge -output=crafty.profdata *.profraw
$(MAKE) -j target=UNIX \
CC=clang CXX=clang++ \
opt='-DTEST -DINLINEASM -DPOPCNT -DCPUS=4' \
CFLAGS='-Wall -Wno-array-bounds -pipe -O3 \
-fprofile-instr-use=crafty.profdata' \
CXFLAGS='-Wall -Wno-array-bounds -pipe -O3 \
-fprofile-instr-use=crafty.profdata' \
LDFLAGS='$(LDFLAGS) -fprofile-use -lstdc++' \
crafty-make
有人能帮忙吗?
我尝试用谷歌搜索这个问题,但我发现的所有内容都是针对 Windows 的。
谢谢
1 月 13 日更新:
$ make profile 生成以下内容:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -j unix-clang-profile
/Applications/Xcode.app/Contents/Developer/usr/bin/make -j target=UNIX \
CC=clang CXX=clang++ \
opt='-DTEST -DINLINEASM -DPOPCNT -DCPUS=4' \
CFLAGS='-Wall -Wno-array-bounds -pipe -O3 \
-fprofile-instr-generate' \
CXFLAGS='-Wall -Wno-array-bounds -pipe -O3 \
-fprofile-instr-generate' \
LDFLAGS=' -fprofile-instr-generate -lstdc++ ' \
crafty-make
clang -Wall -Wno-array-bounds -pipe -O3
-fprofile-instr-generate -DTEST -DINLINEASM -DPOPCNT -DCPUS=4 -DUNIX -c crafty.c
clang++ -c -Wall -Wno-array-bounds -pipe -O3
-fprofile-instr-generate -DTEST -DINLINEASM -DPOPCNT -DCPUS=4 -DUNIX egtb.cpp
clang -fprofile-instr-generate -lstdc++ -o crafty crafty.o egtb.o -lm
Illegal instruction
make: *** [profile] Error 132
有什么想法吗?
最佳答案
使用:
$ make profile
$ ./crafty
看起来像是 Makefile 中的错误。
编辑:
您的 CPU 或操作系统不支持汇编代码,因此请更改 Makefile 中的以下行:
unix-clang:
...
opt='-DTEST -DINLINEASM -DPOPCNT -DCPUS=4' \
...
到
unix-clang:
...
opt='-DTEST -DCPUS=4' \
...
和改变
unix-clang-profile:
...
opt='-DTEST -DINLINEASM -DPOPCNT -DCPUS=4' \
...
到
unix-clang-profile:
...
opt='-DTEST -DCPUS=4' \
...
然后重做。您还应该阅读 Makefile 的顶部部分以获取其他信息。
关于c - 在 Mac 上构建狡猾的国际象棋引擎,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34754176/