LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
8.04k stars 1k forks source link

Issues with "Linux Cross-Compile" (Debian WSL) #7526

Open bratpeki opened 5 days ago

bratpeki commented 5 days ago

System Information

Windows 10

LMMS Version(s)

Git

Most Recent Working Version

No response

Bug Summary

Following https://github.com/LMMS/lmms/wiki/dependencies-windows#linux-cross-compile to compile on Windows is not straightforward.

I set up Debian using WSL2 on my machine.

The sudo add-apt-repository ppa:tobydox/mingw-w64 command gives the following result:

image

Expected Behaviour

The command gives no errors, and one may proceed with the compilation steps.

Steps To Reproduce

Logs

peki@...:~$ sudo add-apt-repository ppa:tobydox/mingw-w64
[sudo] password for peki:
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 362, in <module>
    sys.exit(0 if addaptrepo.main() else 1)
                  ^^^^^^^^^^^^^^^^^
  File "/usr/bin/add-apt-repository", line 345, in main
    shortcut = handler(source, **shortcut_params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py", line 40, in shortcut_handler
    return handler(shortcut, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 86, in __init__
    if self.lpppa.publish_debug_symbols:
        ^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 126, in lpppa
    self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
                  ^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 113, in lpteam
    self._lpteam = self.lp.people(self.teamname)
                   ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'people'

Screenshots / Minimum Reproducible Project

No response

Please search the issue tracker for existing bug reports before submitting your own.

bratpeki commented 5 days ago

This could have something to do with versioning (Bullseye, Buster, etc), but I don't know.

bratpeki commented 1 day ago

Solved it with sudo apt-get install python3-launchpadlib. I'm now getting the following issue:

E: The repository 'https://ppa.launchpadcontent.net/tobydox/mingw-w64/ubuntu bookworm Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
bratpeki commented 1 day ago

Fixed with echo "deb [trusted=yes] http://www.deb-multimedia.org bookworm main" >> /etc/apt/sources.list.

bratpeki commented 1 day ago

Then running sudo apt-get install gets you:

E: Unable to locate package sdl-mingw-w64
E: Unable to locate package sdl2-mingw-w64
E: Unable to locate package libvorbis-mingw-w64
E: Unable to locate package lame-mingw-w64
E: Unable to locate package fluidsynth-mingw-w64
E: Unable to locate package stk-mingw-w64
E: Unable to locate package glib2-mingw-w64
E: Unable to locate package portaudio-mingw-w64
E: Unable to locate package libsndfile-mingw-w64
E: Unable to locate package fftw-mingw-w64
E: Unable to locate package flac-mingw-w64
E: Unable to locate package fltk-mingw-w64
E: Unable to locate package libgig-mingw-w64
E: Unable to locate package libsamplerate-mingw-w64
E: Unable to locate package libsoundio-mingw-w64
E: Unable to locate package qt5base-mingw-w64

WSL uses Bookworm:

peki@...:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
messmerd commented 1 day ago

Tobydox's PPA is for Ubuntu 20.04 (focal), not Debian 12 (bookworm): https://ppa.launchpadcontent.net/tobydox/mingw-w64/ubuntu/dists/focal/

It looks like @FyiurAmron erroneously changed the wiki article to say "Debian" rather than "Ubuntu" starting with this revision: https://github.com/LMMS/lmms/wiki/Dependencies-Windows/4b141b4f8fb77c9cd46799e2e87f6a9499dcd03a

I just changed it back to "Ubuntu". While you probably could get it to work on Debian, we do not officially support anything other than what our automated builds use, which is Ubuntu 20.04.

FyiurAmron commented 1 day ago

@messmerd FWIW, you're completely right here, I tried to recall why I changed that but couldn't find any rational reason, probably were just editing 3 pages at once and went on a spree and done this due to some brain fart. Maybe I wanted to describe the exact procedure for normal Debian distros in-depth and either forgotten about that or gave up on it, or maybe it was just a completely random mistake. Can't recall now, the last months been hectic for me.

Anyhow, I 100% agree, although technically Ubuntu still is Debian, just repackaged :D (and yes, with the deps either built from source or otherwise repackaged, I see no reason why it wouldn't work, but I also see no reliable way to support people doing that since I'm not using raw Debian on a daily basis anymore and I guess it's an edge case anyhow)

@bratpeki tl;dr those PPAs are a relic from the past, so compiling them libs from source would be your best bet - but while you could do that or even try to configure APT to fetch those for focal and use them (it's possible even if probably useless), it makes no sense on WSL IMVHO - for Win, just go with MSYS, it should work out-of-the-box, especially after the bunch of updates I did for it this year. If it doesn't, ping me, we'll figure something out.

bratpeki commented 1 day ago

Excellent, thank you both! I'll move the compilation process to MSYS, then!

@FyiurAmron, where can I find relevant documentation, if any?

I'm persuming MSYS2 is focused on using Pacman, so I could get the dependency list off the lmms-git AUR repo, but is there anything on the LMMS Wiki regarding this?

FyiurAmron commented 1 day ago

@bratpeki doh! Now I recall, I was in the process of updating those docs when RL stuff struck me. Found some commented out doc blocks hinting on what I wanted to do next, and it was indeed providing docs for MSYS process, and perhaps Debian afterwards. It's quite straightforward for MSYS anyway and strictly follows what's described on https://github.com/LMMS/lmms/wiki/Compiling for other compile paths; I'll post you the exact file I guess was supposed to be the basis of the doc:

# arch is either x86_64 or i686 ; assuming fresh MSYS install

### mandatory platform/toolchain
pacman -S git
pacman -S mingw-w64-x86_64-toolchain
pacman -S mingw-w64-x86_64-cmake
# MSYS2 make, runs as "Unix Makefiles" to simplify the build
pacman -S make
# CMake deps
pacman -S perl-List-MoreUtils
pacman -S perl-XML-Parser

### mandatory 3rd party deps
pacman -S mingw-w64-x86_64-libsamplerate
pacman -S mingw-w64-x86_64-fftw
pacman -S mingw-w64-x86_64-libsndfile
pacman -S mingw-w64-x86_64-qt5-base
# or qt6 etc. for the fork
pacman -S mingw-w64-x86_64-SDL2
# or some other output equivalent to SDL2

### misc deps
# for Windows packaging
pacman -S mingw-w64-x86_64-nsis
# for ZynAddSubFx
pacman -S mingw-w64-x86_64-fltk
# for SF2
pacman -S mingw-w64-x86_64-fluidsynth

### and all the other libs you fancy

After getting the libs installed, prepare the dirs for make (cd lmms && mkdir build && cd build), run make etc. (cmake .. -DCMAKE_INSTALL_PREFIX=../target and cmake --build . is what I had in my shell history) and you should get the binaries in no time (well, that is if you consider ~10-30 minutes "no time" :)

If it works for you, feel free to add this or any other relevant data to the wiki as new section. We had some outdated docs for MSYS in the olden days, but https://github.com/LMMS/lmms/wiki/Dependencies-Windows/_compare/a857e2562de0d13a5387d75db2508c9cf7127641...6cfbc94f040dce913ab456429c1b2b897dad1167 removed them a couple of months ago (not that it was a wrong call by itself, that part was outdated as hell and was also mostly unnecessary anymore).

bratpeki commented 1 day ago

Wonderful, thank you! I'd help you keep the building Wiki page up-to-date, if necessary, and I believe the cmake commands should be different, to specify the output binary is a Windows one!

bratpeki commented 1 day ago
:: There are 13 members in group mingw-w64-x86_64-toolchain:
:: Repository mingw64
   1) mingw-w64-x86_64-binutils  2) mingw-w64-x86_64-crt-git  3) mingw-w64-x86_64-gcc  4) mingw-w64-x86_64-gdb
   5) mingw-w64-x86_64-gdb-multiarch  6) mingw-w64-x86_64-headers-git  7) mingw-w64-x86_64-libmangle-git
   8) mingw-w64-x86_64-libwinpthread-git  9) mingw-w64-x86_64-make  10) mingw-w64-x86_64-pkgconf
   11) mingw-w64-x86_64-tools-git  12) mingw-w64-x86_64-winpthreads-git  13) mingw-w64-x86_64-winstorecompat-git

