#72120 closed defect (fixed)

libavif @1.2.0: Parse error. Expected a newline, got identifier with text "ninstall".

Reported by: JohnFHall (John Hall) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.10.5
Keywords: leopard snowleopard lion mountainlion mavericks yosemite elcapitan sierra highsierra mojave catalina Cc:
Port: libavif

Description (last modified by ryandesign (Ryan Carsten Schmidt))

:info:configure CMake Error at /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_libavif/libavif/work/build/_deps/libargparse-src/CMakeLists.txt:24:
:info:configure   Parse error.  Expected a newline, got identifier with text "ninstall".
:info:configure -- Configuring incomplete, errors occurred!
:info:configure Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_libavif/libavif/work/build" && /opt/local/bin/cmake -G "Ninja" -DCMAKE_BUILD_TYPE=MacPorts -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON -DCMAKE_INSTALL_RPATH="/opt/local/lib" -Wno-dev -DAVIF_BUILD_APPS:BOOL=ON -DAVIF_CODEC_AOM=SYSTEM -DAVIF_CODEC_DAV1D=SYSTEM -DAVIF_CODEC_LIBGAV1=OFF -DAVIF_CODEC_RAV1E=OFF -DAVIF_CODEC_SVT=SYSTEM -DAVIF_ENABLE_WERROR:BOOL=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" -DCMAKE_OSX_SYSROOT="/" /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_libavif/libavif/work/libavif-1.2.0
:info:configure Exit code: 1
:error:configure Failed to configure libavif: configure failure: command execution failed
:debug:configure Error code: NONE
:debug:configure Backtrace: configure failure: command execution failed
:debug:configure     while executing
:debug:configure "$procedure $targetname"
:error:configure See /opt/local/var/macports\\/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_libavif/libavif/main.log for details.

Attachments (1)

main.log.gz (3.4 KB) - added by JohnFHall (John Hall) 12 months ago.
libavif main.log

Download all attachments as: .zip

Change History (9)

Changed 12 months ago by JohnFHall (John Hall)

Attachment: main.log.gz added

libavif main.log

comment:1 Changed 12 months ago by jmroot (Joshua Root)

Description: modified (diff)
Owner: set to mascguy

comment:2 Changed 12 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Keywords: leopard snowleopard lion mountainlion mavericks yosemite elcapitan sierra highsierra mojave catalina added
Summary: libavif @1.2.0 Fails to buildlibavif @1.2.0: Parse error. Expected a newline, got identifier with text "ninstall".

Your log shows this is happening while libavif is trying to configure a copy of libargparse that it has downloaded. While this step works for me on macOS 12, we don't want ports downloading things themselves. We have libargparse in MacPorts as a separate port; the libavif port should be fixed to use that instead of downloading and building its own copy, which will solve the problem you're having building it.

The problem probably happens because in libavif-1.2.0/cmake/Modules/LocalLibargparse.cmake it does this:

    FetchContent_Declare(
        libargparse
        GIT_REPOSITORY "https://github.com/kmurray/libargparse.git"
        GIT_TAG ${AVIF_LIBARGPARSE_GIT_TAG}
        # TODO(vrabaud) remove once CMake 3.13 is not supported anymore.
        PATCH_COMMAND
            sed -i.bak -e
            "s:install.*:include(GNUInstallDirs)\\\\ninstall(TARGETS libargparse RUNTIME DESTINATION \\\\$\\\\{CMAKE_INSTALL_BINDIR\\\\} LIBRARY DESTINATION \\\\$\\\\{CMAKE_INSTALL_LIBDIR\\\\} ARCHIVE DESTINATION \\\\$\\\\{CMAKE_INSTALL_LIBDIR\\\\}):"
            CMakeLists.txt
        UPDATE_COMMAND ""
    )

So, after downloading libargparse, it uses sed to modify some of the code in CMakeLists.txt. That modification is not being performed correctly on your system for some reason. The \\\\ninstall part of the replacement sed is supposed to be making in the file is supposed to be interpreted as a newline followed by install, but in your case, it's becoming literally ninstall. I see that you are running on macOS 10.13, and we see the same problem on our build machines running macOS 10.15 and earlier (e.g. https://build.macports.org/builders/ports-10.15_x86_64-builder/builds/206841/steps/install-port/logs/stdio) but not on macOS 11 or later. Presumably the version of BSD sed included with macOS 10.15 and earlier doesn't support the specific replacement syntax being used here.

comment:3 Changed 12 months ago by ryandesign (Ryan Carsten Schmidt)

I reported the problem to the developers of libavif: https://github.com/AOMediaCodec/libavif/issues/2653

comment:4 in reply to:  2 Changed 12 months ago by mascguy (Christopher Nielsen)

Replying to ryandesign:

Your log shows this is happening while libavif is trying to configure a copy of libargparse that it has downloaded. While this step works for me on macOS 12, we don't want ports downloading things themselves. We have libargparse in MacPorts as a separate port; the libavif port should be fixed to use that instead of downloading and building its own copy, which will solve the problem you're having building it.

Yes, I added port libargparse 2 days ago, specifically for libavif. However I haven't had a chance to fix the latter yet.

I reported the problem to the developers of libavif: ​https://github.com/AOMediaCodec/libavif/issues/2653

Thank you, it looks like upstream provided a potential patch. Hopefully that will provide a quick fix, with the longer-term solution - building with port libargparse - forthcoming over the next few days.

Version 0, edited 12 months ago by mascguy (Christopher Nielsen) (next)

comment:5 Changed 12 months ago by Christopher Nielsen <mascguy@…>

In 265d65933ed450daeb68c25999321c561f276e60/macports-ports (master):

libavif: patch for libargparse failures

See: #72120

comment:6 Changed 12 months ago by JohnFHall (John Hall)

Works for me. Thank you.

comment:7 in reply to:  6 Changed 12 months ago by mascguy (Christopher Nielsen)

Replying to JohnFHall:

Works for me. Thank you.

Great to hear, thank you for confirming!

comment:8 Changed 12 months ago by Christopher Nielsen <mascguy@…>

Resolution: fixed
Status: assignedclosed

In 9ac4fcbbeaf0aad8129b8134991d60a8470ec5a4/macports-ports (master):

libavif: use external libargparse

Fixes: #72120

Note: See TracTickets for help on using tickets.