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

Other architectures? #2

Closed
probonopd opened this issue Nov 8, 2020 · 10 comments
Closed

Other architectures? #2

probonopd opened this issue Nov 8, 2020 · 10 comments

Comments

@probonopd
Copy link

probonopd commented Nov 8, 2020

Hello @CalebQ42 I see you are now calling a static version of libappimage. How does this work for other architectures such as ARM? Does it break Go cross-compile abilities?

@CalebQ42
Copy link
Owner

CalebQ42 commented Nov 8, 2020

Well for right now I can't seem to get the static libraries to work properly anyway. I've gotten GoAppImage to build, but once I use it in another project (namely LinuxPA), it doesn't want to compile. For the short term I'll probably switch it back to being based on go-appimage if I don't make any progress in the next 24~48 hours.

If I can get the static library to work though, it shouldn't be too difficult to account for other architectures as cgo allows you to specify the flags used on each architecture, so in theory I should be able to include the libraries for each platform and have it selectively pick the version needed.

@CalebQ42
Copy link
Owner

CalebQ42 commented Nov 8, 2020

Right now I think my main limiting factor is my general lack of knowledge of C and C compilation.

@probonopd
Copy link
Author

probonopd commented Nov 8, 2020

From my experience, many of the beautiful, easy aspects of Go disappear as soon as you start using C. We should strive for a 100% Go native implementation.

https://github.com/distr1/distri/blob/master/internal/squashfs/reader.go

distr1/distri#48

@CalebQ42
Copy link
Owner

CalebQ42 commented Nov 8, 2020

Very true, cgo is a butt, especially when you don't know much C.
I literally just thought of making a go squashfs library (because I couldn't find one before). That should make things MUCH easier.

@probonopd
Copy link
Author

probonopd commented Nov 8, 2020

Maybe you can figure out how to implement the missing compression pieces in distr1/distri#48 - then we'd have a squashfs go library and everyone would be very happy 👍

I'd use it immediately for probonopd/go-appimage#1

@CalebQ42
Copy link
Owner

CalebQ42 commented Nov 8, 2020

I'll try, but it's honestly nothing like I've ever worked with, so I'll have to do a lot of reading.

@CalebQ42
Copy link
Owner

CalebQ42 commented Nov 8, 2020

So looking into it, it seems distri's squashfs, it doesn't look like it has ANY compression implemented (at very least for reading) which means it can't read the basically anything from a compressed squashfs, including the inode table. When I would use it on a squashfs from an AppImage, or a squashfs I made with mksquashfs it couldn't recognize that the root directory was a directory.

I need to look into diskfs a bit more, but from my cursory look, it seems a bit more promising, though, again, there doesn't seem to be any references to decompression. Then again I've never dealt with squashfs and I could be barking up the wrong tree as to what's wrong.

I did, at the very least, write some code to strip the ELF header off an AppImage so I can work on a raw, real world squashfs, which can be found here.

@probonopd
Copy link
Author

it doesn't look like it has ANY compression implemented

Correct. But distr1/distri#48 (comment) has code for the beginnings of it.

@CalebQ42
Copy link
Owner

My squashfs library is now semi functional. It's a bit rough at the moment, I've made basically all functions public, though most of them shouldn't be. Right now it can simply read a squashfs, list the files within, and give you an io.Reader for files (so you can extract them).

It has full support for fragments and compression (though only gzip right now) and it's a simple extract, it doesn't set permissions or anything, but it's operational enough where I can start working on a stable API.

@CalebQ42
Copy link
Owner

Alright, the library is now officially at v0.1.0. It provides very basic functionality, but it works! If you want to use it with AppImages, you can just wrap the os.File with a io.SectionReader with the offset set to the size of the ELF header. I want to get GoSquashfs a bit more mature, but then I'll integrate it into this library.

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

No branches or pull requests

2 participants