使用 LLVM Clang 编译 NAS 并行基准测试会出错

Compiling NAS Parallel Benchmarks with LLVM Clang gives error

我正在 Linux 并尝试编译 NPB 套件(C 版)link 使用 LLVM Clang 编译器和 LLVM OpenMP 运行时库。

我像那样编辑了包含的配置文件 "make.def" 以使用 clang:

#---------------------------------------------------------------------------
#
#                SITE- AND/OR PLATFORM-SPECIFIC DEFINITIONS. 
#
#---------------------------------------------------------------------------

#---------------------------------------------------------------------------
# Items in this file will need to be changed for each platform.
# (Note these definitions are inconsistent with NPB2.1.)
#---------------------------------------------------------------------------

#---------------------------------------------------------------------------
# Parallel C:
#
# For IS, which is in C, the following must be defined:
#
# CC         - C compiler 
# CFLAGS     - C compilation arguments
# C_INC      - any -I arguments required for compiling C 
# CLINK      - C linker
# CLINKFLAGS - C linker flags
# C_LIB      - any -L and -l arguments required for linking C 
#
# compilations are done with $(CC) $(C_INC) $(CFLAGS) or
#                            $(CC) $(CFLAGS)
# linking is done with       $(CLINK) $(C_LIB) $(CLINKFLAGS)
#---------------------------------------------------------------------------

#---------------------------------------------------------------------------
# This is the C compiler used for OpenMP programs
#---------------------------------------------------------------------------
CC = clang-7
# This links C programs; usually the same as ${CC}
CLINK   = clang-7

#---------------------------------------------------------------------------
# These macros are passed to the linker 
#---------------------------------------------------------------------------
C_LIB  = -L/usr/local/lib

#---------------------------------------------------------------------------
# These macros are passed to the compiler 
#---------------------------------------------------------------------------
C_INC = -I../common -I/usr/local/include

#---------------------------------------------------------------------------
# Global *compile time* flags for C programs
#---------------------------------------------------------------------------
CFLAGS  = -fopenmp -O3
# CFLAGS = -g

#---------------------------------------------------------------------------
# Global *link time* flags. Flags for increasing maximum executable 
# size usually go here. 
#---------------------------------------------------------------------------
CLINKFLAGS = -fopenmp -O0 -Wl,-rpath,/usr/local/lib


#---------------------------------------------------------------------------
# Utilities C:
#
# This is the C compiler used to compile C utilities.  Flags required by 
# this compiler go here also; typically there are few flags required; hence 
# there are no separate macros provided for such flags.
#---------------------------------------------------------------------------
UCC = clang-7 -O


#---------------------------------------------------------------------------
# Destination of executables, relative to subdirs of the main directory. . 
#---------------------------------------------------------------------------
BINDIR  = ../bin


#---------------------------------------------------------------------------
# The variable RAND controls which random number generator 
# is used. It is described in detail in Doc/README.install. 
# Use "randi8" unless there is a reason to use another one. 
# Other allowed values are "randi8_safe", "randdp" and "randdpvec"
#---------------------------------------------------------------------------
# RAND   = randi8
# The following is highly reliable but may be slow:
RAND   = randdp


#---------------------------------------------------------------------------
# The variable WTIME is the name of the wtime source code module in the
# NPB2.x/common directory.  
# For most machines,       use wtime.c
# For SGI power challenge: use wtime_sgi64.c
#---------------------------------------------------------------------------
WTIME  = wtime.c


#---------------------------------------------------------------------------
# Enable if either Cray or IBM: 
# (no such flag for most machines: see common/wtime.h)
# This is used by the C compiler to pass the machine name to common/wtime.h,
# where the C/Fortran binding interface format is determined
#---------------------------------------------------------------------------
# MACHINE   =   -DCRAY
# MACHINE   =   -DIBM

这总是给出相同的链接错误 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) 尝试使用 make suite 构建它时:

cd SP; make CLASS=S
make[2]: Entering directory '/home/akan/Downloads/Benchmarks/NPB3.0-omp-C-master/SP'
make[3]: Entering directory '/home/akan/Downloads/Benchmarks/NPB3.0-omp-C-master/sys'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/akan/Downloads/Benchmarks/NPB3.0-omp-C-master/sys'
../sys/setparams sp S
make.def modified. Rebuilding npbparams.h just in case
rm -f npbparams.h
../sys/setparams sp S
clang-7  -c -I../common -I/usr/local/include -fopenmp -O3 sp.c
clang-7 -fopenmp -O0 -Wl,-rpath,/usr/local/lib -o ../bin/sp.S sp.o ../common/c_print_results.o ../common/c_timers.o ../common/c_wtime.o -L/usr/local/lib
/usr/bin/ld: cannot open output file ../bin/sp.S: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:24: recipe for target '../bin/sp.S' failed
make[2]: *** [../bin/sp.S] Error 1
make[2]: Leaving directory '/home/akan/Downloads/Benchmarks/NPB3.0-omp-C-master/SP'
Makefile:14: recipe for target 'sp' failed
make[1]: *** [sp] Error 2
make[1]: Leaving directory '/home/akan/Downloads/Benchmarks/NPB3.0-omp-C-master'
make[1]: Entering directory '/home/akan/Downloads/Benchmarks/NPB3.0-omp-C-master'

C程序不能用Clang编译吗?或者我是否遗漏了 make.def 文件中的任何内容?

这里重要的错误行是:

/usr/bin/ld: cannot open output file ../bin/sp.S: No such file or directory

因为是输出文件,所以no such指的是目录。创建 ../bin 它应该可以工作。