UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStar™
https://usdx.eu
GNU General Public License v2.0
803 stars 157 forks source link

Building DEB packages fails on Raspian (armhf) #525

Open cRaZy-bisCuiT opened 4 years ago

cRaZy-bisCuiT commented 4 years ago

Actual behaviour

Trying to build DEB packages after a successfull build of USDX fails.

Expected behaviour

The packaging should just be running finde producing some DEBs to install USDX witrh.

Steps to reproduce

# check for missing dependencies
 dpkg-checkbuilddeps
# install missing dependencies
sudo apt -y install liblua5.3-dev libportmidi-dev libopencv-dev
trying to build the DEBs
dpkg-buildpackage -rfakeroot -b -uc

The following error appears:

# successfull build until here... then ->
Assembling uaudiodecoder_ffmpeg
Compiling media/UMedia_dummy.pas
Assembling umedia_dummy
Compiling menu/UMenuStaticList.pas
Assembling umenustaticlist
Assembling ultrastardx
Linking ../game/ultrastardx
ultrastardx.dpr(434) Warning: "crtbeginS.o" not found, this will probably cause a linking failure
ultrastardx.dpr(434) Warning: "crtendS.o" not found, this will probably cause a linking failure
/usr/bin/ld.bfd: warning: ../game/link.res contains output sections; did you forget -T?
/usr/bin/ld.bfd: lib/projectM/cwrapper/libprojectM-cwrapper.a(projectM-cwrapper.o): in function `__static_initialization_and_destruction_0':
/usr/include/libprojectM/Common.hpp:143: undefined reference to `__dso_handle'
/usr/bin/ld.bfd: ../game/ultrastardx: hidden symbol `__dso_handle' isn't defined
/usr/bin/ld.bfd: final link failed: bad value
ultrastardx.dpr(434) Error: Error while linking
ultrastardx.dpr(434) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcarm returned an error exitcode
make[2]: *** [Makefile:245: ../game/ultrastardx] Error 1
make[2]: Leaving directory '/home/pi/Downloads/USDX/src'
make[1]: *** [Makefile:126: all] Error 2
make[1]: Leaving directory '/home/pi/Downloads/USDX'
dh_auto_build: make -j4 returned exit code 2
make: *** [debian/rules:13: binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2

contents of debian/rules:13: dh $@ --with autotools_dev,autoreconf

Is the build setup outdated? I never build DEBs on my own before, so it might just be me...

Trivia

I'm actually working on some Docker Image that builds an RPI2,3,4 optimized build that might hopefully be able to work on at least RPI4 even with 1080p videos. With default ffmpeg build options that's kind of impossible.

If you like to I'll provide this Docker Image here in the Repo and Update the Wiki for how to use it. With just some minor modifications that should also be possible to be used on x86_x64 to build linux generic builds as well as Debian/Ubuntu builds after this issue here is solved. Thanks!

s09bQ5 commented 4 years ago

Your distro messed up and didn't update fpc.cfg to point to the directory containing crtbeginS.o and crtendS.o for the currently installed GCC version.

basisbit commented 4 years ago

would be awesome to have TravisCI use these docker builds to build & upload these packages somewhere

cRaZy-bisCuiT commented 4 years ago

Thank you very much. The test here did not take place in Docker but on a bare metal Raspian. I'll try again in my docker environment and report back.

I never used Travis CI / created builds with that. If Docker runs well I could look into that / you guys could help me figure that out maybe.

basisbit commented 4 years ago

UltraStar Play uses TravisCi + Docker, so you could just look at the configuration file there. It is quite straightforward set up: https://github.com/UltraStar-Deluxe/Play/blob/master/.travis.yml

cRaZy-bisCuiT commented 4 years ago

Do you have a build server for Travis? Does Travis also take care of cross-compiling?

My setup right now needs arm-hardware to compile. The whole thing would need to wrapped up by something like dockercross to make it compile on x68_64.

s09bQ5 commented 4 years ago

The Github repository contains a .travis.yml file. Everytime we push a branch or make a pull request Travis is informed and will use the instructions in that file to perform a bunch of builds. With Travis you don't have direct access to a fixed server. They pick a random machine to run the build jobs.

We don't do cross compiles. There is no special tooling for that in Travis, but nobody will stop us from installing a cross toolchain. They do have ARM64 machines, so we don't need to cross compile there.

Note that ARM64 hardware knows how to run ARM32 binaries and Linux kernels usually have that feature enable, but you need the 32 bit libraries. You also need a different toolchain for ARM32. It is not like on x86 where -m32 and -m64 tell GCC what code to generate. The ARM32 and ARM64 instruction sets were too different.

cRaZy-bisCuiT commented 4 years ago

Well, right now we need x32 ARM. ARM64 will only be available in the future for RPI4/Raspian. I assume the performance will be better with that, also some changes to the codecs might be available for ffmpeg by then to make use of RPI4 hardware.

Still waiting for my Docker build to finish. I don't know yet if the issue is resolved. Building ffmpeg on a pi takes like 2 hours if you include a bunch of build flags. Since I made some changes to the Dockerfile regarding that build it didn't use the cache...

cRaZy-bisCuiT commented 4 years ago

The same error happens in the Docker build. Do you have any ideas how I could fix these issues? Would I have to rewrite fpc.cfg myself? Could I just set an ENV or so?

s09bQ5 commented 4 years ago

On my Debian Buster /etc/fpc.cfg contains a block

# path to the gcclib
#ifdef cpui386
-Fl/usr/lib/gcc/x86_64-linux-gnu/8
#endif
#ifdef cpux86_64
-Fl/usr/lib/gcc/x86_64-linux-gnu/8
#endif

/usr/lib/gcc/x86_64-linux-gnu/8 is the directory containing crtbeginS.o and crtendS.o. You need an -Fl line similar to that one in your fpc.cfg.

/etc/fpc.conf should have been updated by the postinst script in the fp-compiler package. Was gcc installed or updated after fpc had been installed?

cRaZy-bisCuiT commented 4 years ago

Thank you.

The build runs fine on x86 (using ffmpeg binary instead of compiling) ... USDX build finishes as well as DEB packaging. Looking into that next week, since I don't have my Pi with me this weekend.

cRaZy-bisCuiT commented 4 years ago

Rename the attached document and place it at: /etc/fpc.cfg This config works for Raspian Buster (May 2020 release) on armhf (32bit) RPI4 with 3.0.4+dfsg-22+rpi1. fpc.cfg.txt

Your build should be running now.

PS: We should leave this Issue open even if it is not our bug to make sure we may change future documentation or Dockerfiles / Travis etc.