I believe I should either choose 1 or 3, looking into it now.

FyiurAmron commented 1 day ago

I believe the cmake commands should be different, to specify the output binary is a Windows one!

@bratpeki From what I recall, MSYS's cmake can only output Win32/64 binary, so no need to instruct it to do so. The commands should work as-is (maybe you'll need to tell CMake to use Unix buildfiles instead of Ninjas etc., but YMMV there, I just didn't have any luck with Ninja builds, some random errors started happening).

FyiurAmron commented 1 day ago

I believe I should either choose 1 or 3, looking into it now.

You'll need all 13 of them IIRC. Some are optional-ish (gdb e.g.), but most of them are strictly required, and there is no harm in having them all anyway.

bratpeki commented 1 day ago

After finnicking around with my antivirus software, I am pleased to announced I've compiled it! The instructions were straight-to-the point, with the exception of having to restart!

bratpeki commented 1 day ago

When attempting to run from the ...\msys64\home\...\lmms\build, lmms.exe reports missing libs, namely libgcc_s_seh-1.dll and libfftw3f-3.dll. As I recall, running from the build dir is possible on Linux, is that not the case on Windows?

FyiurAmron commented 19 hours ago

@bratpeki

After finnicking around with my antivirus software, I am pleased to announced I've compiled it! The instructions were straight-to-the point, with the exception of having to restart!

