alperakcan/fuse-ext2

build script doesn't work MacOS Sonoma 14.4

Opened this issue · 21 comments

gcc -DHAVE_CONFIG_H -I. -I.. -Wall -DHAVE_CONFIG_H -I/usr/local/include -D__FreeBSD__=10 -idirafter/opt/gnu/include -idirafter/usr/local/include/fuse/ -MT fuse_ext2-fuse-ext2.o -MD -MP -MF .deps/fuse_ext2-fuse-ext2.Tpo -c -o fuse_ext2-fuse-ext2.o test -f 'fuse-ext2.c' || echo './'fuse-ext2.c
fuse-ext2.c:301:20: error: incompatible function pointer types initializing 'int (*)(const char *, const char *, char , size_t, uint32_t)' (aka 'int ()(const char *, const char *, char *, unsigned long, unsigned int)') with an expression of type 'int (const char *, const char *, char *, size_t)' (aka 'int (const char *, const char *, char , unsigned long)') [-Wincompatible-function-pointer-types]
.getxattr = op_getxattr,
^~~~~~~~~~~
1 error generated.
make[2]: *** [fuse_ext2-fuse-ext2.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Making install in fuse-ext2
gcc -DHAVE_CONFIG_H -I. -I.. -Wall -DHAVE_CONFIG_H -I/usr/local/include -D__FreeBSD__=10 -idirafter/opt/gnu/include -idirafter/usr/local/include/fuse/ -MT fuse_ext2-fuse-ext2.o -MD -MP -MF .deps/fuse_ext2-fuse-ext2.Tpo -c -o fuse_ext2-fuse-ext2.o test -f 'fuse-ext2.c' || echo './'fuse-ext2.c
fuse-ext2.c:301:20: error: incompatible function pointer types initializing 'int (
)(const char *, const char *, char , size_t, uint32_t)' (aka 'int ()(const char *, const char *, char *, unsigned long, unsigned int)') with an expression of type 'int (const char *, const char *, char *, size_t)' (aka 'int (const char *, const char *, char *, unsigned long)') [-Wincompatible-function-pointer-types]
.getxattr = op_getxattr,
^~~~~~~~~~~
1 error generated.
make[1]: *** [fuse_ext2-fuse-ext2.o] Error 1
make: *** [install-recursive] Error 1

Same problem, and can not find a proper solution....

me also I don't know why it happens that's why I added a ticket

Same here...

Same issue

Adding -Wno-error=incompatible-function-pointer-types to CFLAGS should solve the issue. It seems that -Wno-error=incompatible-function-pointer-types is also required to build e2fsprogs.
Also, you should rename or delete include/uuid/uuid.h in the e2fsprogs package, because it causes a conflict with XCode.

EDIT:
Obviously, the method above is not a good idea. For more proper fix, you can add missing arguments to op_getxattr like this:

getxattr-macos-fix.patch

