0

I've updated my Mac and when I compile any codes by using the Makefile, I get this error:

ld: library not found for -lSystem
collect2: error: ld returned 1 exit status

I've:

  • reinstalled x-code,
  • updated the gcc and Homebrew
  • installed xcode command line tools

But these don't work.

This is the command I used for linking:

FC= gfortran 
FLAGS = -c -O3 -std=legacy 
OBJS = Mod.o Arpack.o Eigenvalue.o G.o G0.o Gauleg.o Hyper_Lin.o Lambdaval.o Fcomponent.o Triton.o Triton_YG.o 
Triton_YG: $(OBJS) 
$(FC) $(OBJS) -o Triton_YG $$MKL_FFLAGS $$MKL_LIBS –
  • So, do you build your project with custom Makefiles or it is XCode-generated? Please, show the **exact command line** used for linking. – Tsyvarev Dec 28 '20 at 10:50
  • So it is gfortran. Have you checked that [similar question](https://stackoverflow.com/questions/56156520/gfortran-error-ld-library-not-found-for-lsystem-when-trying-to-compile) and the [last answer](https://stackoverflow.com/a/65428700/3440745) for it? – Tsyvarev Dec 28 '20 at 14:22
  • I tried just (brew reinstall gcc) But when I've tried both commands (brew reinstall gcc brew reinstall gfortran) It has resolved my problem. Thanks. – kamyar mohseni Dec 29 '20 at 01:04
  • Yes! I've reinstall gcc and gfortran. – kamyar mohseni Dec 29 '20 at 12:59

1 Answers1

0

I've tried these "both" commands line:

brew reinstall gcc
brew reinstall gfortran

And it solved my problem.