在 macOS Monterey (M1) 上编译 gfortran 测试代码时出现架构错误

发布于 2025-01-20 19:13:03 字数 750 浏览 1 评论 0原文

我试图通过Macos Monterey(M1)版本12.3上的Fortran运行基本的测试代码(命名 test.f90 )。 代码为:

program test
  integer, dimension(2,2) :: f,g
  integer :: i,j
  do i=1,2
     do j=1,2
       f(i,j)=2*i+j
       g(i,j)=i+3*j
    enddo
  enddo
  !print*,f  !  gives f(x1,y1,z1),f(x2,y1,z1),...,f(x1,y2,z1),f(x2,y2,z1),...
  print*,f
  print*,g
  print*,f*g
  print*,f(:,:)*g(:,:)
  f = reshape( (/1,2,3,4/), (/2,2/) )
  print*,sum(f)
end program

GFORTRAN版本是:GNU FORTRAN(Homebrew GCC 11.2.0_3)11.2.0。 当我做 gfortran test.f90 时,以下错误弹出:

ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd' for architecture arm64

I was trying to run a basic piece of test code (named test.f90) through fortran on macOS Monterey (M1) version 12.3.
The code is:

program test
  integer, dimension(2,2) :: f,g
  integer :: i,j
  do i=1,2
     do j=1,2
       f(i,j)=2*i+j
       g(i,j)=i+3*j
    enddo
  enddo
  !print*,f  !  gives f(x1,y1,z1),f(x2,y1,z1),...,f(x1,y2,z1),f(x2,y2,z1),...
  print*,f
  print*,g
  print*,f*g
  print*,f(:,:)*g(:,:)
  f = reshape( (/1,2,3,4/), (/2,2/) )
  print*,sum(f)
end program

The gfortran version is: GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0.
When I did gfortran test.f90, the following error popped up:

ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd' for architecture arm64

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文