ecdye / zram-config

A complete zram-config utility for swap, directories, and logs to reduce SD, NAND and eMMC block wear.
MIT License
412 stars 53 forks source link

xattr version not building #18

Closed mstormi closed 4 years ago

mstormi commented 4 years ago

The only difference of lzual750's branch is different header files ... <sys/xattr.h> does not exist on my stretch Raspbian, meanwhile <attr/xattr.h> exists (and defines ENOATTR to be ENODATA). I don't understand neither why you introduced that distinction nor how to get hold of those sys headers.

Would you mind tagging a working version with a version tag ? Either the master branch as of 12 days ago or the latest after fixing this issue. I'm cloning your repo for use in openHABian but for this it shouldn't change as master does. Thanks.

pi@devpi:/tmp/z $ git clone -b fix_xattr_lib_include https://github.com/Izual750/overlayfs-tools Klone nach 'overlayfs-tools' ... remote: Enumerating objects: 96, done. remote: Total 96 (delta 0), reused 0 (delta 0), pack-reused 96 Entpacke Objekte: 100% (96/96), Fertig. pi@devpi:/tmp/z $ cd overlayfs-tools/ pi@devpi:/tmp/z/overlayfs-tools $ make gcc -Wall -std=c99 -c main.c gcc -Wall -std=c99 -c logic.c logic.c: In function ‘is_opaquedir’: logic.c:38:32: error: ‘ENOATTR’ undeclared (first use in this function) if ((res < 0) && (errno != ENOATTR)) { ^~~ logic.c:38:32: note: each undeclared identifier is reported only once for each function it appears in makefile:14: die Regel für Ziel „logic.o“ scheiterte make: *** [logic.o] Fehler 1

StuartIanNaylor commented 4 years ago
version=$(uname -r)
major=`echo $version | cut -d. -f1`
minor=`echo $version | cut -d. -f2`

if [ "$major" -ge "4" ]
then
        if  [ "$minor" -ge "19" ]
    then
        InstallAttr
    else
        if [ "$major" -ge "5" ]
            then
                    InstallAttr
            else
                    InstallXattr
            fi
    fi
else
        InstallXattr
fi

Should install the correct version depending on stretch or buster? if its >= 4.19 The distinction is there as the lib changed names not exactly sure but with Raspbian it pivots on 4.19 Buster What kernel is stretch now running? Is that also 4.19? As need a better check then as far as I can see it should of installed xattr which exists gcc -lattr or something

mstormi commented 4 years ago

Yes stretch is on 4.19.57. Just dist-upgraded to make sure it's up to date. Note it has no /usr/include/\ and AFAIK never had that. Meanwhile xattr.h to define ENOATTR is still in \. Dunno why lzual750 changed that to sys ? Either way wouldn't it make sense to NOT include his repo (just clone the standard one) and add #ifndef ENOATTR ... in your code ? If I'm not mistaken that's the only difference, or am I overlooking something there ?

[09:52:59] root@devpi:/usr/include# grep ENOATTR attr/ attr/xattr.h:#ifndef ENOATTR attr/xattr.h:# define ENOATTR ENODATA / No such attribute */ [09:52:59] root@devpi:/usr/include#

PS: does that [ "$major" -ge "5" ] make sense ?

StuartIanNaylor commented 4 years ago

Yes as I am running 5.2 and it also works on other distro's. https://en.wikipedia.org/wiki/Raspbian as its not only me who finds strange that a LTS based scheduled distro should jump LTS and not just dist-upgrade. Anyway I will just check the lib exists. Try that just edited the git haven't tried but should work.

mstormi commented 4 years ago

Hmm, you still clone and try compiling the modified tools repo. That still fails.

BTW, please (when done) create a tag v0.2 or whatever so I can clone that instead of master.

pi@devpi:~/openhabian/z $ sudo sh install.sh libattr.so.1 (libc6,hard-float) => /lib/arm-linux-gnueabihf/libattr.so.1 libattr.so (libc6,hard-float) => /lib/arm-linux-gnueabihf/libattr.so Paketlisten werden gelesen... Fertig Abhängigkeitsbaum wird aufgebaut. Statusinformationen werden eingelesen.... Fertig libattr1-dev ist schon die neueste Version (1:2.4.47-2). 0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert. Klone nach 'overlayfs-tools' ... remote: Enumerating objects: 96, done. remote: Total 96 (delta 0), reused 0 (delta 0), pack-reused 96 Entpacke Objekte: 100% (96/96), Fertig. gcc -Wall -std=c99 -c main.c gcc -Wall -std=c99 -c logic.c logic.c: In function ‘is_opaquedir’: logic.c:38:32: error: ‘ENOATTR’ undeclared (first use in this function) if ((res < 0) && (errno != ENOATTR)) { ^~~ logic.c:38:32: note: each undeclared identifier is reported only once for each function it appears i n makefile:14: die Regel für Ziel „logic.o“ scheiterte make: *** [logic.o] Fehler 1 install: der Aufruf von stat für 'overlayfs-tools/overlay' ist nicht möglich: Datei oder Verzeichnis nicht gefunden Synchronizing state of zram-config.service with SysV service script with /lib/systemd/systemd-sysv-i nstall. Executing: /lib/systemd/systemd-sysv-install enable zram-config

Reboot to activate zram-config
edit /etc/ztab to configure options

pi@devpi:~/openhabian/z $

StuartIanNaylor commented 4 years ago

PS fork the repo so you have your static version that you can adopt to fit as you wish Struggling slightly as sold the pi4b, pi3b and now my pi3a+ just loops on systemd irrespective of desktop image. It would seem to be broken. So working on a Pi-zero-w isn't much fun

Also suggest you test the merge function is working as changed ENOATTR to be ENODATA but actually not sure of/if any implications.

mstormi commented 4 years ago

I mirrored your repo and will take my clones from there

Your current install.sh first line is broken. But once corrected, it built and runs.

yutayu commented 4 years ago

root@raspberrypi:/home/pi/Documents/zram-config# sh install.sh install.sh: 4: install.sh: Syntax error: "(" unexpected (expecting "}")

I cannot install zram-config in raspbian buster.

sorry,This error occurs in master.

StuartIanNaylor commented 4 years ago

@mstormi I also decided to clone both the original overlayfs tools so that then I can edit if need be. There is still difference between stretch & buster and both are needed using /etc/os-release is a much better solution than kernel but presumed stretch would stay 4.14

Thanks