diff --git a/fuse-ext2/fuse-ext2.h b/fuse-ext2/fuse-ext2.h
index 07fd1db..09399ed 100644
--- a/fuse-ext2/fuse-ext2.h
+++ b/fuse-ext2/fuse-ext2.h
@@ -178,7 +178,7 @@ int op_fgetattr (const char *path, struct stat *stbuf, struct fuse_file_info *fi
 
 int op_getattr (const char *path, struct stat *stbuf);
 
-int op_getxattr(const char *path, const char *name, char *value, size_t size);
+int op_getxattr(const char *path, const char *name, char *value, size_t size, uint32_t position);
 
 ext2_file_t do_open (ext2_filsys e2fs, const char *path, int flags);
 
diff --git a/fuse-ext2/op_getxattr.c b/fuse-ext2/op_getxattr.c
index 27f95c3..1c7f783 100644
--- a/fuse-ext2/op_getxattr.c
+++ b/fuse-ext2/op_getxattr.c
@@ -15,7 +15,7 @@
 static int do_getxattr(ext2_filsys e2fs, struct ext2_inode *node, const char *name,
 		char *value, size_t size);
 
-int op_getxattr(const char *path, const char *name, char *value, size_t size) {
+int op_getxattr(const char *path, const char *name, char *value, size_t size, uint32_t position) {
 	int rt;
 	ext2_ino_t ino;
 	struct ext2_inode inode;

Adding -Wno-error=incompatible-function-pointer-types to CFLAGS should solve the issue. It seems that -Wno-error=incompatible-function-pointer-types is also required to build e2fsprogs. Also, you should rename or delete include/uuid/uuid.h in the e2fsprogs package, because it causes a conflict with XCode.

EDIT: Obviously, the method above is not a good idea. For more proper fix, you can add missing arguments to op_getxattr like this:

getxattr-macos-fix.patch

diff --git a/fuse-ext2/fuse-ext2.h b/fuse-ext2/fuse-ext2.h
index 07fd1db..09399ed 100644
--- a/fuse-ext2/fuse-ext2.h
+++ b/fuse-ext2/fuse-ext2.h
@@ -178,7 +178,7 @@ int op_fgetattr (const char *path, struct stat *stbuf, struct fuse_file_info *fi
 
 int op_getattr (const char *path, struct stat *stbuf);
 
-int op_getxattr(const char *path, const char *name, char *value, size_t size);
+int op_getxattr(const char *path, const char *name, char *value, size_t size, uint32_t position);
 
 ext2_file_t do_open (ext2_filsys e2fs, const char *path, int flags);
 
diff --git a/fuse-ext2/op_getxattr.c b/fuse-ext2/op_getxattr.c
index 27f95c3..1c7f783 100644
--- a/fuse-ext2/op_getxattr.c
+++ b/fuse-ext2/op_getxattr.c
@@ -15,7 +15,7 @@
 static int do_getxattr(ext2_filsys e2fs, struct ext2_inode *node, const char *name,
 		char *value, size_t size);
 
-int op_getxattr(const char *path, const char *name, char *value, size_t size) {
+int op_getxattr(const char *path, const char *name, char *value, size_t size, uint32_t position) {
 	int rt;
 	ext2_ino_t ino;
 	struct ext2_inode inode;

Thanks for your solution.
If I apply this patch, do I need to rename or delete include/uuid/uuid.h?
Thanks.

i am not a programmer how can I apply the patch in the script or on the command line ?

this is the script I use how can I implement the patch just rename to sh

test_script.txt

i am not a programmer how can I apply the patch in the script or on the command line ?

patch fuse-ext2/fuse-ext2.h getxattr-macos-fix.patch

@DexterSLamb
Yes, you should remove it from the installation folder.
So for example if you installed it on /opt/gnu, mv /opt/gnu/include/uuid/uuid.h /opt/gnu/include/uuid/uuid.h.bak
If you installed e2fsprogs through homebrew, mv /usr/local/opt/e2fsprogs/include/uuid/uuid.h /usr/local/opt/e2fsprogs/include/uuid/uuid.h.bak

@DexterSLamb Yes, you should remove it from the installation folder. So for example if you installed it on /opt/gnu, mv /opt/gnu/include/uuid/uuid.h /opt/gnu/include/uuid/uuid.h.bak If you installed e2fsprogs through homebrew, mv /usr/local/opt/e2fsprogs/include/uuid/uuid.h /usr/local/opt/e2fsprogs/include/uuid/uuid.h.bak

got it thanks.

I still get the same error after applying the patch.. I am kinda lost at this point

I needed an other script. because e2fslibs could not be found and isn't installable

test2 kopie.txt

to find e2fslibs you need to adjust PATHS:

nano ~/.zshrc

export PATH="/opt/homebrew/opt/e2fsprogs/bin:$PATH"
export PATH="/opt/homebrew/opt/e2fsprogs/sbin:$PATH"
export PKG_CONFIG_PATH="/opt/homebrew/opt/e2fsprogs/lib/pkgconfig:$PKG_CONFIG_PATH"
export CFLAGS="-idirafter/opt/gnu/include -idirafter/usr/local/include/osxfuse/ -idirafter/$(brew --prefix e2fsprogs)/include"
export LDFLAGS="-L/usr/local/opt/glib -L/usr/local/lib -L$(brew --prefix e2fsprogs)/lib"

source ~/.zshrc

this is my error:

/Library/Developer/CommandLineTools/usr/bin/make all-recursive
Making all in fuse-ext2
gcc -DHAVE_CONFIG_H -I. -I.. -Wall -DHAVE_CONFIG_H -I/usr/local/include -D__FreeBSD__=10 -idirafter/opt/gnu/include -idirafter/usr/local/include/osxfuse/ -idirafter//opt/homebrew/opt/e2fsprogs/include -MT fuse_ext2-fuse-ext2.o -MD -MP -MF .deps/fuse_ext2-fuse-ext2.Tpo -c -o fuse_ext2-fuse-ext2.o test -f 'fuse-ext2.c' || echo './'fuse-ext2.c
fuse-ext2.c:280:12: error: static declaration of 'op_getxattr' follows non-static declaration
static int op_getxattr(const char *path, const char *name, char *value, size_t size, uint32_t position) {
^
./fuse-ext2.h:181:5: note: previous declaration is here
int op_getxattr (const char *path, const char *name, char *value, size_t size, uint32_t position);
^
1 error generated.
make[2]: *** [fuse_ext2-fuse-ext2.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
melisgia@itmrm09 fuse-ext2 %

so.. I've restarted, then i deleted the whole repo and redownloaded it

git clone https://github.com/alperakcan/fuse-ext2.git /tmp/ext4
cd /tmp/ext4

then I've modified the two files manually (using the patch diff info)

I ran the script:

./autogen.sh
CFLAGS="-idirafter/opt/gnu/include -idirafter/usr/local/include/osxfuse/ -idirafter/$(brew --prefix e2fsprogs)/include" LDFLAGS="-L/usr/local/opt/glib -L/usr/local/lib -L$(brew --prefix e2fsprogs)/lib" ./configure --prefix=/usr/local

it asked to install an Xcode module.
after installation:

sudo xcodebuild -license
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

then I ran the script again:

./autogen.sh
CFLAGS="-idirafter/opt/gnu/include -idirafter/usr/local/include/osxfuse/ -idirafter/$(brew --prefix e2fsprogs)/include" LDFLAGS="-L/usr/local/opt/glib -L/usr/local/lib -L$(brew --prefix e2fsprogs)/lib" ./configure --prefix=/usr/local

now it finally works:

% fuse-ext2 --version

fuse-ext2 0.0.11 29 - FUSE EXT2FS Driver

Copyright (C) 2008-2015 Alper Akcan alper.akcan@gmail.com
Copyright (C) 2009 Renzo Davoli renzo@cs.unibo.it

Usage: fuse-ext2 <device|image_file> <mount_point> [-o option[,...]]

Options: ro, force, allow_other
Please see details in the manual.

Example: fuse-ext2 /dev/sda1 /mnt/sda1

http://github.com/alperakcan/fuse-ext2/

so.. I've restarted, then i deleted the whole repo and redownloaded it

git clone https://github.com/alperakcan/fuse-ext2.git /tmp/ext4 cd /tmp/ext4

then I've modified the two files manually (using the patch diff info)

I ran the script:

./autogen.sh CFLAGS="-idirafter/opt/gnu/include -idirafter/usr/local/include/osxfuse/ -idirafter/$(brew --prefix e2fsprogs)/include" LDFLAGS="-L/usr/local/opt/glib -L/usr/local/lib -L$(brew --prefix e2fsprogs)/lib" ./configure --prefix=/usr/local

it asked to install an Xcode module. after installation:

sudo xcodebuild -license sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

then I ran the script again:

./autogen.sh CFLAGS="-idirafter/opt/gnu/include -idirafter/usr/local/include/osxfuse/ -idirafter/$(brew --prefix e2fsprogs)/include" LDFLAGS="-L/usr/local/opt/glib -L/usr/local/lib -L$(brew --prefix e2fsprogs)/lib" ./configure --prefix=/usr/local

now it finally works:

% fuse-ext2 --version

fuse-ext2 0.0.11 29 - FUSE EXT2FS Driver

Copyright (C) 2008-2015 Alper Akcan alper.akcan@gmail.com Copyright (C) 2009 Renzo Davoli renzo@cs.unibo.it

Usage: fuse-ext2 <device|image_file> <mount_point> [-o option[,...]]

Options: ro, force, allow_other Please see details in the manual.

Example: fuse-ext2 /dev/sda1 /mnt/sda1

http://github.com/alperakcan/fuse-ext2/

Great work thanks for sharing.

@alperakcan Do you think the patch that fixes compilation (#143 (comment)) could be merged? Or was this function signature correct at some point, maybe for an older FUSE version?

new to FUSE and this project, just had my compilation fail on me because of this error.
It's great I'm not alone and there's already a potential patch fo rit.
Would it be worth it to wait for the patch to be applied, or should I patch the source my self?

I just had this error. I am very new to this and FUSE and not sure if I should try running any of the above scripts because of that. Not sure what to do :/

MacOS - Sonoma 14.2.1 - Intel

AFAICS, the argument is new, possibly introduced with Sonoma. In order for this to be merged, I think one would have to

  • make it conditional (so that compilation on older systems still works), and
  • actually use the new position argument for something. Or check that it has some expected value (0, probably) at runtime, if no other value is supported).