camb making error in mac 10.14.1

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Ding-fang Zeng
Posts: 4
Joined: December 29 2016
Affiliation: Beijing University of Technology

camb making error in mac 10.14.1

Post by Ding-fang Zeng » March 05 2019

Dear All,

Does any one hit errors of the following type when making camb(v2019-1.0.3) in mac osx(10.14.1, majave)?
... ...
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
make[2]: *** [camb_exe] Error 1
make[1]: *** [../camb] Error 2
make: *** [camb] Error 2
How should I do to resolve this trouble?
Thank you in advances.
Last edited by Ding-fang Zeng on March 20 2019, edited 2 times in total.

Ding-fang Zeng
Posts: 4
Joined: December 29 2016
Affiliation: Beijing University of Technology

Re: camb making error in mac 10.14.1

Post by Ding-fang Zeng » March 20 2019

Now I know by changing the compiling command the following way, the CAMB-fortran code can be compiled successfully on my mac-majave. But I do not want to input this command line by hand every time I compile the project. How should I change the Makefile so that the option ``-L/usr/lib/'' can be added into the command automatically? Another question I want to ask is, how to change the Makefile so that I can use lldb provided by xcode to follow CAMB's running line by line? (without any revision of the Makefile, I can lldb, but cannot list source code in lldb window)

The original command is produced by the Makefile, which does not work fluently on my mac-majave+gfortran platform,
--------------------------------------------------------
gfortran -O3 -MMD -cpp -ffree-line-length-none -fmax-errors=4 -fopenmp -JRelease -IRelease/ -I"/Volumes/mac-data/dfzeng19-21/HDE-ricci/CAMB-103/fortran/../forutils/Release/" Release/inidriver.o Release/libcamb.a -L"/Volumes/mac-data/dfzeng19-21/HDE-ricci/CAMB-103/fortran/../forutils/Release/" -lforutils -o camb
--------------------------------------------------------
The proper compile command which works successfully is as follows,

********************************************************
gfortran -O3 -MMD -cpp -ffree-line-length-none -fmax-errors=4 -fopenmp -JRelease -IRelease/ -I"/Volumes/mac-data/dfzeng19-21/HDE-ricci/CAMB-103/fortran/../forutils/Release/" Release/inidriver.o Release/libcamb.a -L/usr/lib/ -L"/Volumes/mac-data/dfzeng19-21/HDE-ricci/CAMB-103/fortran/../forutils/Release/" -lforutils -o camb
********************************************************

Thanks to all

Cosmo Xu
Posts: 7
Joined: March 19 2013
Affiliation: NJU/NAOC

Re: camb making error in mac 10.14.1

Post by Cosmo Xu » March 20 2019

You just need to add '-L/usr/lib' into the Makefile.
The option '-L/usr/lib' is passed to the compiler, so that the compiler will know where to find the needed library and link it to the final excutable file (camb)

Post Reply