invalid LTO in static libraries prevents all use

Bug #2038385 reported by Eli Schwartz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
boost1.74 (Ubuntu)
New
Undecided
Unassigned

Bug Description

I did this:
```
git clone https://github.com/mesonbuild/meson/ /meson
cd "/meson/test cases/frameworks/1 boost/"
meson setup builddir
ninja -C builddir
```

It did not work:
```
[1/1] Linking target utf
FAILED: utf
c++ -o utf utf.p/unit_test.cpp.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.a -Wl,--end-group
during RTL pass: final
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/impl/results_reporter.ipp: In member function 'test_suite_start':
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/impl/results_reporter.ipp:76:5: internal compiler error: in ix86_print_operand_address_as, at config/i386/i386.cc:13872
during RTL pass: final
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/impl/execution_monitor.ipp: In function 'report_error.constprop':
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/impl/execution_monitor.ipp:279:1: internal compiler error: in ix86_print_operand_address_as, at config/i386/i386.cc:13872
during RTL pass: final
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/impl/xml_log_formatter.ipp: In member function 'log_entry_value':
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/impl/xml_log_formatter.ipp:171:1: internal compiler error: in ix86_print_operand_address_as, at config/i386/i386.cc:13872
during RTL pass: final
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/utils/runtime/parameter.hpp: In member function 'produce_default':
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/utils/runtime/parameter.hpp:389:5: internal compiler error: in ix86_print_operand_address_as, at config/i386/i386.cc:13872
during RTL pass: final
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/impl/unit_test_main.ipp: In function '__dt_base .constprop':
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/impl/unit_test_main.ipp:187:5: internal compiler error: in ix86_print_operand_address_as, at config/i386/i386.cc:13872
0x7fee52161a8f __libc_start_call_main
 ../sysdeps/nptl/libc_start_call_main.h:58
0x7fee52161b48 __libc_start_main_impl
 ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
make: *** [/tmp/ccGTnWEq.mk:5: /tmp/ccOUt5k5.ltrans1.ltrans.o] Error 1
make: *** Waiting for unfinished jobs....
0x7f665a03ca8f __libc_start_call_main
 ../sysdeps/nptl/libc_start_call_main.h:58
0x7f665a03cb48 __libc_start_main_impl
 ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
make: *** [/tmp/ccGTnWEq.mk:20: /tmp/ccOUt5k5.ltrans6.ltrans.o] Error 1
0x7fa714fcda8f __libc_start_call_main
 ../sysdeps/nptl/libc_start_call_main.h:58
0x7fa714fcdb48 __libc_start_main_impl
 ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
make: *** [/tmp/ccGTnWEq.mk:14: /tmp/ccOUt5k5.ltrans4.ltrans.o] Error 1
during RTL pass: final
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/framework.hpp: In member function '__ct_base .isra':
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/framework.hpp:279:98: internal compiler error: in ix86_print_operand_address_as, at config/i386/i386.cc:13872
0x7f7b87b5aa8f __libc_start_call_main
 ../sysdeps/nptl/libc_start_call_main.h:58
0x7f7b87b5ab48 __libc_start_main_impl
 ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
make: *** [/tmp/ccGTnWEq.mk:8: /tmp/ccOUt5k5.ltrans2.ltrans.o] Error 1
0x7fc570fdfa8f __libc_start_call_main
 ../sysdeps/nptl/libc_start_call_main.h:58
0x7fc570fdfb48 __libc_start_main_impl
 ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
make: *** [/tmp/ccGTnWEq.mk:17: /tmp/ccOUt5k5.ltrans5.ltrans.o] Error 1
0x7f82f4632a8f __libc_start_call_main
 ../sysdeps/nptl/libc_start_call_main.h:58
0x7f82f4632b48 __libc_start_main_impl
 ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
make: *** [/tmp/ccGTnWEq.mk:23: /tmp/ccOUt5k5.ltrans7.ltrans.o] Error 1
during RTL pass: final
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/throw_exception.hpp: In member function 'clone':
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/throw_exception.hpp:152:5: internal compiler error: in ix86_print_operand_address_as, at config/i386/i386.cc:13872
during RTL pass: final
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/utils/runtime/parameter.hpp: In member function 'produce_default':
../../../../../build/boost1.74-voy3KV/boost1.74-1.74.0/./boost/test/utils/runtime/parameter.hpp:339:5: internal compiler error: in ix86_print_operand_address_as, at config/i386/i386.cc:13872
0x7fc94e5ffa8f __libc_start_call_main
 ../sysdeps/nptl/libc_start_call_main.h:58
0x7fc94e5ffb48 __libc_start_main_impl
 ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
make: *** [/tmp/ccGTnWEq.mk:2: /tmp/ccOUt5k5.ltrans0.ltrans.o] Error 1
0x7ff8866fea8f __libc_start_call_main
 ../sysdeps/nptl/libc_start_call_main.h:58
0x7ff8866feb48 __libc_start_main_impl
 ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
make: *** [/tmp/ccGTnWEq.mk:11: /tmp/ccOUt5k5.ltrans3.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
```

There is an internal compiler error in GCC itself, but the overall issue is that it is attempting to use an LTO'ed static library:

```
$ grep VERSION= /etc/os-release
VERSION="23.04 (Lunar Lobster)"

$ gcc --version
gcc (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0

$ readelf --debug-dump /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.a| grep 'GNU C++'
    <e> DW_AT_producer : (indirect string, offset: 0x164fa): GNU C++17 12.2.0 -m64 -mtune=generic -march=x86-64 -g -g -O2 -O3 -fvisibility-inlines-hidden -flto -ffat-lto-objects -fstack-protector-strong -finline-functions -fvisibility=hidden -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection -fcf-protection
```

GCC versions mismatch, you cannot do this.

See, particularly, https://bugs.gentoo.org/900519 (GCC apparently forgot to crank the bytecode version). In general, this should not be an ICE, it should just be "lto1: fatal error: bytecode stream in file 'XXX' generated with LTO version AAA instead of the expected BBB".
"

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.