Score:0

Is it possible to cross-compile among different Ubuntu relases?

ve flag

Real case scenario: I have a dev machine that runs Ubuntu 22.04. Most of my customers have a dedicated remote machine that run Ubuntu as well, but with different releases - 20.04, 21.04, etc...

I write Qt applications (they are debugged remotely) and I discovered that the binaries are not compatible among different Ubuntu releases, even if the Qt version is the same.

Problems:

  1. I cannot upgrade all the remote machines to the same version of my dev machine
  2. I don't want to make a virtual machine for each target machine out there (mainly because I hate to write code inside a VM)
  3. for the same reason I would avoid to install all the dev stuff on the remote machine and compile remotely using a remote desktop application

Hence my title question: is it possible to "cross-compile" against different Ubuntu versions? It would solve my issue: on my local machine I can install the libraries of the previous Ubuntu releases and build each Qt application for their target.

But I don't know if it's even possible and how to do.

cn flag
Ray
Yes, it should be possible. But I don't know how because it's been a while since I've done anything close to it. You should look into creating a statically-linked executable. For example, see the discussion [here](https://stackoverflow.com/questions/1011197/qt-static-linking-and-deployment). This would mean all the libraries, etc. are included with executable. Alternatively, you can make it dynamically linked, but then include all the libraries as part of your distribution. Sorry, I can't help you more, but maybe this will help you with a Google search.
pl flag
This is a prime example of why snaps exist. Build your application on one release of Ubuntu, and it can be installed on any supported release. The snap core runtime makes sure that if it works on your system, as a snap, it'll work on another system in the same way.
user535733 avatar
cn flag
If you are developing free software, then it should be in Debian (and thence Ubuntu), and then this isn't an issue - the distro build farms handle it, and you just test it in a VM. If you are developing non-free software to distribute via a third-party deb, DON'T do it. Your dependencies might be great now, but at release-upgrade time your customers will be most unhappy when your deb's dependency requirements break their systems.
ve flag
@popey the problem is I need to debug the application remotely during the development. I do not *distribute* my applications. Each application is very specific and developed ad hoc for each customer.
ve flag
@Ray, that's interesting. I'm able to either build my application statically or deploy the required libraries. My concern is about how to install the libraries of other Ubuntu releases in the same machine.
cn flag
Ray
Well, you have many options. Just use `tar` and have your code look for dependencies in the current directory, make a `.deb` and make it install it somewhere like `/usr/local`, or look into packaging your software using something like `cpack` with library installations in `/usr/local` as well. You're asking the customer to duplicate software, of course. i.e., they have X v2.0 and you might ask them to install X v2.1 or v1.9. You just want to make sure if you're asking them to install v2.0 also (by chance), you don't overwrite it.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.