jeffreykegler/Marpa--R2

Installation fails on MacOS

dabrahams opened this issue · 15 comments

Last login: Sun Nov 20 10:25:16 on ttys003
➜  ~ cpan Marpa::R2
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/Users/dave/.cpan/Metadata'
  Database was generated on Sun, 20 Nov 2022 17:54:01 GMT
Running install for module 'Marpa::R2'
Checksum for /Users/dave/.cpan/sources/authors/id/J/JK/JKEGL/Marpa-R2-10.000000.tar.gz ok
Configuring J/JK/JKEGL/Marpa-R2-10.000000.tar.gz with Build.PL
ld: warning: -undefined dynamic_lookup may not work with chained fixups
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Marpa-R2' version '10.000000'
  JKEGL/Marpa-R2-10.000000.tar.gz
  /usr/bin/perl Build.PL -- OK
Running Build for J/JK/JKEGL/Marpa-R2-10.000000.tar.gz
Building Marpa-R2
Writing version files
Running [/bin/sh configure --with-pic --disable-shared --disable-maintainer-mode]...
checking whether to enable maintainer-specific portions of Makefiles... no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe 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 sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-apple-darwin22.1.0
checking host system type... x86_64-apple-darwin22.1.0
checking how to print strings... printf
checking whether make 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 we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /Users/dave/brew/bin/gsed
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... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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 x86_64-apple-darwin22.1.0 file names to x86_64-apple-darwin22.1.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin22.1.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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 how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.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 (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin22.1.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... no
checking whether to build static libraries... yes
checking for gawk... (cached) awk
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking how to run the C preprocessor... gcc -E
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking for inline... inline
checking for size_t... yes
checking whether GCC handles -Wextra... -Wextra
checking whether GCC handles -Wdeclaration-after-statement... -Wdeclaration-after-statement
checking size of int... 4
checking for memset... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libmarpa.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: error: in `/Users/dave/.cpan/build/Marpa-R2-10.000000-1/libmarpa_build':
config.status: error: Something went wrong bootstrapping makefile fragments
    for automatic dependency tracking.  Try re-running configure with the
    '--disable-dependency-tracking' option to at least be able to build
    the package (albeit without support for automatic dependency tracking).
See `config.log' for more details
Failed: configure
Current directory: /Users/dave/.cpan/build/Marpa-R2-10.000000-1/libmarpa_build
Cannot run libmarpa configure at inc/Marpa/R2/Build_Me.pm line 665.
  JKEGL/Marpa-R2-10.000000.tar.gz
  ./Build -- NOT OK
➜  ~

Assigning myself for the moment at least. I don't have a MacOS box available.

The problem, according to the log, is in configure, and it suggests a workaround:

Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).

Yeah, but I don't know how to intervene in cpan's process and add a configure option.

I can look that up.

In the meantime, you might try setting MARPA_USE_PERL_AUTOCONF=1 in the environment. This bypasses configure entirely in favor of a Perl clone of autoconf.

I'd suggest trying the environment variable mentioned above first, because if I do a fix, that's probably the way I'd go.

But to add the option to configure, you need to change this line:

push @configure_command_args, qw(--with-pic --disable-shared --disable-maintainer-mode);

You'd want
push @configure_command_args, qw(--with-pic --disable-shared --disable-maintainer-mode --disable-dependency-tracking);
instead. Note that, even if this works, it's just a hack -- I'd want to add code to test for MacOs, and also read up to see if there are any implications of disabling dependency tracking on MacOs targets.

I'd test to see that this works (in the sense of being harmless) on Raspberry Pi, but I'm being forced away from the keyboard at the moment.

The environment variable workaround worked for me, thanks.

Also please see my question here

@dabrahams It remains to make a permanent fix so that the environment variable workaround for this issue will not be necessary. I'll want to research exactly what to do here.

Next step will be to set up the Build so that it uses the Perl autoconf for MacOs (so that the environment variable is unnecessary), and to create a new development release.

In commits 693a3ad and 5098029 I have changed the UPDATES.md file to include a description of this problem and the MARPA_USE_PERL_AUTOCONF=1 workaround.

In commit 48f7113, I have fixed (I hope) the issue by turning off dependency tracking for GNU's autoconf in the build. Installation builds are from scratch,and the only effect this has on builds from scratch is to speed them up.

The downside is that, if a user uses the Perl distribution for development, their dependencies may get out of sync, causing objects that should be re-built not to be re-built. To my knowledge, since the git repo was created, all development has taken place in the git repo. A developer who really wants to use the Perl distribution for development, instead of the repo, can either avoid changing the dependencies, or remove the all the object files every time they build.

My next step will be to create a developer's release and upload it to CPAN. This will get this fix tested on the problematic systems.

With developer's release https://metacpan.org/release/JKEGL/Marpa-R2-11.001_000, this issue is fixed and the fix tested. The fix was to make --disable-dependency-tracking the default. Since installations are a one time build, sources are not changed and therefore there are no changes in the dependencies to track, so tracking dependencies was never necessary. As a by-product builds will be slightly faster.

The next stable release will contain this fix. Absent feedback to the contrary I will close this issue in a couple of days.