Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm64 on conda #150

Closed
damonge opened this issue Dec 13, 2021 · 37 comments
Closed

arm64 on conda #150

damonge opened this issue Dec 13, 2021 · 37 comments

Comments

@damonge
Copy link
Collaborator

damonge commented Dec 13, 2021

I'd be useful for some users if we could support osx-arm64 (and I imagine the linux equivalent) on conda-forge.

@samueldmcdermott
Copy link

is there a workaround for this? I'm unable to install with conda (actually with Micromamba, but the error message is nothing provides requested pymaster (same with namaster)) or with pip (which gives a legacy-install-failure). Any thoughts are appreciated

@dinsmoro
Copy link

dinsmoro commented Oct 26, 2022

I just had to install on osx-arm64, it was a trial.

Here are the steps that made it succeed (note that CLANG via Homebrew or Xcode (no omp support, very finicky) did not work, only GCC works - I got it to compile with Homebrew's CLANG but it gave a "symbol" error when trying to import pymaster that as best I could divine was due to other prebuilt GCC libraries not getting along with the CLANG ones I had just made).

Step 1:

install GCC, cfitsio, fftw, libtool via Homebrew (and maybe some others cause I was linking stuff into /usr/local/lib and /usr/local/include using sudo ln -s /file/to/link.a /destination/to/put/it, but it'll error about them if you do need them)

Step 2:

CC=/opt/homebrew/opt/gcc/bin/gcc-12 CFLAGS="-I/usr/local/include -I/opt/homebrew/opt/cfitsio/include -I/opt/homebrew/opt/fftw/include" LDFLAGS="-L/usr/local/lib -L/opt/homebrew/opt/cfitsio/lib -L/opt/homebrew/opt/fftw/lib" pip install /path/to/folderdownloadedfromgithub/NaMaster

You may not have to download the MAIN from Github and may just be able to use [compile stuff] pip install pymaster instead of [compile stuff] pip install /path/to/folderdownloadedfromgithub/NaMaster, I used the downloaded way for debug purposes since pip deletes pip install pymaster stuff otherwise and did not try the easier way.

Hope this helps anyone else trying to install it on OSX ARM!

@samueldmcdermott
Copy link

samueldmcdermott commented Oct 27, 2022

thanks for the reply! Unfortunately it's still failing for me -- I still get
checking build system type... Invalid configuration 'arm64-apple-darwin20.0.0': machine 'arm64-apple' not recognized
configure: error: /bin/sh ./config.sub arm64-apple-darwin20.0.0 failed
ERROR: failed to configure HEALPix. Check CFITSIO is installed and reachable.
error: Failed to install libchealpix.
and I couldn't figure out the magical mix of symlinks to get it to work. I have other hack-y solutions to this problem so I guess I will avoid it for now

@dinsmoro
Copy link

dinsmoro commented Oct 27, 2022

Sorry to hear - installing cfitsio via Homebrew and then the linking calls (-L/opt/homebrew/opt/cfitsio/lib and the -I equivalent) should have prevented that error. You can install healpix via Homebrew as well and symlink the files in /opt/homebrew/opt/healpix/lib to /path/to/folderdownloadedfromgithub/NaMaster/_dep/lib (and the same for include) to bypass having to build healpix at all - but that’ll probably just kick the can down the road if -L and -I calls aren’t adding those libraries to be used correctly and you’ll have an issue at the next thing it tries to build. And I’m not sure why those calls wouldn’t work - maybe someone else knows what would prevent them from being used.

edit: check in /path/to/folderdownloadedfromgithub/NaMaster/_dep/libchealpix for a CONFIGURE.log, it will have what actually went wrong (look for when the CONFIGURE### lines stop in the middle of the file, last one is the error). Just remembered that the error messages it prints are often hardcoded and not fully relevant.

@elvinpoole
Copy link

Did either of you find a solution to this? I'm having the same issue trying to install with an M1 mac

@elvinpoole
Copy link

elvinpoole commented Nov 30, 2022

Following the instructions above, if i don't pre-install healpix, I get the same error:

      ERROR: failed to configure HEALPix. Check CFITSIO is installed and reachable.
      error: Failed to install libchealpix.

If I do pre-install healpix (with homebrew) and symlink to NaMaster/_dep/lib, I get:

      ERROR: failed to configure libnmt. Check all dependencies are installed
             Dependencies:
             - GSL
             - FFTW
             - CFITSIO
             - HEALPix
      error: Failed to compile C library.

So it seems that does just kick the can down the road as predicted

@dinsmoro
Copy link

dinsmoro commented Nov 30, 2022

Yes libnmt must be compiled so you need to get the compile chain working.

Delete healpix and try to install pymaster again and then check /path/to/folderdownloadedfromgithub/NaMaster/_dep/libchealpix for a CONFIGURE.log and see what the thing it actually errored on was (not the bottom of the file usually).

The ERROR: failed to configure HEALPix. Check CFITSIO is installed and reachable. error: Failed to install libchealpix. is a hardcoded so it doesn't actually help you (I guess unless CFITSIO wasn't going, but it probably is if you installed via Homebrew).

@elvinpoole
Copy link

elvinpoole commented Nov 30, 2022

Thanks for the reply!
looks like NaMaster/_dep/libchealpix and CONFIGURE.log didn't get created by the install (even after deleting healpix). But i did find some more output to the terminal which may be what I'm looking for?

      Found automake.
      Makefile.am:3: error: Libtool library used but 'LIBTOOL' is undefined
      Makefile.am:3:   The usual way to define 'LIBTOOL' is to add 'LT_INIT'
      Makefile.am:3:   to 'configure.ac' and run 'aclocal' and 'autoconf' again.
      Makefile.am:3:   If 'LT_INIT' is in 'configure.ac', make sure
      Makefile.am:3:   its definition is in aclocal's search path.
      autoreconf: automake failed with exit status: 1

@dinsmoro
Copy link

Install libtool via Homebrew, I'm guessing it's not installed https://formulae.brew.sh/formula/libtool

@elvinpoole
Copy link

thanks! libtools was installed but I needed to run libtoolize in the NaMaster directory and in each of the dependencies and following it's instructions and it worked, thanks for your help

@samueldmcdermott
Copy link

@komatsu5147
Copy link

Just one more progress. I found that -fopenmp was hard-coded in scripts/install_libnmt.sh:

CFLAGS="$CFLAGS -fopenmp -O3" CPPFLAGS="$CPPFLAGS -I${ADEPDIR}/include -fopenmp -O3" LDFLAGS="$LDFLAGS -L${ADEPDIR}/lib" ./configure --prefix=${ADEPDIR} --with-pic $@

clang complained that it did not have -fopenmp. I had to change it to -openmp, but the best way is to make this line consistent with the configure file, rather than hard-coding it. My 2 cents!

@irene-left
Copy link

irene-left commented Jun 27, 2023

thanks! libtools was installed but I needed to run libtoolize in the NaMaster directory and in each of the dependencies and following it's instructions and it worked, thanks for your help

Hi @elvinpoole I run across the same error and I was wondering if you could please provide a little bit more information on how you were able to solve it ? thank you so much!

I run libtoolize in the NaMaster directory but got the following output:


libtoolize: You should add the contents of the following files to 'aclocal.m4':
libtoolize: '/usr/local/share/aclocal/libtool.m4'
libtoolize: '/usr/local/share/aclocal/ltoptions.m4'
libtoolize: '/usr/local/share/aclocal/ltsugar.m4'
libtoolize: '/usr/local/share/aclocal/ltversion.m4'
libtoolize: '/usr/local/share/aclocal/lt~obsolete.m4'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

@elvinpoole
Copy link

elvinpoole commented Jun 27, 2023

I found the install worked only if I followed each of the instructions libtoolize gives (directly editing aclocal.m4, configure.ac, Makefile.am) I'm not sure which of these steps had an impact

Some more details from notes I wrote at the time
I ran libtoolize in each of these directories:

NaMaster/
NaMaster/_deps/chealpix-3.11.4/
NaMaster/_deps/libsharp2/

You might have to run the dependancies install scripts separately
./scripts/install_libsharp.sh
./scripts/install_libchealpix.sh (you might not need this one if you are using chealpix from elsewhere)
and I had to edit the setup.py so that it wouldn’t run these as part on the namaster install

This is the extra stuff i had in my environment before installing namaster in case useful:

export CC=/opt/homebrew/Cellar/gcc/12.2.0/bin/gcc-12
export PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH"
export CFLAGS="-I/usr/local/include -I/opt/homebrew/opt/cfitsio/include -I/opt/homebrew/opt/fftw/include -I/opt/homebrew/opt/gsl/include/ -I/opt/homebrew/opt/libtool/include/"
export LDFLAGS="-L/usr/local/lib -L/opt/homebrew/opt/cfitsio/lib -L/opt/homebrew/opt/fftw/lib -L/opt/homebrew/opt/gsl/lib/ -L/opt/homebrew/opt/libtool/lib/"

@irene-left
Copy link

I found the install worked only if I followed each of the instructions libtoolize gives (directly editing aclocal.m4, configure.ac, Makefile.am) I'm not sure which of these steps had an impact

Some more details from notes I wrote at the time I ran libtoolize in each of these directories:

NaMaster/ NaMaster/_deps/chealpix-3.11.4/ NaMaster/_deps/libsharp2/

You might have to run the dependancies install scripts separately ./scripts/install_libsharp.sh ./scripts/install_libchealpix.sh (you might not need this one if you are using chealpix from elsewhere) and I had to edit the setup.py so that it wouldn’t run these as part on the namaster install

This is the extra stuff i had in my environment before installing namaster in case useful:

export CC=/opt/homebrew/Cellar/gcc/12.2.0/bin/gcc-12
export PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH"
export CFLAGS="-I/usr/local/include -I/opt/homebrew/opt/cfitsio/include -I/opt/homebrew/opt/fftw/include -I/opt/homebrew/opt/gsl/include/ -I/opt/homebrew/opt/libtool/include/"
export LDFLAGS="-L/usr/local/lib -L/opt/homebrew/opt/cfitsio/lib -L/opt/homebrew/opt/fftw/lib -L/opt/homebrew/opt/gsl/lib/ -L/opt/homebrew/opt/libtool/lib/"

@elvinpoole thank you so so much for your repsonse. Just one more clarification ( sorry if this sounds a bit trivial but it is my first time manually configuring installations on my laptop), where exactly in the aclocal.m4 file do I need to put the required files ?

@elvinpoole
Copy link

I think i just copied the contents of each of the files libtoolize suggested and pasted to the end of the aclocal

@irene-left
Copy link

thank you so much! I did everything you suggested and still run into the same error. Upon checking the config.log file, the specific error seems to be related to unsupported options -fopenmp by gcc. I am currently operating on macOS M2 and have installed gcc-13 via homebrew. Do you happen to know how gcc can support OpenMP?

@komatsu5147
Copy link

One way to hack this:

  • In scripts/install_libnmt.sh: change -fopenmp to -Xclang -fopenmp in
CFLAGS="$CFLAGS -fopenmp -O3" CPPFLAGS="$CPPFLAGS -I${ADEPDIR}/include -fopenmp -O3" LDFLAGS="$LDFLAGS -L${ADEPDIR}/lib" ./configure --prefix=${ADEPDIR} --with-pic $@

Note that there are two -fopenmp in this line.

  • In setup.py, change -fopenmp to -Xclang -fopenmp in
extra += ['-fopenmp']
  • In configure.ac, comment out AC_OPENMP.

@irene-left
Copy link

@komatsu5147 thank you so much for the reply! i have been struggling for more than a week to try to correctly install NaMaster and your response gave me some hope!

Unfortunately I still run to an error but this time a different one:
this is taken from my config.log after applying all the suggested changes in your precious post.

configure:3756: gcc --version >&5
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3767: $? = 0
configure:3756: gcc -v >&5
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3767: $? = 0
configure:3756: gcc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3767: $? = 1
configure:3756: gcc -qversion >&5
clang: error: unknown argument '-qversion'; did you mean '--version'?
clang: error: no input files
configure:3767: $? = 1
configure:3756: gcc -version >&5
clang: error: unknown argument '-version'; did you mean '--version'?
clang: error: no input files
configure:3767: $? = 1
configure:3787: checking whether the C compiler works
configure:3809: gcc  -Xclang -fopenmp -O3  -I/Users/el/NaMaster/_deps/include -Xclang -fopenmp -O3  -L/Users/el/NaMaster/_deps/lib conftest.c  >&5
configure:3813: $? = 0
configure:3863: result: yes

Am I right to assume I need to update my CC and PATH variables to point to xclang? I'm very sorry if my questions are trivial but this is my very first time doing this so any further clarification would be more than appreciated!
Also am i right to assume xclang and clang are the same, since I was only locate clang in my xcode developer tools directory but no xclang. If not then what would be the correct directory for xcalng and what should I update my C and PATH variables to ?

my current variables are defined as follows:

CC=/opt/homebrew/Cellar/gcc@13/bin/gcc-13
CFLAGS="-I/usr/local/include -I/Users/el/cfitsio/include -I/opt/homebrew/opt/fftw/include -I/opt/homebrew/opt/gsl/include/ -I/usr/bin/libtool/include/"

Again thank you so much !

@komatsu5147
Copy link

komatsu5147 commented Jun 30, 2023

There is no error in your output file. Everything looks fine because you get configure:3863: result: yes at the end.

There is no xclang. -Xclang (with -X) is the compiler option that does some magic that nobody understands :)

@irene-left
Copy link

@komatsu5147 thank you so much! unfortunately the output on the terminal is still an error :(

checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... /Library/Developer/CommandLineTools/usr/bin/clang
checking whether the C compiler works... no
configure: error: in `/Users/el/NaMaster':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: failed to configure libnmt. Check all dependencies are installed
       Dependencies:
       - GSL
       - FFTW
       - CFITSIO
       - HEALPix
error: Failed to compile C library.

@komatsu5147
Copy link

This means that your config.log has more stuff after configure:3863: result: yes that might give a clue.

@irene-left
Copy link

here is the entire config.log file :

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by namaster configure 0.0, which was
generated by GNU Autoconf 2.71.  Invocation command line was

  $ ./configure --prefix=/Users/el/NaMaster/_deps --with-pic

## --------- ##
## Platform. ##
## --------- ##

hostname = irenes-mac.local
uname -m = arm64
uname -r = 21.6.0
uname -s = Darwin
uname -v = Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:07 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8110

/usr/bin/uname -p = arm
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
	 Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:07 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8110
Kernel configured for up to 8 processors.
8 processors are physically available.
8 processors are logically available.
Processor type: arm64e (ARM64E)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 8.00 gigabytes
Default processor set: 412 tasks, 2919 threads, 8 processors
Load average: 3.07, Mach factor: 4.92
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /Users/el/miniconda3/envs/tensorflow2/bin/
PATH: /Users/el/miniconda3/condabin/
PATH: /opt/homebrew/bin/
PATH: /opt/homebrew/sbin/
PATH: /Library/Frameworks/Python.framework/Versions/3.7/bin/
PATH: /Library/Frameworks/Python.framework/Versions/3.10/bin/
PATH: /usr/local/bin/
PATH: /usr/bin/
PATH: /bin/
PATH: /usr/sbin/
PATH: /sbin/


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2466: looking for aux files: config.guess config.sub ltmain.sh compile ar-lib missing install-sh
configure:2479:  trying ./
configure:2508:   ./config.guess found
configure:2508:   ./config.sub found
configure:2508:   ./ltmain.sh found
configure:2508:   ./compile found
configure:2508:   ./ar-lib found
configure:2508:   ./missing found
configure:2490:   ./install-sh found
configure:2637: checking for a BSD-compatible install
configure:2710: result: /usr/bin/install -c
configure:2721: checking whether build environment is sane
configure:2776: result: yes
configure:2935: checking for a race-free mkdir -p
configure:2979: result: ./install-sh -c -d
configure:2986: checking for gawk
configure:3021: result: no
configure:2986: checking for mawk
configure:3021: result: no
configure:2986: checking for nawk
configure:3021: result: no
configure:2986: checking for awk
configure:3007: found /usr/bin/awk
configure:3018: result: awk
configure:3029: checking whether make sets $(MAKE)
configure:3052: result: yes
configure:3082: checking whether make supports nested variables
configure:3100: result: yes
configure:3249: checking whether make supports the include directive
configure:3264: make -f confmf.GNU && cat confinc.out
this is the am__doit target
configure:3267: $? = 0
configure:3286: result: yes (GNU style)
configure:3362: checking for gcc
configure:3394: result: /Library/Developer/CommandLineTools/usr/bin/clang
configure:3747: checking for C compiler version
configure:3756: /Library/Developer/CommandLineTools/usr/bin/clang --version >&5
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3767: $? = 0
configure:3756: /Library/Developer/CommandLineTools/usr/bin/clang -v >&5
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3767: $? = 0
configure:3756: /Library/Developer/CommandLineTools/usr/bin/clang -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3767: $? = 1
configure:3756: /Library/Developer/CommandLineTools/usr/bin/clang -qversion >&5
clang: error: unknown argument '-qversion'; did you mean '--version'?
clang: error: no input files
configure:3767: $? = 1
configure:3756: /Library/Developer/CommandLineTools/usr/bin/clang -version >&5
clang: error: unknown argument '-version'; did you mean '--version'?
clang: error: no input files
configure:3767: $? = 1
configure:3787: checking whether the C compiler works
configure:3809: /Library/Developer/CommandLineTools/usr/bin/clang  -Xclang -fopenmp -O3   -I/Users/el/NaMaster/_deps/include -Xclang -fopenmp -O3  -L/Users/el/NaMaster/_deps/lib conftest.c  >&5
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3813: $? = 1
configure:3853: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "namaster"
| #define PACKAGE_TARNAME "namaster"
| #define PACKAGE_VERSION "0.0"
| #define PACKAGE_STRING "namaster 0.0"
| #define PACKAGE_BUGREPORT "github.com/damonge/NaMaster"
| #define PACKAGE_URL ""
| #define PACKAGE "namaster"
| #define VERSION "0.0"
| /* end confdefs.h.  */
| 
| int
| main (void)
| {
| 
|   ;
|   return 0;
| }
configure:3858: error: in `/Users/el/NaMaster':
configure:3860: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_env_CC_set=set
ac_cv_env_CC_value=/Library/Developer/CommandLineTools/usr/bin/clang
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value=' -Xclang -fopenmp -O3 '
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value=' -I/Users/el/NaMaster/_deps/include -Xclang -fopenmp -O3'
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value=' -L/Users/el/NaMaster/_deps/lib'
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=awk
ac_cv_prog_ac_ct_CC=/Library/Developer/CommandLineTools/usr/bin/clang
ac_cv_prog_make_make_set=yes
am_cv_make_support_nested_variables=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} '\''/Users/el/NaMaster/missing'\'' aclocal-1.16'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_V='$(V)'
AR=''
AUTOCONF='${SHELL} '\''/Users/el/NaMaster/missing'\'' autoconf'
AUTOHEADER='${SHELL} '\''/Users/el/NaMaster/missing'\'' autoheader'
AUTOMAKE='${SHELL} '\''/Users/el/NaMaster/missing'\'' automake-1.16'
AWK='awk'
CC='/Library/Developer/CommandLineTools/usr/bin/clang'
CCDEPMODE=''
CFLAGS=' -Xclang -fopenmp -O3 '
CPPFLAGS=' -I/Users/el/NaMaster/_deps/include -Xclang -fopenmp -O3'
CSCOPE='cscope'
CTAGS='ctags'
CYGPATH_W='echo'
DEFS=''
DEPDIR='.deps'
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
ETAGS='etags'
EXEEXT=''
FGREP=''
FILECMD=''
GREP=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS=' -L/Users/el/NaMaster/_deps/lib'
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
MAINT=''
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE=''
MAKEINFO='${SHELL} '\''/Users/el/NaMaster/missing'\'' makeinfo'
MANIFEST_TOOL=''
MKDIR_P='./install-sh -c -d'
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='namaster'
PACKAGE_BUGREPORT='github.com/damonge/NaMaster'
PACKAGE_NAME='namaster'
PACKAGE_STRING='namaster 0.0'
PACKAGE_TARNAME='namaster'
PACKAGE_URL=''
PACKAGE_VERSION='0.0'
PATH_SEPARATOR=':'
RANLIB=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP=''
VERSION='0.0'
ac_ct_AR=''
ac_ct_CC='/Library/Developer/CommandLineTools/usr/bin/clang'
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include='include'
am__isrc=''
am__leading_dot='.'
am__nodep='_no'
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
fftw_thread_type=''
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /Users/el/NaMaster/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
libsharp_libs=''
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/Users/el/NaMaster/_deps'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "namaster"
#define PACKAGE_TARNAME "namaster"
#define PACKAGE_VERSION "0.0"
#define PACKAGE_STRING "namaster 0.0"
#define PACKAGE_BUGREPORT "github.com/damonge/NaMaster"
#define PACKAGE_URL ""
#define PACKAGE "namaster"
#define VERSION "0.0"

configure: exit 77

@komatsu5147
Copy link

komatsu5147 commented Jun 30, 2023

Interesting - you are now getting very different messages! Instead of getting

configure:3787: checking whether the C compiler works
configure:3809: gcc  -Xclang -fopenmp -O3  -I/Users/el/NaMaster/_deps/include -Xclang -fopenmp -O3  -L/Users/el/NaMaster/_deps/lib conftest.c  >&5
configure:3813: $? = 0
configure:3863: result: yes

You are now getting

configure:3787: checking whether the C compiler works
configure:3809: /Library/Developer/CommandLineTools/usr/bin/clang  -Xclang -fopenmp -O3   -I/Users/el/NaMaster/_deps/include -Xclang -fopenmp -O3  -L/Users/el/NaMaster/_deps/lib conftest.c  >&5
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3813: $? = 1
configure:3853: result: no

You don't have to do /Library/Developer/CommandLineTools/usr/bin/clang. Just gcc as before is fine (but don't forget to include -Xclang).

