ComputerLanguage_Program/fortran
[fortran] mac에 fortran 설치 및 테스트
pbj0812
2020. 5. 4. 22:33
0. 목표
- mac OS에 fortran 설치 및 테스트
1. 설치
- gfortran 설치
brew cask install gfortran
2. 테스트
1) 코드 작성
- test.f90
program hello
implicit none
write(*,*) 'Hello world!'
end program hello
2) compile
- a.out 생성
gfortran test.f90
3) a.out 실행
- 에러발생
./a.out
3. 에러 잡기
1) 원인 판단
- 위의 libgfortran.3.dylib 파일은 /anaconda3/bin/libgfortran.3.dylib 에 존재
=> 경로 설정이 잘못되어 에러가 발생할 가능성 존재
2) 해결방안
- ln 을 통해 하드링크를 걸어줌
- 뒤이어 발생하는 libquadmath.0.dylib 에러도 같은 방법으로 해결
ln /anaconda3/bin/libgfortran.3.dylib /usr/local/lib/libgfortran.3.dylib
3) 결과
4. 참고
- 스택오버플로우