Closed Leisures2 closed 8 months ago
Hi,
The Planck likelihoods can have a bit of a hard time finding things sometimes, you can try the usual of making sure cfitsio appears on the relevant path variables, but you can also try to directly pass the path to Planck with the flag --cfitsio_prefix , e.g. --cfitsio_prefix=$CFITSIO_HOME
Best, Thejs
Hi,
There are installation instructions for cfitsio (and most of the other dependencies the Planck likelihoods need) in the readme.md that comes with the Planck likelihoods (in code/plc_3.0/plc-3.01
). With cfitsio specifically, note the importance of compiling it with the option --shared
, such that the Planck likelihoods can find it properly.
Cheers, Deanna
Hi,
There are installation instructions for cfitsio (and most of the other dependencies the Planck likelihoods need) in the readme.md that comes with the Planck likelihoods (in
code/plc_3.0/plc-3.01
). With cfitsio specifically, note the importance of compiling it with the option--shared
, such that the Planck likelihoods can find it properly.Cheers, Deanna
I try to recompile cfitsio with the option 'shared' but it minds me that they don't have this term:
(MontePy) durian@MacBook-Pro cfitsio % make --shared
/Library/Developer/CommandLineTools/usr/bin/make: unrecognized option `--shared'
Usage: make [options] [target] ...
Options:
-b, -m Ignored for compatibility.
-B, --always-make Unconditionally make all targets.
-C DIRECTORY, --directory=DIRECTORY
Change to DIRECTORY before doing anything.
-d Print lots of debugging information.
--debug[=FLAGS] Print various types of debugging information.
-e, --environment-overrides
Environment variables override makefiles.
-f FILE, --file=FILE, --makefile=FILE
Read FILE as a makefile.
-h, --help Print this message and exit.
-i, --ignore-errors Ignore errors from commands.
-I DIRECTORY, --include-dir=DIRECTORY
Search DIRECTORY for included makefiles.
-j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
-k, --keep-going Keep going when some targets can't be made.
-l [N], --load-average[=N], --max-load[=N]
Don't start multiple jobs unless load is below N.
-L, --check-symlink-times Use the latest mtime between symlinks and target.
-n, --just-print, --dry-run, --recon
Don't actually run any commands; just print them.
-o FILE, --old-file=FILE, --assume-old=FILE
Consider FILE to be very old and don't remake it.
-p, --print-data-base Print make's internal database.
-q, --question Run no commands; exit status says if up to date.
-r, --no-builtin-rules Disable the built-in implicit rules.
-R, --no-builtin-variables Disable the built-in variable settings.
-s, --silent, --quiet Don't echo commands.
-S, --no-keep-going, --stop
Turns off -k.
-t, --touch Touch targets instead of remaking them.
-v, --version Print the version number of make and exit.
-w, --print-directory Print the current directory.
--no-print-directory Turn off -w, even if it was turned on implicitly.
-W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
Consider FILE to be infinitely new.
--warn-undefined-variables Warn when an undefined variable is referenced.
-N OPTION, --NeXT-option=OPTION
Turn on value of NeXT OPTION.
This program built for i386-apple-darwin11.3.0
Report bugs to <bug-make@gnu.org>
Or I understand incorrectly...Should I make
before make --shared
?
Hi,
Your cfitsio set-up will change a bit based on your machine and configuration, but here's what I do to get it working with Planck. Assuming you've downloaded the latest version of cfitsio and untared it, navigate to the cfitsio directory and then try the following (taken from the cfitsio readme):
make clean
./configure CC="gcc -m64" CXX="gcc -m64" CPP="gcc -E" CXXCPP="g++ -E"
(this will change depending on your machine)
make
make shared
make install
And then when compiling the Planck likelihood, you can use:
./waf configure --lapack_mkl=${MKLROOT} --install_all_deps --cfitsio_islocal
At this point the Planck likelihoods should be able to find cfitsio. If you still get the message complaining about cfitsio not being found, try adding the flag Thejs mentioned as well.
Cheers, Deanna
Hi,
Your cfitsio set-up will change a bit based on your machine and configuration, but here's what I do to get it working with Planck. Assuming you've downloaded the latest version of cfitsio and untared it, navigate to the cfitsio directory and then try the following (taken from the cfitsio readme):
make clean
./configure CC="gcc -m64" CXX="gcc -m64" CPP="gcc -E" CXXCPP="g++ -E"
(this will change depending on your machine)make
make shared
make install
And then when compiling the Planck likelihood, you can use:./waf configure --lapack_mkl=${MKLROOT} --install_all_deps --cfitsio_islocal
At this point the Planck likelihoods should be able to find cfitsio. If you still get the message complaining about cfitsio not being found, try adding the flag Thejs mentioned as well.
Cheers, Deanna
I follow your steps to make cfitsio "shared", but
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Clang
create a lot of trouble so my unique choice is setting the path --cfitsio_prefix
as Thejs mentioned above and I complete the step of configuration successfully. But when I install many warnings about clang
appear like:
[ 87/141] Compiling src/plik/clik_parametric.c
[ 88/141] Compiling src/lenslike/plenslike/plenslike_dat_quad.c
[ 89/141] Compiling src/cmbonly/clik_cmbonly.c
[ 90/141] Compiling src/camspec/clik_CAMspec.c
[ 91/141] Compiling src/lenslike/plenslike/plenslike_dat_full.c
[ 92/141] Compiling src/clik.c
[ 93/141] Compiling src/lenslike/plenslike/plenslike_dat_qecl.c
[ 94/141] Compiling src/plik/clik_hfipack.c
[ 95/141] Compiling src/plik/component_plugin/rel2015/corrnoise.c
clang: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument]
[ 96/141] Compiling src/plik/smica.c
clang: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument]
[ 97/141] Compiling src/lenslike/plenslike/plenslike_dat_mono.c
clang: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument]
......
Waf: Leaving directory `/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build'
Build failed
-> task in 'clik' failed with exit status 1 (run with -v to display more information)
So now I decide to change clang
to gcc
to prevent these problems. Thanks!
Thank you for reporting back on the solution that worked! Closing issue as it appears resolved.
Best, Thejs
Hi, I have replaced clang with gcc as
(base) durian@MacBook-Pro ~ % gcc --version
gcc-13 (Homebrew GCC 13.2.0) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
but the result persists "not found" of "gcc":
(MontePy) durian@MacBook-Pro plc-3.01 % ./waf configure --lapack_mkl=${MKLROOT} --install_all_deps --cfitsio_prefix=/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/cfitsio
Setting top to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01
Setting out to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build
Checking for program 'gcc, cc' : /usr/bin/gcc
gcc not found(cause : Could not find gcc/g++ (only Clang), if renamed try eg: CC=gcc48 CXX=g++48 waf configure
(complete log in /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/config.log))
Checking for program 'icc, ICL' : not found
icc not found (cause : Could not find the program ['icc', 'ICL']
(complete log in /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/config.log))
Checking for program 'clang' : /usr/bin/clang
Checking for program 'llvm-ar, ar' : /usr/bin/ar
Checking for program 'ar' : /usr/bin/ar
Check clang version : Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Compile a test code with clang : yes
so I think I may modify the checking part on 'gcc', can you give me some advice? I'm so sorry to disturb you again... @dchooper @brinckmann
(MontePy) durian@MacBook-Pro plc-3.01 % CC=gcc-13 ./waf configure --lapack_mkl=${MKLROOT} --install_all_deps --cfitsio_prefix=/Users/durian/MontePython/Planck/cfitsio
Setting top to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01
Setting out to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build
Checking for program 'gcc, cc' : gcc-13
Checking for program 'ar' : /usr/bin/ar
Check gcc version : 13.2.0
Compile a test code with gcc : yes
Setting architecture flag to : ['-arch', 'x86_64']
Checking for program 'ifort' : not found
ifort not found, defaulting to gfortran (cause: 'Could not find the program ['ifort']
(complete log in /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/config.log)')
Checking for program 'gfortran, g77' : /opt/homebrew/bin/gfortran
Checking for program 'ar' : /usr/bin/ar
Check gfortran version : not found, let's hope for the best...
Compile a test code with gfortran : yes
retrieve gfortran link line : ok
fortran link line : -L/opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current -lgfortran -lgomp
Setting install root to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01
Setting install bin directory to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/bin
Setting install lib directory to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/lib
Setting install include directory to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/include
Checking for program 'python' : /Users/durian/opt/anaconda3/envs/MontePy/bin/python
Checking for python version : 2.7.18
python-config : /Users/durian/opt/anaconda3/envs/MontePy/bin/python-config
Asking python-config for pyembed '--cflags --libs --ldflags --embed' flags : not found
Asking python-config for pyembed '--cflags --libs --ldflags' flags : yes
Testing pyembed configuration : Could not build a python embedded interpreter
Testing pyembed configuration : Could not build a python embedded interpreter
No suitable python distribution found
Cause : 'The configuration failed
(complete log in /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/config.log)'
Compilation will continue without it (but I strongly advise that you install it)
Checking for library dl : yes
checking for RTLD_DEFAULT in dl : yes
compile with debug option : OFF
Checking for program 'pmc-config' : not found
Checking for library pmc : not found
Check apple lapack : ok
Checking for library ['BLAS', 'LAPACK'] : yes
checking for function 'dposv' : yes
checking for function 'dtrsv' : yes
checking for function 'dpotrf' : yes
checking for function 'dpotrs' : yes
checking for function 'dpotri' : yes
checking for function 'dtrtri' : yes
checking for function 'dtrmm' : yes
checking for function 'dtrmv' : yes
checking for function 'dgeqrf' : yes
checking for function 'dormqr' : yes
checking for function 'dsyev' : yes
checking for function 'dgesvd' : yes
checking for function 'dsymv' : yes
checking for function 'dgemv' : yes
checking for function 'dgemm' : yes
checking for function 'dsyrk' : yes
checking for function 'dsyr2k' : yes
checking for function 'daxpy' : yes
checking for function 'dtrsm' : yes
checking for function 'dsymm' : yes
checking for function 'dsyr' : yes
checking for function 'ddot' : yes
checking for function 'dsyevd' : yes
checking for function 'dlamch' : yes
checking for function 'dsyevr' : yes
Checking for library ['cfitsio'] : yes
checking for function 'fits_init_cfitsio' : failed
cfitsio not found
check that cfitsio_prefix or cfitsio_lib and cfitsio_include command line options point toward your cfitsio install
or check that cfitsio is compiled in 64 bit
or install automatically using cmdline option --cfitsio_install
The configuration failed
(complete log in /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/config.log)
It is so ridiculous that I replace clang
with gcc
successfully but meet problems of pyembed
and cfitsio
again.
I check the config.log
Testing pyembed configuration
==>
#include <Python.h>
#ifdef __cplusplus
extern "C" {
#endif
void Py_Initialize(void);
void Py_Finalize(void);
#ifdef __cplusplus
}
#endif
int main(int argc, char **argv)
{
(void)argc; (void)argv;
Py_Initialize();
Py_Finalize();
return 0;
}
<==
[1/2] Compiling [32mbuild/.conf_check_4f0b8ed5fd77b1d605cb2787c62d7e46/test.c[0m
['gcc-13', '-fno-strict-aliasing', '-arch', 'x86_64', '-g', '-fwrapv', '-O3', '-I../../../../../../../../opt/anaconda3/envs/MontePy/include/python2.7', '-I../../../../../../../../opt/anaconda3/envs/MontePy/include', '-DPYTHONDIR="/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/lib/python2.7/site-packages"', '-DNDEBUG', '../test.c', '-c', '-o/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/.conf_check_4f0b8ed5fd77b1d605cb2787c62d7e46/testbuild/test.c.1.o']
err: gcc-13: warning: this compiler does not support x86 ('-arch' option ignored)
and
checking for function 'fits_init_cfitsio'
==>
#include <fitsio.h>
int main(int argc, char **argv) {
void (*p)();
(void)argc; (void)argv;
p=(void(*)())(fits_init_cfitsio);
return !p;
}
<==
[1/2] Compiling [32mbuild/.conf_check_80977249818c1f00107d0f8b2b01e46c/test.c[0m
['gcc-13', '-fPIC', '-dynamiclib', '-I../../../../../../cfitsio/include', '-DPYTHONDIR="/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/lib/python2.7/site-packages"', '-DHAVE_LAPACK_CLIK_H=1', '../test.c', '-c', '-o/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/.conf_check_80977249818c1f00107d0f8b2b01e46c/testbuild/test.c.1.o']
[2/2] Linking [33mbuild/.conf_check_80977249818c1f00107d0f8b2b01e46c/testbuild/testprog[0m
['gcc-13', '-arch', 'x86_64', '-dynamiclib', 'test.c.1.o', '-o/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/.conf_check_80977249818c1f00107d0f8b2b01e46c/testbuild/testprog', '-Wl,-rpath,/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/lib', '-Wl,-rpath,/Users/durian/MontePython/Planck/cfitsio/lib', '-L/Users/durian/MontePython/Planck/cfitsio/lib', '-lcfitsio']
err: gcc-13: warning: this compiler does not support x86 ('-arch' option ignored)
ld: warning: ignoring file /Users/durian/MontePython/Planck/cfitsio/lib/libcfitsio.a, file is universal (i386,x86_64) but does not contain the arm64 architecture: /Users/durian/MontePython/Planck/cfitsio/lib/libcfitsio.a
Undefined symbols for architecture arm64:
So it looks like a paradox between x86_64
and arm64
. I will try new settings tomorrow and desire your advice.
Hi,
I'm going to close this as it is technically not a MontePython issue. If you found a solution I would appreciate if you can report back, since I haven't seen this problem before.
It seems a bit of an unusual issue, so I'm not sure if these can help, but here is the standard list of places to find information on Planck installations: 1) The MontePython README: https://github.com/brinckmann/montepython_public#the-planck-likelihood-part 2) The Planck README found in your Planck directory at code/plc_3.0/plc-3.01/readme.md 3) Searching for Planck in open and closed MontePython issues as common problems have been addressed many times I think this one has not, though): https://github.com/brinckmann/montepython_public/issues?q=is%3Aissue+Planck 4) Searching for answered Planck issues on the CosmoCoffee forums https://cosmocoffee.info/
In particular you might check 4) as that's a wider community than just MontePython users and it's possible other Mac users encountered this.
Best, Thejs
Hello everyone : I meet an error when I prepare to configure clik with the Intel mkl library using the code (on Mac)
./waf configure --lapack_mkl=${MKLROOT} --install_all_deps
Setting top to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01 Setting out to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build Checking for program 'gcc, cc' : /usr/bin/gcc gcc not found(cause : Could not find gcc/g++ (only Clang), if renamed try eg: CC=gcc48 CXX=g++48 waf configure (complete log in /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/config.log)) Checking for program 'icc, ICL' : not found icc not found (cause : Could not find the program ['icc', 'ICL'] (complete log in /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/config.log)) Checking for program 'clang' : /usr/bin/clang Checking for program 'llvm-ar, ar' : /usr/bin/ar Checking for program 'ar' : /usr/bin/ar Check clang version : Apple clang version 14.0.3 (clang-1403.0.22.14.1) Compile a test code with clang : yes Checking for library omp : not found Setting architecture flag to : ['-arch', 'x86_64'] Checking for program 'ifort' : not found ifort not found, defaulting to gfortran (cause: 'Could not find the program ['ifort'] (complete log in /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/build/config.log)') Checking for program 'gfortran, g77' : /opt/homebrew/bin/gfortran Checking for program 'ar' : /usr/bin/ar Check gfortran version : not found, let's hope for the best... Compile a test code with gfortran : yes retrieve gfortran link line : ok fortran link line : -L/opt/homebrew/Cellar/gcc/13.1.0/lib/gcc/current -lgfortran -lgomp Setting install root to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01 Setting install bin directory to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/bin Setting install lib directory to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/lib Setting install include directory to : /Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/include Checking for program 'python' : /Users/durian/opt/anaconda3/envs/MontePy/bin/python Checking for python version : 2.7.18 python-config : /Users/durian/opt/anaconda3/envs/MontePy/bin/python-config Asking python-config for pyembed '--cflags --libs --ldflags --embed' flags : not found Asking python-config for pyembed '--cflags --libs --ldflags' flags : yes Testing pyembed configuration : yes Checking for library dl : yes checking for RTLD_DEFAULT in dl : yes compile with debug option : OFF Checking for program 'pmc-config' : not found Checking for library pmc : not found Check apple lapack : ok Checking for library ['BLAS', 'LAPACK'] : yes checking for function 'dposv' : yes checking for function 'dtrsv' : yes checking for function 'dpotrf' : yes checking for function 'dpotrs' : yes checking for function 'dpotri' : yes checking for function 'dtrtri' : yes checking for function 'dtrmm' : yes checking for function 'dtrmv' : yes checking for function 'dgeqrf' : yes checking for function 'dormqr' : yes checking for function 'dsyev' : yes checking for function 'dgesvd' : yes checking for function 'dsymv' : yes checking for function 'dgemv' : yes checking for function 'dgemm' : yes checking for function 'dsyrk' : yes checking for function 'dsyr2k' : yes checking for function 'daxpy' : yes checking for function 'dtrsm' : yes checking for function 'dsymm' : yes checking for function 'dsyr' : yes checking for function 'ddot' : yes checking for function 'dsyevd' : yes checking for function 'dlamch' : yes checking for function 'dsyevr' : yes
cfitsio not found, try to install it Install 'cfitsio3280.tar.gz' download from ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3280.tar.gz curl ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3280.tar.gz build/cfitsio3280.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (67) Access denied: 550 Traceback (most recent call last): File "/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/.waf-2.0.17-c5414c9b1eca70e1add79159e16494fe/waflib/Scripting.py", line 119, in waf_entry_point run_commands() File "/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/.waf-2.0.17-c5414c9b1eca70e1add79159e16494fe/waflib/Scripting.py", line 182, in run_commands ctx=run_command(cmd_name) File "/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/.waf-2.0.17-c5414c9b1eca70e1add79159e16494fe/waflib/Scripting.py", line 173, in run_command ctx.execute() File "/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/.waf-2.0.17-c5414c9b1eca70e1add79159e16494fe/waflib/Configure.py", line 85, in execute super(ConfigurationContext,self).execute() File "/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/.waf-2.0.17-c5414c9b1eca70e1add79159e16494fe/waflib/Context.py", line 85, in execute self.recurse([os.path.dirname(g_module.root_path)]) File "/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/.waf-2.0.17-c5414c9b1eca70e1add79159e16494fe/waflib/Context.py", line 126, in recurse user_function(self) File "/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/wscript", line 215, in configure ctx.load("cfitsio","waf_tools") File "/Users/durian/MontePython/Planck/code/plc_3.0/plc-3.01/.waf-2.0.17-c5414c9b1eca70e1add79159e16494fe/waflib/Configure.py", line 156, in load func(self) File "waf_tools/cfitsio.py", line 16, in configure atl.conf_lib(ctx,"cfitsio",["cfitsio"],"fits_init_cfitsio","fitsio.h",msg="",opt_name="cfitsio",uselib=["cshlib"],install=install_cfitsio) File "waf_tools/autoinstall_lib.py", line 165, in conf_lib install(ctx) File "waf_tools/cfitsio.py", line 20, in install_cfitsio atl.installsmthg_pre(ctx,url,tar) File "waf_tools/autoinstall_lib.py", line 244, in installsmthg_pre getfromurl(where,osp.join(whereto,what)) File "waf_tools/autoinstall_lib.py", line 223, in getfromurl aa = subprocess.check_output(["curl",fromurl]) File "/Users/durian/opt/anaconda3/envs/MontePy/lib/python2.7/subprocess.py", line 223, in check_output raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['curl', 'ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3280.tar.gz']' returned non-zero exit status 67
The marked part is about the missing 'cfitsio'. I notice the issue #278 is similar to mine so I download and install 'cfitsio3280' from new website. However it doesn't matter and the 'cfitsio' still remains 'not found'. I also try to use brew to install 'cfitsio' but the result doesn't change too.
Now there's nothing more I can do.... I hope you can help me!