nwellnhof / perl-commonmark

Perl bindings for the CommonMark C library
https://metacpan.org/release/CommonMark
Other
5 stars 7 forks source link

Failing to install on macOS: libcmark 0.21.0 or higher not found at Makefile.PL line 16. #16

Closed oalders closed 1 month ago

oalders commented 1 month ago

I may not be doing this correctly, but I figured opening an issue here would be a good starting point.

macOS: 14.5 (sonoma) arch: arm64

$ brew ls -v cmark
/opt/homebrew/Cellar/cmark/0.31.0/INSTALL_RECEIPT.json
/opt/homebrew/Cellar/cmark/0.31.0/bin/cmark
/opt/homebrew/Cellar/cmark/0.31.0/.brew/cmark.rb
/opt/homebrew/Cellar/cmark/0.31.0/include/cmark_export.h
/opt/homebrew/Cellar/cmark/0.31.0/include/cmark_version.h
/opt/homebrew/Cellar/cmark/0.31.0/include/cmark.h
/opt/homebrew/Cellar/cmark/0.31.0/sbom.spdx.json
/opt/homebrew/Cellar/cmark/0.31.0/README.md
/opt/homebrew/Cellar/cmark/0.31.0/COPYING
/opt/homebrew/Cellar/cmark/0.31.0/lib/pkgconfig/libcmark.pc
/opt/homebrew/Cellar/cmark/0.31.0/lib/cmake/cmark/cmark-targets-release.cmake
/opt/homebrew/Cellar/cmark/0.31.0/lib/cmake/cmark/cmark-config-version.cmake
/opt/homebrew/Cellar/cmark/0.31.0/lib/cmake/cmark/cmark-config.cmake
/opt/homebrew/Cellar/cmark/0.31.0/lib/cmake/cmark/cmark-targets.cmake
/opt/homebrew/Cellar/cmark/0.31.0/lib/libcmark.a
/opt/homebrew/Cellar/cmark/0.31.0/changelog.txt
/opt/homebrew/Cellar/cmark/0.31.0/share/man/man3/cmark.3
/opt/homebrew/Cellar/cmark/0.31.0/share/man/man1/cmark.1
$ PERL_MM_OPT='INC=/opt/homebrew/Cellar/cmark/0.31.0/include LIBS=/opt/homebrew/Cellar/cmark/0.31.0/lib' cpm install -g --show-build-log-on-failure CommonMark

