mupen64plus / mupen64plus-core

Core module of the Mupen64Plus project
1.29k stars 257 forks source link

lto1: fatal error: bytecode stream in file ‘_obj/api/callbacks.o’ generated with LTO version 7.3 instead of the expected 8.1 compilation terminated. #942

Open BlackMage2 opened 2 years ago

BlackMage2 commented 2 years ago

i get this error on a compilation try

LD libmupen64plus.so.2.0.0 lto1: fatal error: bytecode stream in file ‘_obj/api/callbacks.o’ generated with LTO version 7.3 instead of the expected 8.1 compilation terminated. lto-wrapper: fatal error: g++ returned 1 exit status compilation terminated. /usr/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status

how can it be fixed? i am on ubuntu 20.04 LTS

Jj0YzL5nvJ commented 2 years ago

Override CC and CXX, the defaults are crap.

BlackMage2 commented 2 years ago

what version is known to working?

i get ever an an lto1: fatal error: bytecode stream in file ‘_obj/api/callbacks.o’ generated with LTO version 7.3 instead of the expected 8.1 compilation terminated. error

BlackMage2 commented 2 years ago

i have tried it with gcc/g++ 7, 8 and 9, nothing working, i get ever the LTO version error

or you mean the paramaters? I have no idea which parameters are needed there.

Jj0YzL5nvJ commented 2 years ago

Something like: make CC="gcc-9" CXX="g++-9" BITS="64" SDL_CONFIG="sdl2-config" NEW_DYNAREC="1" all -j2

or you mean the paramaters? I have no idea which parameters are needed there.

https://github.com/mupen64plus/mupen64plus-core#2-building-from-source https://gist.github.com/Jj0YzL5nvJ/5242753837eed35768e61c240f572ecd

As a last resort you can use export OPTFLAGS="-O2 -fno-lto" before building.

BlackMage2 commented 2 years ago