@irene-left
Copy link

@komatsu5147 you were right! I went back to check my config.log backup and the error in that case is that while the compiler works it is now unable to find libgslcblas file:

checking dependency style of gcc... (cached) gcc3
checking whether to enable maintainer-specific portions of Makefiles... no
checking for library containing pow... none required
checking for library containing cblas_dgemm... no
configure: error: Couldn't find libgslcblas.
ERROR: failed to configure libnmt. Check all dependencies are installed
       Dependencies:
       - GSL
       - FFTW
       - CFITSIO
       - HEALPix
error: Failed to compile C library.

The full config.log file is now (have attached it instead for easier use):
config.log

@komatsu5147
Copy link

This is easy: make sure that

  • You installed GSL.
  • You find libgslcblas.a or libgslcblas.dylib.
  • You have given NaMaster the correct link to this library.

@komatsu5147
Copy link

You have

CFLAGS="-I/usr/local/include -I/Users/el/cfitsio/include -I/opt/homebrew/opt/fftw/include -I/opt/homebrew/opt/gsl/include/ -I/usr/bin/libtool/include/"

But you don't seem to have

LDFLAGS="-L/usr/local/lib -L/Users/el/cfitsio/lib -L/opt/homebrew/opt/fftw/lib -L/opt/homebrew/opt/gsl/lib/ -L/usr/bin/libtool/lib"

