mwri / erlang-efuse

Erlang FUSE (Filesystem in Userspace) interface.
MIT License
12 stars 5 forks source link

Not building on OTP 22 (on Mac) #1

Open lawik opened 4 years ago

lawik commented 4 years ago

I'm on: Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Trying to build this, on a Mac if that matters, and it fails:

===> Compiling efuse
gcc -c -Wall -std=gnu99 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -shared -g -Wall -fPIC -MMD  -I"/usr/lib/erlang/lib/erl_interface-3.10.1/include" -I"/usr/lib/erlang/erts-9.2/include" efuse.c -o efuse.o
clang: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
gcc efuse.o  -lerl_interface -lei -pthread -lnsl -lfuse -lrt -ldl -o efuse
ld: library not found for -lerl_interface
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [efuse] Error 1
===> Hook for compile failed!

Hope that tells you something. Was really keen on trying this in a small personal project. But not really wanting to roll backwards with Elixir and Erlang versions.

Has it been known to build on Mac okay?

mwri commented 3 years ago

@lawik Apologies for never replying. It should work on OTP 22, the last commit compiled and ran on 22, see Travis CI build.

I've only ever compiled it for Linux, same as the CI build, it looks like you're missing the Erlang development libs to me. On Debian/Ubuntu that comes as part of the erlang-dev package.

mwri commented 3 years ago

Thought I'd try and compile it on my Ubuntu 20.04, as it has been a long time. Seems ok

$ make
rebar3 compile
===> Fetching rebar3_hex v6.11.5
===> Fetching hex_core v0.7.1
===> Fetching verl v1.0.2
===> Analyzing applications...
===> Compiling verl
===> Compiling hex_core
===> Compiling rebar3_hex
===> Verifying dependencies...
make[1]: Entering directory '/home/mjw/dev/erlang-efuse/c_src'
gcc -c -Wall -std=gnu99 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -shared -g -Wall -fPIC -MMD  -I"/usr/lib/erlang/lib/erl_interface-3.10.1/include" -I"/usr/lib/erlang/erts-9.2/include" efuse.c -o efuse.o
gcc efuse.o  -lerl_interface -lei -pthread -lnsl -lfuse -lrt -ldl -o efuse
cp efuse ../priv/
make[1]: Leaving directory '/home/mjw/dev/erlang-efuse/c_src'
===> Analyzing applications...
===> Compiling efuse
$ 

Running the tests, 7 of 9 pass, nothing particularly wrong, except it's struggling to umount / shutdown. So maybe it needs a bit of TLC in this area.

I was able to run up the app and mount with the erlfs implementation:

$ erl -pa ebin
Erlang/OTP 22 [erts-10.6.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Eshell V10.6.4  (abort with ^G)
1> application:start(efuse).
ok
2> efuse:mount("/tmp/erlfs", efuse_erlfs, undefined).
{ok,<0.86.0>}
3> 

Checking it:

$ ls /tmp/erlfs/pids/
'<0.0.0>'  '<0.4.0>'   '<0.46.0>'  '<0.50.0>'  '<0.55.0>'  '<0.59.0>'  '<0.62.0>'  '<0.66.0>'  '<0.70.0>'  '<0.78.0>'  '<0.84.0>'
'<0.1.0>'  '<0.41.0>'  '<0.48.0>'  '<0.52.0>'  '<0.56.0>'  '<0.6.0>'   '<0.63.0>'  '<0.67.0>'  '<0.72.0>'  '<0.81.0>'  '<0.86.0>'
'<0.2.0>'  '<0.43.0>'  '<0.49.0>'  '<0.53.0>'  '<0.57.0>'  '<0.60.0>'  '<0.64.0>'  '<0.68.0>'  '<0.73.0>'  '<0.82.0>'  '<0.87.0>'
'<0.3.0>'  '<0.45.0>'  '<0.5.0>'   '<0.54.0>'  '<0.58.0>'  '<0.61.0>'  '<0.65.0>'  '<0.69.0>'  '<0.76.0>'  '<0.83.0>'  '<0.9.0>'
(ma) mjw@hari:~/dev/modo-react$ ls -la /tmp/erlfs/apps/efuse/
total 0
drwxr-xr-x 2 root root  0 Jan  1  1970 .
drwxr-xr-x 2 root root  0 Jan  1  1970 ..
lrwxr-xr-x 1 root root  0 Jan  1  1970 app_proc -> '/tmp/erlfs/pids/<0.81.0>'
-rw-r--r-- 1 root root 38 Jan  1  1970 descr
drwxr-xr-x 2 root root  0 Jan  1  1970 env
lrwxr-xr-x 1 root root  0 Jan  1  1970 top_sup -> '/tmp/erlfs/pids/<0.83.0>'
-rw-r--r-- 1 root root  6 Jan  1  1970 vsn
$ 
lawik commented 3 years ago

My Mac setup is mostly dormant right now so won't be trying to figure it out again anytime soon. But thanks for the response. Might give this a shot on Linux sometime though :)

mwri commented 3 years ago

You're welcome. Good luck.

tucnak commented 2 years ago

Hey @mwri AFAIK erl_interface was removed in OTP 23+ and replaced with ei however I have no idea what is that they do and in what ways differ as I'm a measly Elixir engineer. How would one go about migrating if I want to keep using efuse (and userfs) in OTP 24 and further? Do you feel like it's a migration you would be able to do?

Cheers

mwri commented 2 years ago

@tucnak My Ubuntu 22.04 image (Jammy) has OTP 24 and still seems to have the deps, but either way, as you've identified in https://github.com/mwri/erlang-efuse/issues/2, erl_interface is a redundant dependency anyway actually.