TBH, I never had to do that for MSYS, but obviously YMMV here, I'm still on old-ish MSYS version on Win7, maybe Win10 version changed something, maybe you were just unlucky with your particular setup for some reason.

When attempting to run from the ...\msys64\home\...\lmms\build, lmms.exe reports missing libs, namely libgcc_s_seh-1.dll and libfftw3f-3.dll. As I recall, running from the build dir is possible on Linux, is that not the case on Windows?

It should be possible on both. However, to do that on Windows you'd have to have a dir with those DLLs in a shared location (i.e. on Windows PATH) for this to work without having the DLLs bundled in the same dir. That's one way to handle it, althout some files required for "normal" LMMS work might be missing anyway (I'm not using this one personally for that reason).

Another way is to use CMake to create an NSIS build to get a complete package with all the DLLs bundled. AFAIK you'll get all the needed files in build\_CPack_Packages\win64\NSIS\lmms-1.3.0-alpha-mingw-win64 (exe, DLLs, all the rest), and you'll get the installer for free as well. This is fool-proof, you basically get a portable-ish install this way, same files that you'd get by unpacking the installer manually. The only downside is that the dir will be regenerated with each build-with-package, so you probably need to copy this somewhere.

Yet another approach is to just copy the exe from build to an existing 1.3.0-alpha install location and either overwrite the old one or rename one of them. This one should be fool-proof as well, drag-n-drop or one-liner is needed only. Renaming the exes allows you to compare the different build versions side-by-side as well too, so it's a 10/10 approach in my book.

You might also mix the above solutions in any way you fancy, obviously. Do what suits you best.

Rossmaxx commented 18 hours ago

Or you can just cmake --install . --prefix "../target/"?

FyiurAmron commented 15 hours ago

@Rossmaxx a very good point. So, in total, that's at least 4 reliable methods to handle this. Should be enough :D

bratpeki commented 13 hours ago

Thank you both!

This works like a charm with an out of the box MSYS2 install.

I think I could write up an addition to the PR, as this seems like a very easy way to get building up and running on Windows!

I'll give Ross' command and packaging a shot, and let you know how it goes.