@irene-left
Copy link

@komatsu5147 I did this and I updated the path to libtool since I installed it via homebrew. The error is now that it cannot locate the sharp_execute.

checking for library containing pow... none required
checking for library containing cblas_dgemm... -lgslcblas
checking for library containing gsl_spline2d_eval_e... -lgsl
checking for library containing ffopen... -lcfitsio
checking for library containing ring2nest... -lchealpix
checking for library containing fftw_execute... -lfftw3
checking for library containing sharp_execute... no
configure: error: Couldn't find libsharp2
ERROR: failed to configure libnmt. Check all dependencies are installed
       Dependencies:
       - GSL
       - FFTW
       - CFITSIO
       - HEALPix
error: Failed to compile C library.

Where would such a file be located ? in the libsharp2 folder along with other sharp files?
Upon looking for the file, I realised there are 2 libsahrp2 folders one in the _deps directory and the other one within the libsharp2 folder (/Users/el/NaMaster/_deps/libsharp2/libsharp2) where all the sharp files are located?
is there a missing library that I have yet to install ?

(tensorflow2) el@irenes-mac NaMaster % cd _deps
(tensorflow2) el@irenes-mac _deps % ls
bin		include		lib		libsharp2
(tensorflow2) el@irenes-mac _deps % cd libsharp2
(tensorflow2) el@irenes-mac libsharp2 % ls
COPYING		ar-lib		config.sub	fortran		missing
Makefile.am	autom4te.cache	configure	install-sh	runtest.sh
Makefile.in	compile		configure.ac	libsharp2	test
README.md	config.guess	configure~	ltmain.sh	test-driver
aclocal.m4	config.log	depcomp		m4
(tensorflow2) el@irenes-mac libsharp2 % cd libsharp2
(tensorflow2) el@irenes-mac libsharp2 % ls
libsharp2.dox		sharp_core_inc.c	sharp_mpi.h
pocketfft.c		sharp_cxx.h		sharp_utils.c
pocketfft.h		sharp_geomhelpers.c	sharp_utils.h
sharp.c			sharp_geomhelpers.h	sharp_vecsupport.h
sharp.h			sharp_internal.h	sharp_ylmgen_c.c
sharp_almhelpers.c	sharp_legendre_roots.c	sharp_ylmgen_c.h
sharp_almhelpers.h	sharp_legendre_roots.h
sharp_core.c		sharp_mpi.c
(tensorflow2) el@irenes-mac libsharp2 % 

