Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distribution: Raw AppImage builder using Docker #912

Merged
merged 16 commits into from
Apr 17, 2022

Conversation

henry701
Copy link
Contributor

@henry701 henry701 commented Jan 30, 2022

AppImage builder from scratch using Docker.

Closes #804.

PR here just for tracking, so far. It's still not working because Asbrú will need some code changes in order to invoke external executables without the environment variable mangling (that was done in order to run the AppImage with the correct relative paths of the embedded libs). More about the progress in the comments below.

To build the AppImage, you will need Docker installed and accessible from your POSIX shell. Then, just cd to the root directory of the project, and run: ./dist/appimage-raw/make_appimage.sh. It will be available on ./dist/appimage-raw/build.

@gfrenoy
Copy link
Contributor

gfrenoy commented Feb 7, 2022

Thanks a lot Henrique !

I gave it a try and was able to build the AppImage but when executing it, I have the following message:

execv error: Permission denied

Is this what you mean with "invoke external executables without the environment variable mangling" or did I do something wrong ?

@henry701
Copy link
Contributor Author

henry701 commented Feb 7, 2022

Thanks a lot Henrique !

I gave it a try and was able to build the AppImage but when executing it, I have the following message:

execv error: Permission denied

Is this what you mean with "invoke external executables without the environment variable mangling" or did I do something wrong ?

I'm usually having no such file or directory instead of permission denied, strange...

Anyways, this PR will take some more time to be ready, because of a lot of complexity:

  • Asbru uses VTE to invoke itself and there's some issues arising with that due to the customized env vars.
  • Every time we invoke a command which executable lies outside of the AppImage the original env vars have to be set.
  • [I'm currently working on this] Local Shell is not working due to the X11 Perl module for some reason not detecting that it's running inside X11, in asbru_conn's window resizing code.
  • There's some places (local shell directory configuration, so far) where we change the current working directory, but this will have to be changed for some other alternate method because changing cwd breaks AppImages
    • Changing CWD breaks AppImages because the ELF header of all executables are patched to use relative directories so that they invoke the embedded Shared Objects, not the system ones

So there's a LOT of stuff to iron out and make flexible, and there's a lot of code that's going to have to be changed to match.

Then after I'm done there will be a lot of testing both inside and outside AppImage to ensure the changed pieces are working fine.

About the permission denied problem, something somewhere is probably not marked as executable, I'm using WSL so maybe that has something to do with it, probably Windows "forces" execution even without the executable flag...

@henry701
Copy link
Contributor Author

henry701 commented Feb 8, 2022

The X11 problem didn't occur today even though I changed nothing locally, very strange. At least now the shell finally opens :)

Just need to iron out this, current commit ignores the configuration option:

  • There's some places (local shell directory configuration, so far) where we change the current working directory, but this will have to be changed for some other alternate method because changing cwd breaks AppImages
    • Changing CWD breaks AppImages because the ELF header of all executables are patched to use relative directories so that they invoke the embedded Shared Objects, not the system ones

And then more extensive testing, of course.

Also, sorry for not even saying on the PR how to build the docker image. I will edit it with the information.

@henry701
Copy link
Contributor Author

henry701 commented Feb 8, 2022

Does the AppImage work for you after these last changes?

@gfrenoy
Copy link
Contributor

gfrenoy commented Feb 8, 2022

Does the AppImage work for you after these last changes?

No joy :( Here is what I see if I run it on the same machine:

$ dist/appimage-raw/build/Asbru-CM.AppImage 
Gtk-Message: 10:15:04.368: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
syntax error at /tmp/.mount_Asbru-HlZ4og/opt/asbru-cm/lib/PACUtils.pm line 343, near "return"
syntax error at /tmp/.mount_Asbru-HlZ4og/opt/asbru-cm/lib/PACUtils.pm line 368, near "return"
BEGIN not safe after errors--compilation aborted at /tmp/.mount_Asbru-HlZ4og/opt/asbru-cm/lib/PACUtils.pm line 3812.
Compilation failed in require at /tmp/.mount_Asbru-HlZ4og/opt/asbru-cm/lib/PACMain.pm line 57.
BEGIN failed--compilation aborted at /tmp/.mount_Asbru-HlZ4og/opt/asbru-cm/lib/PACMain.pm line 57.
Compilation failed in require at /tmp/.mount_Asbru-HlZ4og/opt/asbru-cm/asbru-cm line 96.
BEGIN failed--compilation aborted at /tmp/.mount_Asbru-HlZ4og/opt/asbru-cm/asbru-cm line 96.

It looks like we are not using the right version of perl or using a "strict" mode or something ; I'm lost at this stage...

@henry701
Copy link
Contributor Author

henry701 commented Feb 8, 2022

I actually forgot a ; after logging some extra things and didn't run Asbrú before committing 🤦‍♂️ will fix this later

@gfrenoy
Copy link
Contributor

gfrenoy commented Feb 8, 2022

I actually forgot a ; after logging some extra things and didn't run Asbrú before committing man_facepalming will fix this later

Oh yes, of course ... I see ; did not realize you made that many changes and that it was actually a "real" error ;)

So, I did fix it locally, tried again and ... it works ! That looks like a great news :) I'll play around and we'll also need to see how we can automate this build in our Travis script.

