eranif / codelite

A multi purpose IDE specialized in C/C++/Rust/Python/PHP and Node.js. Written in C++
https://codelite.org
GNU General Public License v2.0
2.16k stars 461 forks source link

I create Flatpak for Codelite, interest? #2687

Open kevinsmia1939 opened 3 years ago

kevinsmia1939 commented 3 years ago

Hi,

I just package Codelite as Flatpak. Flatpak will provide easy installation for any Linux distro that support Flatpak which majority of them are. https://github.com/kevinsmia1939/org.codelite.Codelite

Flatpak is a utility for software deployment and package management for Linux. It is advertised as offering a sandbox environment in which users can run application software in isolation from the rest of the system.

Flatpak was developed as part of the freedesktop.org project (formerly known as X Desktop Group or XDG) and was originally called xdg-app.
-wikipedia

https://www.flatpak.org/

I would like to upload this to Flathub eventually. https://flathub.org/home https://github.com/flathub

If Flathub maintainer like it, they would likely ask you to be the maintainer instead.

Right now it build and launch just fine, I have not tried any coding and compile on it. (I know nothing about coding) It have to be test and refine sandbox permission and remove unnecessary files.

It can be build and run with instruction below.

Install flatpak-builder sudo apt install flatpak-builder Build flatpak-builder --install --user build org.codelite.Codelite.yaml --force-clean Run flatpak run org.codelite.Codelite

What do you think? Thanks.

Relate: #2145

kevinsmia1939 commented 3 years ago

One issue I found is text color is white. I try changing the theme but the text color does not change. Anyone know?

https://imgur.com/eCLylYV

eranif commented 3 years ago

which version of CodeLite did you pack?

kevinsmia1939 commented 3 years ago

which version of CodeLite did you pack?

15.0

But I think there are issue with the themes rather than codelite.

Edit: I change from Breeze gtk to Adwaita dark GTK theme and it is fix. https://imgur.com/VUw7MvR

Anyway, what do you think?

dghart commented 3 years ago

Hi,

Thank you for providing this. I've spent time (teaching myself the flatpak basics, and) testing it on debian 10 (buster), with mixed results. The good news:

1) Your yaml file works to build CodeLite 15.0. It also works to build 15.0.1 after the following changes to the last 2 lines: url: https://github.com/eranif/codelite/archive/15.0.1.tar.gz sha256: 5cc6ceb34148da063653fb4937146972f95876cca0e39459810e5e1ccda51ecd 2) The resulting binary runs normally; but see below. 3) I've created a repo for the 15.0.1 build. After testing it locally, I've temporarily uploaded it to: https://repos.codelite.org/Flathub/CodeliteRepo 4) While it was local, I could use that repo to install and run CodeLite on ubuntu 20.10, fedora 32, Mandriva 4.1 and openSUSE 15.2. (However older distro/versions failed with 'Unacceptable TLS certificate' errors.)

The bad news: 1) The binary runs, but it can't access enough of the file system to be useful. In particular, it can't find the system's wxWidgets install, so it fails to build the commonest projects. IIUC that should have been fixed by adding to the yaml file's finish-args the line: - --filesystem=/usr/path:ro However that doesn't work for me. I'd be grateful for your suggestions about this. 2) There is a problem with the repo that I created. Though I could remote-add it successfully when using file:///path/to/local/webserver/..., the same address using http://, either to my webserver or to above link, will fail with the error: 'Unable to load summary from remote CodeliteFlathub: Remote listing for CodeliteFlathub not available; server has no summary file. Check the URL passed to remote-add was valid.' despite the summary file existing. Again I'd be grateful for your help in fixing this.

Regards,

David

kevinsmia1939 commented 3 years ago

@dghart If I understand flatpak correctly, it is normal for flatpak apss to not be able to access root directory and thus, system installed wxWidgets by default. I will have to install wxWidgets to gether with Cidelite in Flatpak manifest. Could you link me to source code of the wxWidgets?

About the second issue, I don't know.

dghart commented 3 years ago

it is normal for flatpak apps to not be able to access root directory

I thought adding: - --filesystem=/usr/path:ro would allow this. Am I wrong? If so, what does that do? Edit: And removing the :ro didn't help.

Could you link me to source code of the wxWidgets?

https://www.wxwidgets.org/downloads/ wx3.0.5 is the current stable release. However all the main distros provide their own packages.

kevinsmia1939 commented 3 years ago

it is normal for flatpak apps to not be able to access root directory

I thought adding: - --filesystem=/usr/path:ro would allow this. Am I wrong? If so, what does that do? Edit: And removing the :ro didn't help.

Could you link me to source code of the wxWidgets?

https://www.wxwidgets.org/downloads/ wx3.0.5 is the current stable release. However all the main distros provide their own packages.

wxWidgets is already included in Flatpak. I think maybe cleanup bin might broke it. Just remove the cleanup bin part under wxWidgets and see if it work.

