Lou*_*seC 6 fortran compiler-errors makefile ubuntu-20.04
我正在尝试从 makefile 编译一些源代码,但它不起作用。我得到的错误是
gfortran-9 -o sams43 sams43.o mvnorm.o isml_wrapper.o
/usr/bin/ld: sams43.o: relocation R_X86_64_32 against '.rodata' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
make: *** [makefile:7: sams43] Error 1
Run Code Online (Sandbox Code Playgroud)
这是我的生成文件:
FC=gfortran-9
FCFLAGS= -g
all: sams43 normal_dataset
sams43: sams43.o mvnorm.o imsl_wrapper.o
${FC} -o sams43 sams43.o mvnorm.o imsl_wrapper.o
imsl_wrapper.o: imsl_wrapper.f90
${FC} ${FCFLAGS} -c imsl_wrapper.f90
sams43.o: sams43.f90
${FC} ${FCFLAGS} -c sams43.f90
mvnorm.o: mvnorm.f90
${FC} ${FCFLAGS} -c mvnorm.f90
normal_dataset: normal_dataset.o mvnorm.o
${FC} -o normal_dataset normal_dataset.o mvnorm.o
normal_dataset.o: normal_dataset.f90
${FC} ${FCFLAGS} -c normal_dataset.f90
clean:
# rm *.o sams43 normal_dataset
Run Code Online (Sandbox Code Playgroud)
我正在使用 Ubuntu 20.04。我的合作者能够在旧版本的 ubuntu 上编译 make 文件,没有任何问题。她的 make 文件和我的唯一区别是我将“FC=gfortran”更改为“FC=gfortran-9”。这是因为 gfortran 不再适用于我的 Ubuntu 版本,所以我使用 gfortran-9 作为我的编译器。
通过阅读此处的其他帖子,似乎我使用的标志可能存在问题(即两个 fortran 版本之间的代码可能已更改),但我无法找到有关哪个标志的任何信息来代替。
我对编程很陌生,任何帮助将不胜感激!
| 归档时间: |
|
| 查看次数: |
8708 次 |
| 最近记录: |