Thanks a lot.

@henry701
Copy link
Contributor Author

henry701 commented Feb 8, 2022

Good, nice to hear that it works there as well! I'll have the other TODOs patched up sometime this week probably. And documentation :x

@henry701
Copy link
Contributor Author

henry701 commented Feb 13, 2022

Both "shell directory" and "use login shell" settings work properly now. Still need to test more and check for strings used on anything that spawns a subprocess so that every one of those is checked for env variable prefixing, depending on what it does and what it invokes.

@henry701 henry701 marked this pull request as ready for review March 25, 2022 16:10
@henry701
Copy link
Contributor Author

Seems stable and complete now. Missing docs for now

@henry701 henry701 changed the title [DRAFT] Raw AppImage builder using Docker Distribution: Raw AppImage builder using Docker Mar 25, 2022
@henry701
Copy link
Contributor Author

Docs done 👀

@gfrenoy gfrenoy merged commit 2c2bba1 into asbru-cm:loki Apr 17, 2022
@gfrenoy
Copy link
Contributor

gfrenoy commented Apr 17, 2022

Hi Henrique,

Thanks again for the terrific work to get this working ! I made a test with the latest loki release and was able to create an AppImage with the latest loki code.

It's working fine for me. The only little glitch I see is the following message for every terminal you want to start:

Gtk-Message: 17:35:50.555: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.

Any idea why I see this ? Can we do something about it ?

I now need to see how we can build this automatically when we start our automated build.

@henry701
Copy link
Contributor Author

I couldn't reproduce that here, it seems some GTK module outside the AppImage is being picked up.

From searching around about GTK module loading I saw some documentation about GTK_IM_MODULE and GTK_IM_MODULE_FILE environment variables, I'll adjust the AppRun script to override them as well and see.

@henry701
Copy link
Contributor Author

henry701 commented Apr 20, 2022

Try now on the branch, that atk-bridge module was on the gtk-2.0 folder, so I pointed GTK_PATH to the gtk-3.0 folder instead (and that's what Ásbrú uses, so whoops). Diff: henry701@b95b324

@gfrenoy
Copy link
Contributor

gfrenoy commented May 16, 2022

Henrique, still searching for a way to publish the AppImage from our automated build...

In the meantime, I created an entry on AppImageHub and uploaded manually:
https://www.appimagehub.com/p/1796061

@henry701 henry701 mentioned this pull request Jun 9, 2022
@henry701
Copy link
Contributor Author

henry701 commented Jun 9, 2022

Henrique, still searching for a way to publish the AppImage from our automated build...

In the meantime, I created an entry on AppImageHub and uploaded manually: https://www.appimagehub.com/p/1796061

Is using a separate build orchestration an option, or does it need to be on the same Travis CI? I can try to integrate with Travis CI or GitHub Actions and post the resulting code, if it would help :)

Hi Henrique,

Thanks again for the terrific work to get this working ! I made a test with the latest loki release and was able to create an AppImage with the latest loki code.

It's working fine for me. The only little glitch I see is the following message for every terminal you want to start:

Gtk-Message: 17:35:50.555: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.

Any idea why I see this ? Can we do something about it ?

I now need to see how we can build this automatically when we start our automated build.

Could you cherry-pick henry701@b95b324 and try again? It probably solves the issue you described here.

@gfrenoy
Copy link
Contributor

gfrenoy commented Jun 11, 2022

Is using a separate build orchestration an option,

Yes, certainly.

I can try to integrate with Travis CI or GitHub Actions and post the resulting code, if it would help :)

Well, adding this to Travis CI is fairly trivial if I would have a way to upload the build to AppImageHub (or anything else...).
I did not really find an API or a way to automate this :(

Could you cherry-pick henry701/asbru-cm@b95b324 and try again?

Sure, will do.

Thanks again for this great feature !

@gfrenoy
Copy link
Contributor

gfrenoy commented Jun 11, 2022

Could you cherry-pick henry701@b95b324 and try again?

It works like a charm :) Thanks a lot !

I uploaded "apha-2" on https://www.appimagehub.com/p/1796061

gfrenoy added a commit that referenced this pull request Jun 18, 2022
Do not use external env XDG_DATA_DIRS and LD_LIBRARY_PATH as fallback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants