ppsspp icon indicating copy to clipboard operation
ppsspp copied to clipboard

Error trying to compile for arm64 linux

Open kero990 opened this issue 3 years ago • 24 comments

Platform

Linux / BSD

Compiler and build tool versions

gcc (Debian 8.3.0-6) 8.3.0

Operating system version

debian10

Build commands used

make ./b.sh

What happens

The error results obtained using qt and direct make are almost the same

/usr/bin/ld: /usr/bin/ld: DWARF error: can't find .debug_ranges section.
../ffmpeg/linux/aarch64/lib/libavcodec.a(utils.o): in function `default_lockmgr_cb':
utils.c:(.text+0xac): undefined reference to `__aarch64_cas8_acq_rel'
/usr/bin/ld: utils.c:(.text+0xfc): undefined reference to `__aarch64_cas8_acq_rel'
/usr/bin/ld: ../ffmpeg/linux/aarch64/lib/libavcodec.a(utils.o): in function `av_register_hwaccel':
utils.c:(.text+0x5550): undefined reference to `__aarch64_cas8_acq_rel'
/usr/bin/ld: ../ffmpeg/linux/aarch64/lib/libavcodec.a(utils.o): in function `ff_unlock_avcodec':
utils.c:(.text+0x5a08): undefined reference to `__aarch64_ldadd4_acq_rel'
/usr/bin/ld: ../ffmpeg/linux/aarch64/lib/libavcodec.a(utils.o): in function `ff_lock_avcodec':
utils.c:(.text+0x5acc): undefined reference to `__aarch64_ldadd4_acq_rel'
/usr/bin/ld: ../ffmpeg/linux/aarch64/lib/libavcodec.a(utils.o): in function `avcodec_register':
utils.c:(.text.unlikely+0x50): undefined reference to `__aarch64_cas8_acq_rel'
/usr/bin/ld: /usr/bin/ld: DWARF error: can't find .debug_ranges section.
../ffmpeg/linux/aarch64/lib/libavformat.a(format.o): in function `av_register_input_format':
format.c:(.text+0x78): undefined reference to `__aarch64_cas8_acq_rel'
/usr/bin/ld: ../ffmpeg/linux/aarch64/lib/libavformat.a(format.o): in function `av_register_output_format':
format.c:(.text+0xe0): undefined reference to `__aarch64_cas8_acq_rel'
/usr/bin/ld: /usr/bin/ld: DWARF error: can't find .debug_ranges section.
../ffmpeg/linux/aarch64/lib/libavcodec.a(bitstream_filter.o): in function `av_register_bitstream_filter':
bitstream_filter.c:(.text+0x4c): undefined reference to `__aarch64_cas8_acq_rel'
/usr/bin/ld: /usr/bin/ld: DWARF error: can't find .debug_ranges section.
../ffmpeg/linux/aarch64/lib/libavcodec.a(parser.o): in function `av_register_codec_parser':
parser.c:(.text+0x4c): undefined reference to `__aarch64_cas8_acq_rel'
/usr/bin/ld: /usr/bin/ld: DWARF error: can't find .debug_ranges section.
../ffmpeg/linux/aarch64/lib/libavcodec.a(error_resilience.o): in function `ff_er_add_slice':
error_resilience.c:(.text+0xe6c): undefined reference to `__aarch64_ldadd4_acq_rel'
/usr/bin/ld: error_resilience.c:(.text+0xf2c): undefined reference to `__aarch64_ldadd4_acq_rel'
/usr/bin/ld: error_resilience.c:(.text+0xf60): undefined reference to `__aarch64_ldadd4_acq_rel'
/usr/bin/ld: /usr/bin/ld: DWARF error: can't find .debug_ranges section.
../ffmpeg/linux/aarch64/lib/libavutil.a(buffer.o): in function `pool_release_buffer':
buffer.c:(.text+0x58): undefined reference to `__aarch64_ldadd4_acq_rel'
/usr/bin/ld: ../ffmpeg/linux/aarch64/lib/libavutil.a(buffer.o): in function `av_buffer_ref':
buffer.c:(.text+0x2e8): undefined reference to `__aarch64_ldadd4_acq_rel'
/usr/bin/ld: ../ffmpeg/linux/aarch64/lib/libavutil.a(buffer.o):buffer.c:(.text+0x33c): more undefined references to `__aarch64_ldadd4_acq_rel' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/PPSSPPSDL.dir/build.make:618: PPSSPPSDL] Error 1
make[1]: *** [CMakeFiles/Makefile2:391: CMakeFiles/PPSSPPSDL.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

I just want to get a ppsspp that works on arm64 linux, and for some reason I need it to work on at least debian10 (glibc2.28), I don't know where to get the compiled binaries. So just try it yourself.

PPSSPP version affected

master

Last working version

No response

Checklist

  • [X] Test in the latest git build in case it's already fixed.
  • [X] Make sure to run git submodule update --init --recursive before building.
  • [X] Search for other reports of the same issue.
  • [X] Try deleting the build directory and running the build again.
  • [ ] Check GitHub Actions, which builds every merge and PR.
  • [ ] Include logs and help us reproduce.

kero990 avatar Aug 08 '22 07:08 kero990

Guessing that the platform needs -latomic for one reason or another, could you try adding that to the linked libraries somewhere in CMakeLists.txt?

hrydgard avatar Aug 08 '22 08:08 hrydgard

Guessing that the platform needs -latomic for one reason or another, could you try adding that to the linked libraries somewhere in CMakeLists.txt?

Sorry, I'm just a newbie and this CMakeLists.txt is too complicated for me. Where do I need to write the -latomic parameter?

By the way, I found ppsspp for arm64 in the ppa. But it's version 1.7 in 2018. This version of the qt window interface language option seems to be separate, I found the .ts language file, but I don't know where to put it to call it?

kero990 avatar Aug 08 '22 08:08 kero990

It looks like maybe this line:

if(ANDROID OR (LINUX AND ARM_DEVICE))

could be changed to

if(ANDROID OR (LINUX AND (ARM_DEVICE OR ARM64)))

Could you try that?

As for the qt stuff, it's been a bit neglected for a long time unfortunately, due to lack of interest.

hrydgard avatar Aug 08 '22 08:08 hrydgard

I followed your instructions and got the exact same result, it shouldn't have worked. I've tried re-cmake and make clean with the same result.

Although I'm a novice, this new statement is preceded by "ARM_DEVICE" and followed by "ARM64", are you sure it's not "ARM64_DEVICE"?

kero990 avatar Aug 08 '22 09:08 kero990

Yeah should be ARM64, the variables in our CMakeLists.txt are named a bit inconsistently...

I guess that's not it then. Hm.

Googled around a bit, maybe there are some clues...

https://bugzilla.redhat.com/show_bug.cgi?id=1830472

https://www.mail-archive.com/[email protected]/msg1802783.html

Sounds like maybe -mno-outline-atomics in the right spot could help, but a bit afraid of breaking other builds. Seems like a Debian bug, really? But try this somewhere early:

add_compile_options(-mno-outline-atomics)

hrydgard avatar Aug 08 '22 10:08 hrydgard

Very sorry, but still the same question, where should I write this sentence? Or as a parameter to make I don't necessarily have to compile it on debian, but I want to make sure it works on glibc2.28, so far I haven't found a ready-made compiler that meets the requirements. Maybe I should try ubuntu18?

kero990 avatar Aug 08 '22 12:08 kero990

That one should work (if it does) almost anywhere in the file, say after the line add_definitions(-D__STDC_CONSTANT_MACROS) for example. Though, if it doesn't work, I'm running out of ideas...

hrydgard avatar Aug 08 '22 12:08 hrydgard

Please try running ./linux_arm64.sh in ffmpeg (i.e. pushd ffmpeg && ./linux_arm64.sh && popd) and then try to compile PPSSPP again.

-[Unknown]

unknownbrackets avatar Aug 08 '22 13:08 unknownbrackets

This time it was wrong at the beginning

inpur@inpur-PC:~/ppsspp/build$ make clean
inpur@inpur-PC:~/ppsspp/build$ make -j4
Scanning dependencies of target snappy
Scanning dependencies of target gason
Scanning dependencies of target libzip
Scanning dependencies of target udis86
[  0%] Building CXX object CMakeFiles/gason.dir/ext/gason/gason.cpp.o
[  0%] Building CXX object ext/snappy/CMakeFiles/snappy.dir/snappy-c.cpp.o
c++: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [CMakeFiles/gason.dir/build.make:63:CMakeFiles/gason.dir/ext/gason/gason.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:291:CMakeFiles/gason.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务....
c++: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [ext/snappy/CMakeFiles/snappy.dir/build.make:63:ext/snappy/CMakeFiles/snappy.dir/snappy-c.cpp.o] 错误 1
[  0%] Building C object ext/udis86/CMakeFiles/udis86.dir/decode.c.o
make[1]: *** [CMakeFiles/Makefile2:2240:ext/snappy/CMakeFiles/snappy.dir/all] 错误 2
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [ext/udis86/CMakeFiles/udis86.dir/build.make:63:ext/udis86/CMakeFiles/udis86.dir/decode.c.o] 错误 1
make[2]: *** 正在等待未完成的任务....
[  1%] Building C object ext/udis86/CMakeFiles/udis86.dir/itab.c.o
[  1%] Building C object ext/udis86/CMakeFiles/udis86.dir/syn-att.c.o
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [ext/udis86/CMakeFiles/udis86.dir/build.make:76:ext/udis86/CMakeFiles/udis86.dir/itab.c.o] 错误 1
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [ext/udis86/CMakeFiles/udis86.dir/build.make:89:ext/udis86/CMakeFiles/udis86.dir/syn-att.c.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:2295:ext/udis86/CMakeFiles/udis86.dir/all] 错误 2
[  1%] Building C object CMakeFiles/libzip.dir/ext/libzip/zip_add_dir.c.o
[  1%] Building C object CMakeFiles/libzip.dir/ext/libzip/zip_add.c.o
[  1%] Building C object CMakeFiles/libzip.dir/ext/libzip/zip_add_entry.c.o
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [CMakeFiles/libzip.dir/build.make:76:CMakeFiles/libzip.dir/ext/libzip/zip_add_dir.c.o] 错误 1
make[2]: *** 正在等待未完成的任务....
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [CMakeFiles/libzip.dir/build.make:63:CMakeFiles/libzip.dir/ext/libzip/zip_add.c.o] 错误 1
[  2%] Building C object CMakeFiles/libzip.dir/ext/libzip/zip_algorithm_deflate.c.o
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [CMakeFiles/libzip.dir/build.make:89:CMakeFiles/libzip.dir/ext/libzip/zip_add_entry.c.o] 错误 1
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [CMakeFiles/libzip.dir/build.make:102:CMakeFiles/libzip.dir/ext/libzip/zip_algorithm_deflate.c.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:73:CMakeFiles/libzip.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2

It looks like this option is not recognized at all

kero990 avatar Aug 08 '22 14:08 kero990

forget the option then, try unknown's advice

hrydgard avatar Aug 08 '22 14:08 hrydgard

This time it was wrong at the beginning

inpur@inpur-PC:~/ppsspp/build$ make clean
inpur@inpur-PC:~/ppsspp/build$ make -j4
Scanning dependencies of target snappy
Scanning dependencies of target gason
Scanning dependencies of target libzip
Scanning dependencies of target udis86
[  0%] Building CXX object CMakeFiles/gason.dir/ext/gason/gason.cpp.o
[  0%] Building CXX object ext/snappy/CMakeFiles/snappy.dir/snappy-c.cpp.o
c++: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [CMakeFiles/gason.dir/build.make:63:CMakeFiles/gason.dir/ext/gason/gason.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:291:CMakeFiles/gason.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务....
c++: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [ext/snappy/CMakeFiles/snappy.dir/build.make:63:ext/snappy/CMakeFiles/snappy.dir/snappy-c.cpp.o] 错误 1
[  0%] Building C object ext/udis86/CMakeFiles/udis86.dir/decode.c.o
make[1]: *** [CMakeFiles/Makefile2:2240:ext/snappy/CMakeFiles/snappy.dir/all] 错误 2
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [ext/udis86/CMakeFiles/udis86.dir/build.make:63:ext/udis86/CMakeFiles/udis86.dir/decode.c.o] 错误 1
make[2]: *** 正在等待未完成的任务....
[  1%] Building C object ext/udis86/CMakeFiles/udis86.dir/itab.c.o
[  1%] Building C object ext/udis86/CMakeFiles/udis86.dir/syn-att.c.o
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [ext/udis86/CMakeFiles/udis86.dir/build.make:76:ext/udis86/CMakeFiles/udis86.dir/itab.c.o] 错误 1
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [ext/udis86/CMakeFiles/udis86.dir/build.make:89:ext/udis86/CMakeFiles/udis86.dir/syn-att.c.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:2295:ext/udis86/CMakeFiles/udis86.dir/all] 错误 2
[  1%] Building C object CMakeFiles/libzip.dir/ext/libzip/zip_add_dir.c.o
[  1%] Building C object CMakeFiles/libzip.dir/ext/libzip/zip_add.c.o
[  1%] Building C object CMakeFiles/libzip.dir/ext/libzip/zip_add_entry.c.o
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [CMakeFiles/libzip.dir/build.make:76:CMakeFiles/libzip.dir/ext/libzip/zip_add_dir.c.o] 错误 1
make[2]: *** 正在等待未完成的任务....
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [CMakeFiles/libzip.dir/build.make:63:CMakeFiles/libzip.dir/ext/libzip/zip_add.c.o] 错误 1
[  2%] Building C object CMakeFiles/libzip.dir/ext/libzip/zip_algorithm_deflate.c.o
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [CMakeFiles/libzip.dir/build.make:89:CMakeFiles/libzip.dir/ext/libzip/zip_add_entry.c.o] 错误 1
cc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
make[2]: *** [CMakeFiles/libzip.dir/build.make:102:CMakeFiles/libzip.dir/ext/libzip/zip_algorithm_deflate.c.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:73:CMakeFiles/libzip.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2

It seems I should try it with ubuntu18

kero990 avatar Aug 08 '22 14:08 kero990

Please try running ./linux_arm64.sh in ffmpeg (i.e. pushd ffmpeg && ./linux_arm64.sh && popd) and then try to compile PPSSPP again.

-[Unknown]

I don't know why, but this time it worked. Whether compiling ffmpeg or compiling ppsspp, there is no error. thank you so much.

kero990 avatar Aug 08 '22 14:08 kero990

OK, so this distro needs ffmpeg to be built, our "standard" binaries won't do.

I think we really need to look into building the parts of ffmpeg that we need directly from cmake. Although that's gonna be a pain and a half to set up ...

hrydgard avatar Aug 08 '22 15:08 hrydgard

It's running perfectly fine on my machine now, but there is a problem, it can't save any in-game saves, it says "memory stick duo" is out of space I found two similar questions in issues, but there seems to be no effective solution. It can't really have enough capacity, because the hard disk has as many as 1T. So what is the problem, is it a compilation problem?

kero990 avatar Aug 09 '22 02:08 kero990

Hm, maybe the folder it picked as memstick is read-only for some reason, or our free space reporting to the game has a bug.

Are you having this problem with all games you try, or a specific one?

hrydgard avatar Aug 09 '22 06:08 hrydgard

Hm, maybe the folder it picked as memstick is read-only for some reason, or our free space reporting to the game has a bug.

Are you having this problem with all games you try, or a specific one?

I've tested several games and it's all like this. Since I still have a 1.70 version from 2018, I'm testing with both versions First I'm sure that the configuration and archive directories of the two are the same, both are ~/.config/ppsspp, and the two versions share the game list and buttons. then 1.70 without any problem And in this 1.13.1-234-g5434bd83e I compiled, this is the case. If the game does not have an initial save, it will report that the sd card space is insufficient and cannot be saved. If the game already has an archive (such as creating an archive with version 1.70), then this new version will no longer report an error and can be stored normally. So this should be a bug, not my computer's settings.

kero990 avatar Aug 10 '22 06:08 kero990

That's weird, maybe a problem creating the game save folders, or something... Thanks for reporting.

hrydgard avatar Aug 10 '22 13:08 hrydgard

Which game was this? Was it a specific game, or really all games? Should be a separate issue and might already be one.

I feel like there was already another issue about wanting to remove the precompiled Linux FFmpeg binaries, but didn't find it with a quick check. Downside is making CI slightly slower.

-[Unknown]

unknownbrackets avatar Aug 20 '22 21:08 unknownbrackets

I tested this bug in detail and basically locked the scope of the bug The buggy game is Musou Orochi, (I tested the US and CN versions)

Specifically, if there is no game save file in the SAVEDATA directory, Musou Orochi will report an error. Once there is an archive under SAVEDATA, even if it is an archive of other games, Musou Orochi can run normally. Whether you use the old version of ppsspp to archive Musou Orochi, or use the new version to archive other games (only Musou Orochi cannot be archived in several games I tested)

The above bugs have all been reproduced under linux on arm64, on x64 and windows, yes, the same is true under win. I believe this should help you to lock down the problem, maybe you can try other games under KOEI. @unknownbrackets @hrydgard image

kero990 avatar Aug 30 '22 08:08 kero990

Are we sure this doesn't happen on a real PSP? We've seen bugs in other games where they calculate free space incorrectly, even on real PSPs (for example, some Harry Potter game says you're out of free space if you have between 2 and 6 GB free or something like that.)

Is it enough to have a single folder inside SAVEDATA? I don't think the PSP OFW created a file or folder in there by default, though...

-[Unknown]

unknownbrackets avatar Aug 30 '22 13:08 unknownbrackets

We have a compat.ini option to report a smaller free space if needed..

hrydgard avatar Aug 30 '22 13:08 hrydgard

Are we sure this doesn't happen on a real PSP? We've seen bugs in other games where they calculate free space incorrectly, even on real PSPs (for example, some Harry Potter game says you're out of free space if you have between 2 and 6 GB free or something like that.)

Is it enough to have a single folder inside SAVEDATA? I don't think the PSP OFW created a file or folder in there by default, though...

-[Unknown]

Hey,you see, I really have a psp2000 at the bottom of the press box, it seems that I need to turn it out and try it? But I don't have the original Musou Orochi UMD CD, so I can only use the self-made system. I also have to look for my ms card.

And don't forget, this problem is totally absent on older versions (1.7 I use). So I think it is unlikely that this bug is also present on the real psp machine.

Oh, I tested the problem of the empty folder you mentioned again. According to the test, the empty folder still reports an error. No matter which game it is, there must be a real archive to make Musou Orochi run.

kero990 avatar Aug 31 '22 03:08 kero990

I'm using RetroPie on a Radxa Rock Pi 4 (a Raspberry Pi clone) and I had the exact same issue when I tried to install either ppsspp or lr-ppsspp through the RetroPie package manager. Going to RockPie-Setup/tmp/build/ppsspp/ppsspp/ffmpeg and executing sudo ./linux_arm64.sh fixed my problem – then I could retry the installation in the package manager and everything worked just fine!

cshaa avatar Dec 18 '22 18:12 cshaa

Guessing that the platform needs -latomic for one reason or another, could you try adding that to the linked libraries somewhere in CMakeLists.txt?

I confirm at least for the Libretro core add_definitions(-mno-outline-atomics) is needed for ARM64 (Source).

And we are using also linux_arm64.sh for compiling FFmpeg on ARM64.

gouchi avatar Apr 09 '24 14:04 gouchi