Opened 3 years ago

Closed 3 years ago

#62801 closed defect (fixed)

lilypond 2.22.1_0: fails to build (macOS 11.3)

Reported by: emcrisostomo (Enrico Maria Crisostomo) Owned by: nerdling (Jeremy Lavergne)
Priority: Normal Milestone:
Component: ports Version:
Keywords: bigsur x86_64 Cc: rpspringuel (Fr. Samuel Springuel), ryandesign (Ryan Carsten Schmidt)
Port: lilypond

Description

Build fails with:

:info:build 12 warnings generated.
:info:build 10 warnings generated.
:info:build 11 warnings and 9 errors generated.
:info:build 6 warnings generated.
:info:build gnumake[1]: *** [out/lily-lexer.o] Error 1
:info:build 10 warnings generated.
:info:build 10 warnings generated.
:info:build In file included from lily-parser-scheme.cc:26:
:info:build In file included from /opt/local/var/macports/build/_Users_enrico_repos_github_macports-ports_textproc_lilypond/lilypond/work/lilypond-2.22.1/lily/include/lily-lexer.hh:23:
:info:build In file included from /opt/local/var/macports/build/_Users_enrico_repos_github_macports-ports_textproc_lilypond/lilypond/work/lilypond-2.22.1/lily/include/includable-lexer.hh:24:
:info:build /opt/local/include/FlexLexer.h:132:8: error: 'yy_switch_to_buffer' overrides a member function but is not marked 'override' [-Werror,-Wsuggest-override]
:info:build   void yy_switch_to_buffer( yy_buffer_state* new_buffer );
:info:build        ^

Full log attached.

Attachments (1)

main.log (2.3 MB) - added by emcrisostomo (Enrico Maria Crisostomo) 3 years ago.
lilypond build log

Change History (12)

Changed 3 years ago by emcrisostomo (Enrico Maria Crisostomo)

Attachment: main.log added

lilypond build log

comment:1 Changed 3 years ago by jmroot (Joshua Root)

Owner: set to nerdling
Status: newassigned

comment:2 Changed 3 years ago by ggruener

I can confirm the problem when upgrading to lilypond-2.22.1_0 on macOS 11.3 and Xcode 12.5.

Editing by hand /opt/local/include/FlexLexer.h to add the override keyword at line 132 fixes the problem and lilypond is upgraded correctly.

$ diff /opt/local/include/FlexLexer.h /opt/local/include/FlexLexer.old
132c132
<   void yy_switch_to_buffer( yy_buffer_state* new_buffer ) override;
---
>   void yy_switch_to_buffer( yy_buffer_state* new_buffer );

The problem, though, should be fixed by port flex, responsible for this file:

$ port provides /opt/local/include/FlexLexer.h
/opt/local/include/FlexLexer.h is provided by: flex

nerdling would you open a corresponding ticker there?

comment:3 in reply to:  2 Changed 3 years ago by exaos (Exaos Lee)

This solution works! Thanks a lot!

Replying to ggruener:

I can confirm the problem when upgrading to lilypond-2.22.1_0 on macOS 11.3 and Xcode 12.5.

Editing by hand /opt/local/include/FlexLexer.h to add the override keyword at line 132 fixes the problem and lilypond is upgraded correctly.

$ diff /opt/local/include/FlexLexer.h /opt/local/include/FlexLexer.old
132c132
<   void yy_switch_to_buffer( yy_buffer_state* new_buffer ) override;
---
>   void yy_switch_to_buffer( yy_buffer_state* new_buffer );

The problem, though, should be fixed by port flex, responsible for this file:

$ port provides /opt/local/include/FlexLexer.h
/opt/local/include/FlexLexer.h is provided by: flex

nerdling would you open a corresponding ticker there?

comment:4 Changed 3 years ago by rpspringuel (Fr. Samuel Springuel)

Cc: rpspringuel added

comment:5 Changed 3 years ago by nerdling (Jeremy Lavergne)

Cc: ryandesign added

@ryandesign: is this a flex issue?

comment:6 Changed 3 years ago by emcrisostomo (Enrico Maria Crisostomo)

That line in FlexLexer.h hasn't been modified at least in the past 6 years. I guess this is not 'just a flex issue': C++11 introduced the override specifier, and compiler settings (-Werror,-Wsuggest-override) are now forcing this warning to be treated as an error. We could:

  • Open an issue upstream to updated flex and make it more C++11 friendly.
  • Temporarily fix FlexLexer.h, but I guess the solution would be more complex than just adding the override specifier to the yyFlexLexer::yy_switch_to_buffer member function as @ggruener found out: it would need to be C++-version aware, otherwise it would fail to compile with older compilers.
  • Modify the compiler settings to disable that error (I don't really feel comfortable with relaxing compiler settings this way).
  • Temporarily patch the lilypond sources so that a private version of the flex headers are copied in the build directory, patched, and compiled.

Any other ideas?

I've open an issue upstream: https://github.com/westes/flex/issues/486

If all this is correct, I would define an OVERRIDE macro conditionally, depending on C++ version, and I'm willing to patch flex sources and send a PR upstream. Anybody willing to sanity-check this reasoning?

Last edited 3 years ago by emcrisostomo (Enrico Maria Crisostomo) (previous) (diff)

comment:7 Changed 3 years ago by juanalexei

Reproduced for liltpond-devel also with MacOs 11.4 on Apple Silicon. The work around is also effective. Thanks!

comment:8 Changed 3 years ago by emcrisostomo (Enrico Maria Crisostomo)

Flex upstream provided an answer: https://github.com/westes/flex/issues/486#issuecomment-850868673

To make a long story short, a more ambitious restructuring of flex is in progress, and it'll take time.

According to upstream's suggestion, tt seems like the easiest thing to do would be copying FlexLexer.h in the build directory, patching it, and the overriding the relevant include dir, which is fortunately already being taken care of in configure.ac:

AC_ARG_WITH(flexlexer-dir,
    [AS_HELP_STRING([--with-flexlexer-dir=DIR],
                    [location of FlexLexer.h.])],

comment:9 Changed 3 years ago by emcrisostomo (Enrico Maria Crisostomo)

@nerdling, everybody, I've just pushed a WIP PR: https://github.com/macports/macports-ports/pull/11183

The --with-flexlexer-dir argument is not propagated to CPPFLAGS, hence the two patch files, one to update CPPFLAGS in configure.ac and the other to patch FlexLexer.h.

comment:10 Changed 3 years ago by emcrisostomo (Enrico Maria Crisostomo)

Just pushed the latest changed to PR https://github.com/macports/macports-ports/pull/11183, to fix the same issue in lilypond-devel. I'll remove the WIP today.

comment:11 Changed 3 years ago by emcrisostomo (Enrico Maria Crisostomo)

Resolution: fixed
Status: assignedclosed

In 877b2f93bbdfdeac135d9ab072ec203c6f7200a6/macports-ports (master):

WIP: lilypond: fix 62801

Closes: #62801

Note: See TracTickets for help on using tickets.