FAIL install CommonMark-0.290000
0 distribution installed.
2024-07-19T18:30:23,60405| Running cpm 0.997017 (/Users/olaf/.plenv/versions/perl-5.40.0-RC1.tar.gz/bin/cpm) on perl 5.40.0 built for darwin-2level (/Users/olaf/.plenv/versions/perl-5.40.0-RC1.tar.gz/bin/perl5.40.0)
2024-07-19T18:30:23,60405| Command line arguments are: install -g --show-build-log-on-failure CommonMark
2024-07-19T18:30:23,60405| Work directory is /Users/olaf/.perl-cpm/work/1721428223.60405
2024-07-19T18:30:23,60405| You have make /usr/bin/make
2024-07-19T18:30:23,60405| You have HTTP::Tiny 0.088
2024-07-19T18:30:23,60405| You have tar /usr/bin/tar (bsd)
2024-07-19T18:30:23,60405| You have unzip /usr/bin/unzip
2024-07-19T18:30:23,60405| --
2024-07-19T18:30:23,60405| Summary of my perl5 (revision 5 version 40 subversion 0) configuration:
2024-07-19T18:30:23,60405|
2024-07-19T18:30:23,60405|   Platform:
2024-07-19T18:30:23,60405|     osname=darwin
2024-07-19T18:30:23,60405|     osvers=23.5.0
2024-07-19T18:30:23,60405|     archname=darwin-2level
2024-07-19T18:30:23,60405|     uname='darwin olaf-h4tjn0jbq6x9 23.5.0 darwin kernel version 23.5.0: wed may 1 20:16:51 pdt 2024; root:xnu-10063.121.3~5release_arm64_t8103 arm64 '
2024-07-19T18:30:23,60405|     config_args='-Dprefix=/Users/olaf/.plenv/versions/perl-5.40.0-RC1.tar.gz -de -Dversiononly -A'eval:scriptdir=/Users/olaf/.plenv/versions/perl-5.40.0-RC1.tar.gz/bin''
2024-07-19T18:30:23,60405|     hint=recommended
2024-07-19T18:30:23,60405|     useposix=true
2024-07-19T18:30:23,60405|     d_sigaction=define
2024-07-19T18:30:23,60405|     useithreads=undef
2024-07-19T18:30:23,60405|     usemultiplicity=undef
2024-07-19T18:30:23,60405|     use64bitint=define
2024-07-19T18:30:23,60405|     use64bitall=define
2024-07-19T18:30:23,60405|     uselongdouble=undef
2024-07-19T18:30:23,60405|     usemymalloc=n
2024-07-19T18:30:23,60405|     default_inc_excludes_dot=define
2024-07-19T18:30:23,60405|   Compiler:
2024-07-19T18:30:23,60405|     cc='cc'
2024-07-19T18:30:23,60405|     ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=14.5 -DNO_THREAD_SAFE_QUERYLOCALE -DNO_POSIX_2008_LOCALE -fno-strict-aliasing -pipe -fstack-protector-strong'
2024-07-19T18:30:23,60405|     optimize='-O3'
2024-07-19T18:30:23,60405|     cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=14.5 -DNO_THREAD_SAFE_QUERYLOCALE -DNO_POSIX_2008_LOCALE -fno-strict-aliasing -pipe -fstack-protector-strong'
2024-07-19T18:30:23,60405|     ccversion=''
2024-07-19T18:30:23,60405|     gccversion='Apple LLVM 15.0.0 (clang-1500.3.9.4)'
2024-07-19T18:30:23,60405|     gccosandvers=''
2024-07-19T18:30:23,60405|     intsize=4
2024-07-19T18:30:23,60405|     longsize=8
2024-07-19T18:30:23,60405|     ptrsize=8
2024-07-19T18:30:23,60405|     doublesize=8
2024-07-19T18:30:23,60405|     byteorder=12345678
2024-07-19T18:30:23,60405|     doublekind=3
2024-07-19T18:30:23,60405|     d_longlong=define
2024-07-19T18:30:23,60405|     longlongsize=8
2024-07-19T18:30:23,60405|     d_longdbl=define
2024-07-19T18:30:23,60405|     longdblsize=8
2024-07-19T18:30:23,60405|     longdblkind=0
2024-07-19T18:30:23,60405|     ivtype='long'
2024-07-19T18:30:23,60405|     ivsize=8
2024-07-19T18:30:23,60405|     nvtype='double'
2024-07-19T18:30:23,60405|     nvsize=8
2024-07-19T18:30:23,60405|     Off_t='off_t'
2024-07-19T18:30:23,60405|     lseeksize=8
2024-07-19T18:30:23,60405|     alignbytes=8
2024-07-19T18:30:23,60405|     prototype=define
2024-07-19T18:30:23,60405|   Linker and Libraries:
2024-07-19T18:30:23,60405|     ld='cc'
2024-07-19T18:30:23,60405|     ldflags =' -mmacosx-version-min=14.5 -fstack-protector-strong -L/usr/local/lib'
2024-07-19T18:30:23,60405|     libpth=/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/lib /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/lib /Library/Developer/CommandLineTools/usr/lib /usr/local/lib /usr/lib
2024-07-19T18:30:23,60405|     libs=
2024-07-19T18:30:23,60405|     perllibs=
2024-07-19T18:30:23,60405|     libc=
2024-07-19T18:30:23,60405|     so=dylib
2024-07-19T18:30:23,60405|     useshrplib=false
2024-07-19T18:30:23,60405|     libperl=libperl.a
2024-07-19T18:30:23,60405|     gnulibc_version=''
2024-07-19T18:30:23,60405|   Dynamic Linking:
2024-07-19T18:30:23,60405|     dlsrc=dl_dlopen.xs
2024-07-19T18:30:23,60405|     dlext=bundle
2024-07-19T18:30:23,60405|     d_dlsymun=undef
2024-07-19T18:30:23,60405|     ccdlflags=' '
2024-07-19T18:30:23,60405|     cccdlflags=' '
2024-07-19T18:30:23,60405|     lddlflags=' -mmacosx-version-min=14.5 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong'
2024-07-19T18:30:23,60405| Characteristics of this binary (from libperl):
2024-07-19T18:30:23,60405|   Compile-time options:
2024-07-19T18:30:23,60405|     HAS_LONG_DOUBLE
2024-07-19T18:30:23,60405|     HAS_STRTOLD
2024-07-19T18:30:23,60405|     HAS_TIMES
2024-07-19T18:30:23,60405|     PERLIO_LAYERS
2024-07-19T18:30:23,60405|     PERL_COPY_ON_WRITE
2024-07-19T18:30:23,60405|     PERL_DONT_CREATE_GVSV
2024-07-19T18:30:23,60405|     PERL_HASH_FUNC_SIPHASH13
2024-07-19T18:30:23,60405|     PERL_HASH_USE_SBOX32
2024-07-19T18:30:23,60405|     PERL_MALLOC_WRAP
2024-07-19T18:30:23,60405|     PERL_OP_PARENT
2024-07-19T18:30:23,60405|     PERL_PRESERVE_IVUV
2024-07-19T18:30:23,60405|     PERL_USE_SAFE_PUTENV
2024-07-19T18:30:23,60405|     USE_64_BIT_ALL
2024-07-19T18:30:23,60405|     USE_64_BIT_INT
2024-07-19T18:30:23,60405|     USE_LARGE_FILES
2024-07-19T18:30:23,60405|     USE_LOCALE
2024-07-19T18:30:23,60405|     USE_LOCALE_COLLATE
2024-07-19T18:30:23,60405|     USE_LOCALE_CTYPE
2024-07-19T18:30:23,60405|     USE_LOCALE_NUMERIC
2024-07-19T18:30:23,60405|     USE_LOCALE_TIME
2024-07-19T18:30:23,60405|     USE_PERLIO
2024-07-19T18:30:23,60405|     USE_PERL_ATOF
2024-07-19T18:30:23,60405|   Locally applied patches:
2024-07-19T18:30:23,60405|     RC1
2024-07-19T18:30:23,60405|   Built under darwin
2024-07-19T18:30:23,60405|   Compiled at May 24 2024 14:14:42
2024-07-19T18:30:23,60405|   %ENV:
2024-07-19T18:30:23,60405|     PERL_MM_OPT="INC=/opt/homebrew/Cellar/cmark/0.31.0/include LIBS=/opt/homebrew/Cellar/cmark/0.31.0/lib"
2024-07-19T18:30:23,60405|   @INC:
2024-07-19T18:30:23,60405|     /Users/olaf/.plenv/versions/perl-5.40.0-RC1.tar.gz/lib/site_perl/5.40.0/darwin-2level
2024-07-19T18:30:23,60405|     /Users/olaf/.plenv/versions/perl-5.40.0-RC1.tar.gz/lib/site_perl/5.40.0
2024-07-19T18:30:23,60405|     /Users/olaf/.plenv/versions/perl-5.40.0-RC1.tar.gz/lib/5.40.0/darwin-2level
2024-07-19T18:30:23,60405|     /Users/olaf/.plenv/versions/perl-5.40.0-RC1.tar.gz/lib/5.40.0
2024-07-19T18:30:23,60405| --
2024-07-19T18:30:23,60440,CommonMark| Resolved CommonMark (0) -> https://cpan.metacpan.org/authors/id/N/NW/NWELLNHOF/CommonMark-0.290000.tar.gz from MetaDB
2024-07-19T18:30:23,60440,CommonMark-0.290000| Using cache /Users/olaf/.perl-cpm/cache/authors/id/N/NW/NWELLNHOF/CommonMark-0.290000.tar.gz
2024-07-19T18:30:23,60440,CommonMark-0.290000| Unpacking CommonMark-0.290000.tar.gz
2024-07-19T18:30:23,60440,CommonMark-0.290000| Configuring distribution
2024-07-19T18:30:23,60440,CommonMark-0.290000| Executing /Users/olaf/.plenv/versions/perl-5.40.0-RC1.tar.gz/bin/perl5.40.0 Makefile.PL
2024-07-19T18:30:23,60440,CommonMark-0.290000| libcmark 0.21.0 or higher not found at Makefile.PL line 16.
2024-07-19T18:30:24,60440,CommonMark-0.290000| ! Retrying (you can turn off this behavior by --no-retry)
2024-07-19T18:30:24,60440,CommonMark-0.290000| Executing /Users/olaf/.plenv/versions/perl-5.40.0-RC1.tar.gz/bin/perl5.40.0 Makefile.PL
2024-07-19T18:30:24,60440,CommonMark-0.290000| libcmark 0.21.0 or higher not found at Makefile.PL line 16.
2024-07-19T18:30:24,60440,CommonMark-0.290000| Failed to configure distribution
2024-07-19T18:30:24,60405| --
2024-07-19T18:30:24,60405| Installation failed. The direct cause of the failure comes from the following packages/distributions; you may want to grep this log file by them:
2024-07-19T18:30:24,60405|  * CommonMark-0.290000
skaji commented 1 month ago

PERL_MM_OPT should be

PERL_MM_OPT='INC=-I/opt/homebrew/Cellar/cmark/0.31.0/include LIBS="-L/opt/homebrew/Cellar/cmark/0.31.0/lib -lcmark"'
oalders commented 1 month ago

Is this worth documenting somewhere for people like me?

nwellnhof commented 1 month ago

The fact that you need -lcmark is documented here: https://metacpan.org/pod/CommonMark#Installation-from-a-CPAN-tarball

oalders commented 1 month ago

For anyone interested, @haarg pointed out that this incantation works on ARM Macs:

LIBRARY_PATH=/opt/homebrew/lib CPATH=/opt/homebrew/include cpm install -g CommonMark

See also https://github.com/metacpan/metacpan-web/pull/3137