首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用LLVM Clang编译NAS并行基准会出错

用LLVM Clang编译NAS并行基准会出错
EN

Stack Overflow用户
提问于 2019-01-19 17:56:16
回答 1查看 144关注 0票数 0

我在Linux上,试图用LLVM编译器和LLVM运行时库编译NPB套件(C版本) 链接

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

代码语言:javascript
复制
#---------------------------------------------------------------------------
#
#                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: error: linker命令失败,退出代码1(使用-v查看调用)试图使用make套件构建链接:

代码语言:javascript
复制
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'

用Clang编译C程序不可能吗?还是我在make.def文件中遗漏了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-20 18:07:30

这里的重要错误行是:

代码语言:javascript
复制
/usr/bin/ld: cannot open output file ../bin/sp.S: No such file or directory

因为它是输出文件,所以没有这样的文件引用目录。创建../bin,它应该可以工作。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54269846

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档