bugGNU source-highlight - Bugs: bug #65086, Build failure with -flto: ODR...

 
 

bug #65086: Build failure with -flto: ODR violations

Submitter:  Eli Schwartz <eschwartz>
Submitted:  Thu 28 Dec 2023 01:27:14 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 29 Dec 2023 10:30:45 PM UTC, comment #2: 
Tom Tromey <tromey>
Group administrator
Fri 29 Dec 2023 10:14:01 PM UTC, comment #1: 

I have a partial fix for this but it stumbles on an apparent bison bug, and also (maybe) a compiler bug.

Tom Tromey <tromey>
Group administrator
Thu 28 Dec 2023 01:27:14 AM UTC, original submission:  

Building source-highlight 3.1.9 fails with the following error:


```
/bin/sh ../../libtool  --tag=CXX   --mode=link x86_64-pc-linux-gnu-g++  -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -Wformat -Werror=format-security -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -std=c++14 -L/usr/lib64 -version-info 4:1:0 -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -o libsource-highlight.la -rpath /usr/lib64 fileutil.lo substfun.lo stopwatch.lo utils.lo ioexception.lo settings.lo versions.lo verbosity.lo sourcehighlight.lo styleparser.lo stylescanner.lo outlangdefparser.lo stylecssparser.lo stylecssscanner.lo outlangdefscanner.lo debuglistener.lo langmap.lo stylefileparser.lo langelem.lo statelangelem.lo langelems.lo statestartlangelem.lo stringlistlangelem.lo delimitedlangelem.lo langelemsprinter.lo namedsubexpslangelem.lo stringdef.lo highlightrule.lo highlighttoken.lo highlightstate.lo highlightrulefactory.lo highlightstateprinter.lo sourcehighlighter.lo sourcefilehighlighter.lo linenumgenerator.lo lineranges.lo regexranges.lo formatter.lo formattermanager.lo textstyle.lo textstyleformatter.lo bufferedoutput.lo preformatter.lo wordtokenizer.lo ctagscollector.lo readtags.lo ctagsformatter.lo srcuntabifier.lo textstyleformatterfactory.lo docgenerator.lo doctemplate.lo chartranslator.lo textstylebuilder.lo fileinfo.lo ctagsmanager.lo regexhighlightrule.lo regexrulefactory.lo regexpreprocessor.lo highlightstatebuilder.lo highlightbuilderexception.lo langdefmanager.lo langdefparser.lo langdefscanner.lo languageinfer.lo parserexception.lo stringtable.lo vardefinitions.lo sourcehighlightutils.lo instances.lo ../../gl/libgnu.la yywrap.lo -lboost_regex
libtool: link: x86_64-pc-linux-gnu-g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/13/crtbeginS.o  .libs/fileutil.o .libs/substfun.o .libs/stopwatch.o .libs/utils.o .libs/ioexception.o .libs/settings.o .libs/versions.o .libs/verbosity.o .libs/sourcehighlight.o .libs/styleparser.o .libs/stylescanner.o .libs/outlangdefparser.o .libs/stylecssparser.o .libs/stylecssscanner.o .libs/outlangdefscanner.o .libs/debuglistener.o .libs/langmap.o .libs/stylefileparser.o .libs/langelem.o .libs/statelangelem.o .libs/langelems.o .libs/statestartlangelem.o .libs/stringlistlangelem.o .libs/delimitedlangelem.o .libs/langelemsprinter.o .libs/namedsubexpslangelem.o .libs/stringdef.o .libs/highlightrule.o .libs/highlighttoken.o .libs/highlightstate.o .libs/highlightrulefactory.o .libs/highlightstateprinter.o .libs/sourcehighlighter.o .libs/sourcefilehighlighter.o .libs/linenumgenerator.o .libs/lineranges.o .libs/regexranges.o .libs/formatter.o .libs/formattermanager.o .libs/textstyle.o .libs/textstyleformatter.o .libs/bufferedoutput.o .libs/preformatter.o .libs/wordtokenizer.o .libs/ctagscollector.o .libs/readtags.o .libs/ctagsformatter.o .libs/srcuntabifier.o .libs/textstyleformatterfactory.o .libs/docgenerator.o .libs/doctemplate.o .libs/chartranslator.o .libs/textstylebuilder.o .libs/fileinfo.o .libs/ctagsmanager.o .libs/regexhighlightrule.o .libs/regexrulefactory.o .libs/regexpreprocessor.o .libs/highlightstatebuilder.o .libs/highlightbuilderexception.o .libs/langdefmanager.o .libs/langdefparser.o .libs/langdefscanner.o .libs/languageinfer.o .libs/parserexception.o .libs/stringtable.o .libs/vardefinitions.o .libs/sourcehighlightutils.o .libs/instances.o .libs/yywrap.o  -Wl,--whole-archive ../../gl/.libs/libgnu.a -Wl,--no-whole-archive  -L/usr/lib64 -Wl,--as-needed -lboost_regex -L/usr/lib/gcc/x86_64-pc-linux-gnu/13 -L/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-pc-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/crtn.o  -march=native -fstack-protector-all -O2 -Werror=format-security -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,-O1 -Wl,--defsym=__gentoo_check_ldflags__=0   -Wl,-soname -Wl,libsource-highlight.so.4 -o .libs/libsource-highlight.so.4.0.1
../../../lib/srchilite/styleparser.cc:203:15: error: type 'union YYSTYPE' violates the C++ One Definition Rule [-Werror=odr]
../../../lib/srchilite/outlangdefparser.cc:233:15: note: a different type is defined in another translation unit
../../../lib/srchilite/styleparser.yy:68:23: note: the first difference of corresponding definitions is field 'string'
../../../lib/srchilite/outlangdefparser.yy:64:8: note: a field with different name is defined in another translation unit
../../../lib/srchilite/styleparser.cc:391:7: error: type 'union yyalloc' violates the C++ One Definition Rule [-Werror=odr]
../../../lib/srchilite/outlangdefparser.cc:420:7: note: a different type is defined in another translation unit
../../../lib/srchilite/styleparser.cc:394:11: note: the first difference of corresponding definitions is field 'yyvs_alloc'
../../../lib/srchilite/outlangdefparser.cc:423:11: note: a field of same name but different type is defined in another translation unit
../../../lib/srchilite/styleparser.cc:391:7: note: type 'union YYSTYPE' itself violates the C++ One Definition Rule
../../../lib/srchilite/langdefparser.h:127:16: error: 'langdef_lval' violates the C++ One Definition Rule [-Werror=odr]
../../../lib/srchilite/langdefparser.cc:1411:9: note: type 'union YYSTYPE' itself violates the C++ One Definition Rule
../../../lib/srchilite/langdefparser.cc:1411:9: note: 'langdef_lval' was previously declared here
lto1: some warnings being treated as errors
lto-wrapper: fatal error: x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/libexec/gcc/x86_64-pc-linux-gnu/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[4]: * [Makefile:996: libsource-highlight.la] Error 1
```


Eli Schwartz <eschwartz>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #55482:  build.log.xz added by eschwartz (10KiB - application/x-xz)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by tromey (Posted a comment)
  • -email is unavailable- added by eschwartz (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-12-28 eschwartz Attached File- Added build.log.xz, #55482

    Back to the top

    Powered by Savane 3.13-c54d.
    Corresponding source code