config.log

@komatsu5147
Copy link

NaMaster itself installs libsharp2, which is located in /Users/el/NaMaster/_deps/ as you showed.

At this point, it may be necessary to delete /Users/el/NaMaster/ entirely and git clone it again for a fresh install, make the same changes to the files, and recompile. In my experience, multiple attempts to compile NaMaster with different settings often lead to inconsistencies, and re-downloading it fixes the problems.

@irene-left
Copy link

(I am so so sorry to keep bothering you with this) I did a fresh install incorporating the above and I still get the same error. Here is the config.log file: config.log

checking for library containing cblas_dgemm... -lgslcblas
checking for library containing gsl_spline2d_eval_e... -lgsl
checking for library containing ffopen... -lcfitsio
checking for library containing ring2nest... -lchealpix
checking for library containing fftw_execute... -lfftw3
checking for library containing sharp_execute... no
configure: error: Couldn't find libsharp2
ERROR: failed to configure libnmt. Check all dependencies are installed
       Dependencies:
       - GSL
       - FFTW
       - CFITSIO
       - HEALPix
error: Failed to compile C library.

The steps I did were to define:

CFLAGS="-I/usr/local/include -I/Users/el/cfitsio/include -I/opt/homebrew/opt/libtool/include/ -I/Users/el/NaMaster/_deps/libsharp2 -I/Users/el/NaMaster/_deps/libsharp2/libsharp2 -I/opt/homebrew/opt/fftw/include -I/opt/homebrew/opt/gsl/include/"