with _make CC="gcc-9" CXX="g++-9" BITS="64" SDLCONFIG="sdl2-config" NEW_DYNAREC="1" all -j2 i get AS _obj/device/r4300/new_dynarec/x64/linkage_x64.o ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:179: error: symboloffsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:181: error: symbol offsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:183: error: symboloffsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:184: error: symbol offsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:185: error: symboloffsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:192: error: label _E1' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:194: error: symboloffsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:198: error: label _E2' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:201: error: labelnew_dyna_stop' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:216: error: label do_interrupt' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:217: error: symboloffsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:220: error: symbol offsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:222: error: symboloffsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:225: error: label fp_exception' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:226: error: symboloffsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:230: error: label jump_syscall' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:231: error: symboloffsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:235: error: label jump_eret' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:236: error: symboloffsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:238: error: symbol offsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:243: error: labeldyna_linker' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:247: error: label dyna_linker_ds' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:251: error: labelnew_dyna_start' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:266: error: symbol offsetof_struct_r4300_core_new_dynarec_hot_state' undefined ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:270: error: labelinvalidate_block_eax' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:274: error: label invalidate_block_edi' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:278: error: labelinvalidate_block_edx' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:282: error: label invalidate_block_ebx' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:286: error: labelinvalidate_block_ebp' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:290: error: label invalidate_block_esi' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:294: error: labelinvalidate_block_ecx' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:297: error: label invalidate_block_call' changed during code generation [-w+error=label-redef-late] ../../src/device/r4300/new_dynarec/x64/linkage_x64.asm:303: error: labelbreakpoint' changed during code generation [-w+error=label-redef-late] make: *** [Makefile:802: _obj/device/r4300/new_dynarec/x64/linkage_x64.o] Error 1 `

Jj0YzL5nvJ commented 2 years ago

make: *** [Makefile:802: _obj/device/r4300/new_dynarec/x64/linkage_x64.o] Error 1

sudo apt-get -y install nasm

BlackMage2 commented 2 years ago

nasm is already installed NASM version 2.14.02

Jj0YzL5nvJ commented 2 years ago

I have no idea how the build process could be messed up like that... Unless you have an old core API installed, uninstall any mupen64plus related software.

Then try:

sudo apt-get update
sudo apt-get -y install libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libsdl2-dev nasm zlib1g-dev
sudo apt-get --reinstall -y install gcc-multilib g++-multilib libc6 libc6-dev-i386
sudo ldconfig
cd ${HOME}
rm -rf /tmp/build
mkdir /tmp/build
cd /tmp/build
git config --global core.autocrlf false
git clone https://github.com/mupen64plus/mupen64plus-core.git
make -C mupen64plus-core/projects/unix clean
make CC="gcc-9" CXX="g++-9" NO_ASM="1" -C mupen64plus-core/projects/unix all -j4

If that worked, then try:

make -C mupen64plus-core/projects/unix clean
make CC="gcc-9" CXX="g++-9" NEW_DYNAREC="0" -C mupen64plus-core/projects/unix all -j4

If that worked, then try:

make -C mupen64plus-core/projects/unix clean
make CC="gcc-9" CXX="g++-9" NEW_DYNAREC="1" -C mupen64plus-core/projects/unix all -j4
BlackMage2 commented 2 years ago

and how can i fix /usr/bin/ld: /tmp/mupen64plus.99kamW.ltrans0.ltrans.o: relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: failed to set dynamic section sizes: bad value

Jj0YzL5nvJ commented 2 years ago

WTF... that's abnormal, PIE is for executables, not libraries. PIC is the equivalent of PIE for libraries but Ubuntu normally wouldn't ask you to use either with GCC.

Run:

apt list -a gcc-9
gcc-9 -v

And post the outputs...

Are you sure that error does not belong to mupen64plus-ui-console?

Adding the parameters PIC="1" for libraries and PIE="1" for executables can fix the respective builds.

BlackMage2 commented 2 years ago

here the outputs of the commands

$ gcc-9 -v Using built-in specs. COLLECT_GCC=gcc-9 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:hsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-5ubuntu1 --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-bVKGhJ/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 9.4.0 (Ubuntu 9.4.0-5ubuntu1) $ apt list -a gcc-9 Listing... Done gcc-9/jammy,now 9.4.0-5ubuntu1 amd64 [installed,automatic]

gcc-9/jammy 9.4.0-5ubuntu1 i386

i am at ubuntu 22.04-proposed

Jj0YzL5nvJ commented 2 years ago

--enable-shared --enable-default-pie

Your GCC compiler has PIE and shared enabled by default, which I belief it means you'll need to enable PIE for every new application built with dependencies with the compiler... which seems like a pain in the ass to me... I don't know if you have to use PIC on the libraries used for such applications to work properly, I have no idea...

BlackMage2 commented 2 years ago

I do not know either. how do i solve the problem now?

BlackMage2 commented 2 years ago

its the default gcc-9 in jammy

Jj0YzL5nvJ commented 2 years ago

Try:

rm -rf /tmp/build
mkdir /tmp/build
cd /tmp/build
git clone https://github.com/mupen64plus/mupen64plus-core.git
make -C mupen64plus-core/projects/unix clean
make CC="gcc-9" CXX="g++-9" NO_ASM="1" PIC="0" -C mupen64plus-core/projects/unix all -j4

If that fails, try:

make -C mupen64plus-core/projects/unix clean
make CC="gcc-9" CXX="g++-9" NO_ASM="1" PIC="1" -C mupen64plus-core/projects/unix all -j4

The ideal would be to compile without NO_ASM=1 and compile with NEW_DYNAREC=1, but if the first parameter fails, surely the second will fail as well. Consider installing a newer GCC or installing Clang. I personally prefer Clang over GCC for my personal binaries.

P.S: Don't uninstall the old versions of GCC if they don't conflict with the new ones.