kevinsmia1939 commented 3 years ago

it is normal for flatpak apps to not be able to access root directory

I thought adding: - --filesystem=/usr/path:ro would allow this. Am I wrong? If so, what does that do? Edit: And removing the :ro didn't help.

Could you link me to source code of the wxWidgets?

https://www.wxwidgets.org/downloads/ wx3.0.5 is the current stable release. However all the main distros provide their own packages.

wxWidgets is already included in Flatpak. I think maybe cleanup bin might broke it. Just remove the cleanup bin part under wxWidgets and see if it work.

dghart commented 3 years ago

Just remove the cleanup bin part under wxWidgets

That worked. I can now build simple programs.

OTOH my first attempt at running the program failed. That's because it tried to run it in a system terminal, which lives in /usr/bin/. However, after changing the preferred terminal to the one provided by CodeLite, the program ran normally :) .

Still, that's not ideal; and I expect that more 'normal use' testing will disclose other similar problems. How do other flatpak programs cope with this?

kevinsmia1939 commented 3 years ago

Just remove the cleanup bin part under wxWidgets

That worked. I can now build simple programs.

OTOH my first attempt at running the program failed. That's because it tried to run it in a system terminal, which lives in /usr/bin/. However, after changing the preferred terminal to the one provided by CodeLite, the program ran normally :) .

Still, that's not ideal; and I expect that more 'normal use' testing will disclose other similar problems. How do other flatpak programs cope with this?

Does it show error log when it fail to run in system terminal? I think Flatpak apps can run as normal use, just a matter of refining sandbox permissions to allow access to certain part of the system. By default, it does not allow much, it have to be explicitly given the permission unlike how we normally install packages which give more access.

kevinsmia1939 commented 3 years ago

Here is some flatpak mainfest for code block, visualstudio code, sublime

https://github.com/flathub/org.codeblocks.codeblocks/blob/master/org.codeblocks.codeblocks.json https://github.com/flathub/com.visualstudio.code/blob/master/com.visualstudio.code.yaml https://github.com/flathub/com.sublimemerge.App/blob/master/com.sublimemerge.App.yaml

dghart commented 3 years ago

Does it show error log when it fail to run in system terminal?

It shows CodeLite's standard 'Can't find {terminal-name}' error, which is what is expected if there is no access there. However the situation is probably more complicated: to find the terminal, CodeLite runs a script, and it might be the script that is inaccessible.

I've also found that I can't get CodeLite to run a 'locally-installed' gdb. However it can run /usr/bin/gdb :/ Yet I read in https://docs.flatpak.org/en/latest/sandbox-permissions.html that /usr/ is black-listed, which I presume means that --filesystem=/usr/pathwill not work...

Here is some flatpak mainfest for code block, visualstudio code, sublime

Thank you. However I can't see that they do anything very different.

kevinsmia1939 commented 3 years ago

Does it show error log when it fail to run in system terminal?

It shows CodeLite's standard 'Can't find {terminal-name}' error, which is what is expected if there is no access there. However the situation is probably more complicated: to find the terminal, CodeLite runs a script, and it might be the script that is inaccessible.

I've also found that I can't get CodeLite to run a 'locally-installed' gdb. However it can run /usr/bin/gdb :/ Yet I read in https://docs.flatpak.org/en/latest/sandbox-permissions.html that /usr/ is black-listed, which I presume means that --filesystem=/usr/pathwill not work...

Here is some flatpak mainfest for code block, visualstudio code, sublime

Thank you. However I can't see that they do anything very different.

Not sure what to do about the gdb, I have to include gdb in flatpak manifest too as well? But I have a feeling that it is already included in standard Sdk.

dghart commented 3 years ago

Not sure what to do about the gdb, I have to include gdb in flatpak manifest too as well?

No need: CodeLite can find it; it's just that some people (me) will prefer to run the latest gdb version, not the installed one.

The problem is not really gdb, but the other terminals (konsole, xterm, lxterminal...) that the user may want to use. Of course that is not a pass/fail issue, just annoying. But it does illustrate possible problems.

And I only use CodeLite for C++ projects. It also does PHP etc, which I've not tested...

kevinsmia1939 commented 3 years ago

Not sure what to do about the gdb, I have to include gdb in flatpak manifest too as well?

No need: CodeLite can find it; it's just that some people (me) will prefer to run the latest gdb version, not the installed one.

The problem is not really gdb, but the other terminals (konsole, xterm, lxterminal...) that the user may want to use. Of course that is not a pass/fail issue, just annoying. But it does illustrate possible problems.

And I only use CodeLite for C++ projects. It also does PHP etc, which I've not tested...

Flatpak is well known to have problem with command line apps. It is usually use for GUI apps. But since Codelite also have cli feature, it might be a problem. https://github.com/flatpak/flatpak/issues/1188

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs (in 5 days). Thank you for your contributions.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs (in 5 days). Thank you for your contributions.