LDFLAGS="-L/usr/local/lib -L/Users/el/cfitsio/lib -L/opt/homebrew/opt/fftw/lib -L/opt/homebrew/opt/libtool/lib -L/Users/el/NaMaster/_deps/libsharp2/libsharp2 -L/Users/el/NaMaster/_deps/libsharp2 -L/opt/homebrew/opt/gsl/lib/"

CC=‘gcc’

Change -fopenmp to -Xclang -fopenmp and run libtoolize in the NaMaster directory according to following instructions:


libtoolize: You should add the contents of the following files to 'aclocal.m4':
libtoolize: '/usr/local/share/aclocal/libtool.m4'
libtoolize: '/usr/local/share/aclocal/ltoptions.m4'
libtoolize: '/usr/local/share/aclocal/ltsugar.m4'
libtoolize: '/usr/local/share/aclocal/ltversion.m4'
libtoolize: '/usr/local/share/aclocal/lt~obsolete.m4'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

@komatsu5147
Copy link

I see. I am not sure what is going on, but at least you don't have to include -I/Users/el/NaMaster/_deps/libsharp2, -L/Users/el/NaMaster/_deps/libsharp2/libsharp2, and -L/Users/el/NaMaster/_deps/libsharp2/libsharp2 in CFLAGS and LDFLAGS because NaMaster automatically includes -I/Users/el/NaMaster/_deps/include and -L/Users/el/NaMaster/_deps/lib, which is all you need.

@joezuntz
Copy link
Contributor

joezuntz commented Jun 7, 2024

Hi all - we were just wondering if there is any progress on this issue? Github Actions now defaults to M1 architectures for MacOS testing, so we are seeing more test failures when we can't install Namaster.

It would be really great to be able to get our full conda stack on these systems.

@damonge
Copy link
Collaborator Author

damonge commented Jun 7, 2024

Argh, I had hoped that version 2.0, which is now on conda (since yesterday), would work out of the box on M1. Have you tested this one?

@joezuntz
Copy link
Contributor

No I hadn't - thanks, will check this out!

@joezuntz
Copy link
Contributor

The new version installs nicely for me - many thanks!

@damonge
Copy link
Collaborator Author

damonge commented Jun 13, 2024

Thanks a lot @joezuntz ! I'll close this, but please feel free to reopen if the problem persists.

@damonge damonge closed this as completed Jun 13, 2024
@damonge
Copy link
Collaborator Author

damonge commented Jun 13, 2024

And I should have said, thanks a lot to everyone who contributed here, and for bearing with me for such a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants