gromgit / homebrew-fuse

gromgit's FUSE tap
BSD 2-Clause "Simplified" License
325 stars 37 forks source link

sshfs compile error on m1 mac #14

Closed mo5h closed 3 years ago

mo5h commented 3 years ago

Got this error when installing sshfs-mac on my M1 Mac (abrew is aliased to my m1 brew installation) saw you were interested to hear if anyone got any errors so here's one:

○ → abrew install gromgit/fuse/sshfs-mac
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 38 formulae.

==> Installing sshfs-mac from gromgit/fuse
==> Downloading https://github.com/libfuse/sshfs/commit/667cf34622e2e873db776791
Already downloaded: /Users/hamish.farrant/Library/Caches/Homebrew/downloads/cdcad74dd3989c7992d0df5c9d06cabde2b6d7523ddbb551712a3733e0ba4b02--667cf34622e2e873db776791df275c7a582d6295.patch
==> Downloading https://github.com/libfuse/sshfs/archive/refs/tags/sshfs-2.10.ta
Already downloaded: /Users/hamish.farrant/Library/Caches/Homebrew/downloads/0edfcc9b3e41ebb509db4457e0888e5c6334c651f31c6f4db2afadd999dcc97a--sshfs-sshfs-2.10.tar.gz
==> Patching
==> Applying 667cf34622e2e873db776791df275c7a582d6295.patch
patching file sshfs.c
Hunk #1 succeeded at 3862 (offset -58 lines).
==> autoreconf -fiv
==> ./configure --prefix=/opt/homebrew/Cellar/sshfs-mac/2.10_1
==> make install
Last 15 lines from /Users/hamish.farrant/Library/Logs/Homebrew/sshfs-mac/03.make:
        <./sshfs.1.in >sshfs.1.tmp || exit 1; \
    mv sshfs.1.tmp sshfs.1
cache.c:14:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^~~~~~~~
clang -DHAVE_CONFIG_H -I.  -D_REENTRANT -DFUSE_USE_VERSION=26 -DLIBDIR=\"/opt/homebrew/Cellar/sshfs-mac/2.10_1/lib\" -DIDMAP_DEFAULT="\"user\"" -I/private/tmp/sshfs-mac-20210717-87518-1c56f4v/sshfs-sshfs-2.10/temp/include -I/private/tmp/sshfs-mac-20210717-87518-1c56f4v/sshfs-sshfs-2.10/temp/include/fuse -D_USE_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -I/usr/local/include/fuse -I/usr/local/Cellar/glib/2.68.3/include -I/usr/local/Cellar/glib/2.68.3/include/glib-2.0 -I/usr/local/Cellar/glib/2.68.3/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.45/include -I/private/tmp/sshfs-mac-20210717-87518-1c56f4v/sshfs-sshfs-2.10/temp/include -I/private/tmp/sshfs-mac-20210717-87518-1c56f4v/sshfs-sshfs-2.10/temp/include/fuse -D_USE_FILE_OFFSET_BITS=64 -Wall -W -I./compat -c -o compat/sshfs-darwin_compat.o `test -f 'compat/darwin_compat.c' || echo './'`compat/darwin_compat.c
1 error generated.
make[1]: *** [sshfs-cache.o] Error 1
make[1]: *** Waiting for unfinished jobs....
sshfs.c:41:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^~~~~~~~
1 error generated.
make[1]: *** [sshfs-sshfs.o] Error 1
make: *** [install-recursive] Error 1

Do not report this issue to Homebrew/brew or Homebrew/core!
gromgit commented 3 years ago

That's weird. Please run brew gist-logs sshfs-mac and post the URL here.

mo5h commented 3 years ago

https://gist.github.com/mo5h/d5d64fa4e8ba35a4fbef508884b50570

gromgit commented 3 years ago

That's weird, the build thinks glib is in /usr/local instead of /opt/homebrew. Do you have dual (Intel & M1) Homebrew installs on your Mac? What's the output of the following?

which -a pkg-config
pkg-config --cflags --libs glib-2.0
mo5h commented 3 years ago

Yeah that'd be it, I've got dual installs because some homebrew packages aren't aarch64 compatible

On Mon, 19 Jul 2021 at 14:09, Adrian Ho @.***> wrote:

That's weird, the build thinks glib is in /usr/local instead of /opt/homebrew. Do you have dual (Intel & M1) Homebrew installs on your Mac? What's the output of the following?

which -a pkg-config pkg-config --cflags --libs glib-2.0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gromgit/homebrew-fuse/issues/14#issuecomment-882219794, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF3JYI4KY3NOTBFPPWMQ6TTYOQODANCNFSM5AQZ4NQQ .

gromgit commented 3 years ago

And what's the output of:

which -a pkg-config
/usr/local/bin/pkg-config --cflags --libs glib-2.0
/opt/homebrew/bin/pkg-config --cflags --libs glib-2.0

?

mo5h commented 3 years ago


○ → which -a pkg-config
/usr/local/bin/pkg-config --cflags --libs glib-2.0
/opt/homebrew/bin/pkg-config --cflags --libs glib-2.0
/opt/homebrew/bin/pkg-config
/usr/local/bin/pkg-config
/opt/homebrew/bin/pkg-config
/usr/local/bin/pkg-config
-I/usr/local/Cellar/glib/2.68.3/include/glib-2.0 -I/usr/local/Cellar/glib/2.68.3/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.45/include -L/usr/local/Cellar/glib/2.68.3/lib -L/usr/local/opt/gettext/lib -lglib-2.0 -lintl
-I/opt/homebrew/Cellar/glib/2.68.3/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.68.3/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -L/opt/homebrew/Cellar/glib/2.68.3/lib -L/opt/homebrew/opt/gettext/lib -lglib-2.0 -lintl```
gromgit commented 3 years ago

OK, I think I've found the problem: sshfs's configure force-adds /usr/local/lib/pkgconfig at the beginning of PKG_CONFIG_PATH, so your Intel Homebrew libs always trump the M1 ones.

I've just pushed a formula patch to address this. Please brew update and brew install sshfs-mac again.

mo5h commented 3 years ago

Looks like that's fixed it, thanks!