Trying to compile on Apple M1

Issue #83 resolved
GMS103 created an issue

I am trying to compile M4RIE on an Apple M1 Mac (to address https://trac.sagemath.org/ticket/33212).

This failed (see https://bitbucket.org/malb/m4rie/issues/23/trying-to-compile-on-apple-m1), so I tried compiling M4RI first. This is what I did:

% git clone https://bitbucket.org/malb/m4ri.git
Cloning into 'm4ri'...
Receiving objects: 100% (4757/4757), 1.12 MiB | 2.51 MiB/s, done.
Resolving deltas: 100% (3725/3725), done.
% cd m4ri
% autoreconf --install         
glibtoolize: putting auxiliary files in '.'.
glibtoolize: copying file './ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
glibtoolize: copying file 'm4/libtool.m4'
glibtoolize: copying file 'm4/ltoptions.m4'
glibtoolize: copying file 'm4/ltsugar.m4'
glibtoolize: copying file 'm4/ltversion.m4'
glibtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:24: warning: The macro `AC_PROG_CC_C99' is obsolete.
configure.ac:24: You should run autoupdate.
./lib/autoconf/c.m4:1659: AC_PROG_CC_C99 is expanded from...
configure.ac:24: the top level
configure.ac:68: warning: The macro `AC_TRY_RUN' is obsolete.
configure.ac:68: You should run autoupdate.
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/ax_func_posix_memalign.m4:27: AX_FUNC_POSIX_MEMALIGN is expanded from...
configure.ac:68: the top level
configure.ac:209: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:209: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
./lib/autoconf/general.m4:1534: AC_ARG_ENABLE is expanded from...
configure.ac:209: the top level
configure.ac:16: installing './compile'
configure.ac:3: installing './config.guess'
configure.ac:3: installing './config.sub'
configure.ac:7: installing './install-sh'
configure.ac:7: installing './missing'
Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'
% autoupdate
configure.ac:24: warning: AC_PROG_CC_C99 is obsolete; use AC_PROG_CC

% autoreconf --install
configure.ac:24: warning: AC_PROG_CC_C99 is obsolete; use AC_PROG_CC
configure.ac:27: warning: ac_ext=c
configure.ac:27: ac_cpp='$CPP $CPPFLAGS'
configure.ac:27: ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
configure.ac:27: ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
configure.ac:27: ac_compiler_gnu=$ac_cv_c_compiler_gnu
configure.ac:27: if test -n "$ac_tool_prefix"; then
configure.ac:27:   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
configure.ac:27: set dummy ${ac_tool_prefix}gcc; ac_word=$2
configure.ac:27: { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
configure.ac:27: printf %s "checking for $ac_word... " >&6; }
configure.ac:27: if test ${ac_cv_prog_CC+y}
configure.ac:27: then :
configure.ac:27:   printf %s "(cached) " >&6
configure.ac:27: else $as_nop
configure.ac:27:   if test -n "$CC"; then
configure.ac:27:   ac_cv_prog_CC="$CC" # Let the user override the test.
configure.ac:27: else
configure.ac:27: as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
configure.ac:27: for as_dir in $PATH
configure.ac:27: do
configure.ac:27:   IFS=$as_save_IFS
configure.ac:27:   case $as_dir in #(((
configure.ac:27:     '' is m4_require'd but not m4_defun'd
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/programs.m4:41: _AC_CHECK_PROG is expanded from...
./lib/autoconf/programs.m4:101: AC_CHECK_PROG is expanded from...
./lib/autoconf/programs.m4:221: AC_CHECK_TOOL is expanded from...
./lib/autoconf/c.m4:452: AC_PROG_CC is expanded from...
configure.ac:27: the top level
configure.ac:71: warning: The macro `AC_TRY_RUN' is obsolete.
configure.ac:71: You should run autoupdate.
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
m4/ax_func_posix_memalign.m4:27: AX_FUNC_POSIX_MEMALIGN is expanded from...
configure.ac:71: the top level
% 

But then ./configure had 2 syntax errors, so I modified it as follows:

% diff configure_ORIG configure           
12575,12576c12575
<     ''
<  as_dir=./ ;;
---
>     '') as_dir=./ ;;
13474c13473
< )
---
> #)
% 

and then

% ./configure                  
checking build system type... aarch64-apple-darwin21.2.0
checking host system type... aarch64-apple-darwin21.2.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make -j20 sets $(MAKE)... yes
checking whether make -j20 supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make -j20 supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786432
checking how to convert aarch64-apple-darwin21.2.0 file names to aarch64-apple-darwin21.2.0 format... func_convert_file_noop
checking how to convert aarch64-apple-darwin21.2.0 file names to toolchain format... func_convert_file_noop
checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin21.2.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gcc... (cached) gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to enable C11 features... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for x86 cpuid  output... unknown
checking for x86-AVX xgetbv  output... unknown
checking for mm_malloc.h... yes
checking for working posix_memalign... yes
checking for PAPI_start_counters in -lpapi... no
checking for x86 cpuid 0x0 output... unknown
checking for the processor vendor... Unknown
checking for x86 cpuid 0x0 output... (cached) unknown
checking for the processor vendor... (cached) Unknown
checking the L1 cache size... 65536 Bytes
checking the L2 cache size... 4194304 Bytes
checking the L3 cache size... 4194304 Bytes
checking whether to build with PNG support... yes
checking for pkg-config... /opt/homebrew/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for PNG... yes
checking whether make -j20 sets $(MAKE)... (cached) yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating tests/Makefile
config.status: creating bench/Makefile
config.status: creating m4ri/m4ri_config.h
config.status: creating m4ri.pc
config.status: creating m4ri/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
% make
make -j20  all-recursive
Making all in .
make[2]: warning: -jN forced in submake: disabling jobserver mode.
  CC       m4ri/misc.lo
  CC       m4ri/brilliantrussian.lo
  CC       m4ri/mzd.lo
  CC       m4ri/strassen.lo
  CC       m4ri/graycode.lo
  CC       m4ri/triangular.lo
  CC       m4ri/ple_russian.lo
  CC       m4ri/mzp.lo
  CC       m4ri/ple.lo
  CC       m4ri/triangular_russian.lo
  CC       m4ri/solve.lo
  CC       m4ri/debug_dump.lo
  CC       m4ri/echelonform.lo
  CC       m4ri/djb.lo
  CC       m4ri/io.lo
  CC       m4ri/mmc.lo
  CC       m4ri/mp.lo
m4ri/io.c:36:29: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
         mzd_density(A, 1), mzd_hash(A));
                            ^~~~~~~~~~~
1 warning generated.
  CCLD     libm4ri.la
Making all in tests
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: Nothing to be done for `all'.
% make check
make -j20  check-recursive
Making check in .
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: Nothing to be done for `check-am'.
Making check in tests
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make -j20  test_elimination test_multiplication test_trsm test_ple test_pluq test_solve test_kernel test_random test_smallops test_transpose test_colswap test_misc test_invert test_alignment test_djb
make[3]: warning: -jN forced in submake: disabling jobserver mode.
  CC       test_elimination.o
  CC       test_trsm.o
  CC       test_multiplication.o
  CC       test_ple.o
  CC       test_solve.o
  CC       test_kernel.o
  CC       test_smallops.o
  CC       test_pluq.o
  CC       testing.o
  CC       test_random.o
  CC       test_colswap.o
  CC       test_transpose.o
  CC       test_misc.o
  CC       test_invert.o
  CC       test_alignment.o
  CC       test_djb.o
  CCLD     test_elimination
  CCLD     test_solve
  CCLD     test_colswap
  CCLD     test_invert
  CCLD     test_djb
  CCLD     test_alignment
  CCLD     test_kernel
  CCLD     test_random
  CCLD     test_smallops
  CCLD     test_transpose
  CCLD     test_multiplication
  CCLD     test_misc
  CCLD     test_ple
  CCLD     test_trsm
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: assuming '-no-fast-install' instead
  CCLD     test_pluq
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.2.0
libtool: warning: assuming '-no-fast-install' instead
make -j20  check-TESTS
make[3]: warning: -jN forced in submake: disabling jobserver mode.
make[4]: warning: -jN forced in submake: disabling jobserver mode.
PASS: test_random
PASS: test_alignment
PASS: test_kernel
PASS: test_smallops
PASS: test_colswap
PASS: test_misc
PASS: test_solve
PASS: test_ple
PASS: test_pluq
PASS: test_trsm
PASS: test_elimination
PASS: test_transpose
PASS: test_invert
PASS: test_multiplication
PASS: test_djb
============================================================================
Testsuite summary for m4ri 20200125
============================================================================
# TOTAL: 15
# PASS:  15
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
% sudo make install
Password:
/Library/Developer/CommandLineTools/usr/bin/make  install-recursive
Making install in .
 ./install-sh -c -d '/usr/local/lib'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   libm4ri.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libm4ri-0.0.20200125.dylib /usr/local/lib/libm4ri-0.0.20200125.dylib
libtool: install: (cd /usr/local/lib && { ln -s -f libm4ri-0.0.20200125.dylib libm4ri.dylib || { rm -f libm4ri.dylib && ln -s libm4ri-0.0.20200125.dylib libm4ri.dylib; }; })
libtool: install: /usr/bin/install -c .libs/libm4ri.lai /usr/local/lib/libm4ri.la
libtool: install: /usr/bin/install -c .libs/libm4ri.a /usr/local/lib/libm4ri.a
libtool: install: chmod 644 /usr/local/lib/libm4ri.a
libtool: install: ranlib /usr/local/lib/libm4ri.a
 ./install-sh -c -d '/usr/local/include/m4ri'
 /usr/bin/install -c -m 644 m4ri/m4ri_config.h '/usr/local/include/m4ri'
 ./install-sh -c -d '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 m4ri.pc '/usr/local/lib/pkgconfig'
 ./install-sh -c -d '/usr/local/include/m4ri'
 /usr/bin/install -c -m 644 m4ri/m4ri.h m4ri/brilliantrussian.h m4ri/misc.h m4ri/mzd.h m4ri/graycode.h m4ri/strassen.h m4ri/parity.h m4ri/mzp.h m4ri/triangular.h m4ri/triangular_russian.h m4ri/ple.h m4ri/ple_russian.h m4ri/ple_russian_template.h m4ri/solve.h m4ri/echelonform.h m4ri/xor.h m4ri/xor_template.h m4ri/mmc.h m4ri/debug_dump.h m4ri/io.h m4ri/djb.h m4ri/mp.h '/usr/local/include/m4ri'
Making install in tests
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
% 

Comments (9)

  1. GMS103 reporter

    I just compiled M4RI on an Apple Silicon M1 Mac under macOS 12.3 (Monterey) with Xcode 13.3.

    make: There was 1 warning:

    m4ri/io.c:36:29: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
             mzd_density(A, 1), mzd_hash(A));
                                ^~~~~~~~~~~
    

    make check: There were several warnings:

    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: '-no-install' is ignored for aarch64-apple-darwin21.4.0
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    libtool: warning: assuming '-no-fast-install' instead
    

    The tests succeeded:

    ============================================================================
    Testsuite summary for m4ri 20200125
    ============================================================================
    # TOTAL: 15
    # PASS:  15
    # SKIP:  0
    # XFAIL: 0
    # FAIL:  0
    # XPASS: 0
    # ERROR: 0
    ============================================================================
    

    HTH

  2. Log in to comment