vgough / encfs

EncFS: an Encrypted Filesystem for FUSE.
https://vgough.github.io/encfs/
Other
2.09k stars 277 forks source link

MacOS: fails to compile #652

Open mouse07410 opened 2 years ago

mouse07410 commented 2 years ago

MacOS Monterey 12.4, Xcode-13.4.1, encfs current master.

$ make all
.  .  .
Consolidate compiler generated dependencies of target encfs
[ 12%] Building CXX object CMakeFiles/encfs.dir/encfs/NullCipher.cpp.o
/Users/ur20980/src/encfs/encfs/NullCipher.cpp:81:36: error: no matching constructor for initialization of 'std::shared_ptr<AbstractCipherKey>'
std::shared_ptr<AbstractCipherKey> gNullKey(new NullKey(), NullDestructor());
                                   ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:469:26: note: candidate constructor template not viable: no known conversion from 'encfs::NullKey *' to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
    template <class _Dp> shared_ptr(nullptr_t __p, _Dp __d);
                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:464:9: note: candidate template ignored: requirement '__shared_ptr_deleter_ctor_reqs<encfs::NullDestructor, encfs::NullKey, encfs::AbstractCipherKey>::value' was not satisfied [with _Yp = encfs::NullKey, _Dp = encfs::NullDestructor]
        shared_ptr(_Yp* __p, _Dp __d,
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:471:51: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against 'encfs::NullKey *'
    template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT;
                                                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:476:9: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against 'encfs::NullKey *'
        shared_ptr(const shared_ptr<_Yp>& __r,
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:481:52: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against 'encfs::NullKey *'
    template<class _Yp> _LIBCPP_INLINE_VISIBILITY  shared_ptr(shared_ptr<_Yp>&& __r,
                                                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:484:34: note: candidate template ignored: could not match 'weak_ptr<type-parameter-0-0>' against 'encfs::NullKey *'
    template<class _Yp> explicit shared_ptr(const weak_ptr<_Yp>& __r,
                                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:488:9: note: candidate template ignored: could not match 'auto_ptr<type-parameter-0-0>' against 'encfs::NullKey *'
        shared_ptr(auto_ptr<_Yp>&& __r,
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:492:9: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'encfs::NullKey *'
        shared_ptr(unique_ptr<_Yp, _Dp>&&,
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:500:9: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'encfs::NullKey *'
        shared_ptr(unique_ptr<_Yp, _Dp>&&,
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:441:23: note: candidate constructor not viable: requires 1 argument, but 2 were provided
    _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT;
                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:454:14: note: candidate constructor template not viable: requires single argument '__p', but 2 arguments were provided
    explicit shared_ptr(_Yp* __p) : __ptr_(__p) {
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:473:5: note: candidate constructor not viable: requires single argument '__r', but 2 arguments were provided
    shared_ptr(const shared_ptr& __r) _NOEXCEPT;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:480:5: note: candidate constructor not viable: requires single argument '__r', but 2 arguments were provided
    shared_ptr(shared_ptr&& __r) _NOEXCEPT;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:470:40: note: candidate constructor template not viable: requires 3 arguments, but 2 were provided
    template <class _Dp, class _Alloc> shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a);
                                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:439:23: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
    _LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT;
                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:467:9: note: candidate constructor template not viable: requires at least 3 arguments, but 2 were provided
        shared_ptr(_Yp* __p, _Dp __d, _Alloc __a,
        ^
In file included from /Users/ur20980/src/encfs/encfs/NullCipher.cpp:21:
In file included from /Users/ur20980/src/encfs/encfs/NullCipher.h:26:
In file included from /Users/ur20980/src/encfs/encfs/Cipher.h:31:
/Users/ur20980/src/encfs/encfs/Interface.h:60:14: warning: definition of implicit copy constructor for 'Interface' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy]
  Interface &operator=(const Interface &src) = default;
             ^
/Users/ur20980/src/encfs/encfs/NullCipher.cpp:87:50: note: in implicit copy constructor for 'encfs::Interface' first required here
Interface NullCipher::interface() const { return iface; }
                                                 ^
1 warning and 1 error generated.
make[2]: *** [CMakeFiles/encfs.dir/build.make:356: CMakeFiles/encfs.dir/encfs/NullCipher.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:264: CMakeFiles/encfs.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

I'd really appreciate your help!

mouse07410 commented 2 years ago

@vgough ...?

stevenChuCP commented 2 years ago

I also got this error message.

Found out that someone has fixed the compile error https://github.com/vgough/encfs/pull/650. However, it did not pass the integration test.

Is it a compiler problem? Seems that you can build encfs with an older XCode version.

mouse07410 commented 2 years ago

@stevenChuCP the compiler got more strict in what it accepts, so the encfs code doesn't compile anymore with the recent (current) compilers.

Yes, old compilers still let that code pass. But that's not a solution for me, alas.

Re. Integration test for #650. I'm not sure it really failed - it looks like incompatibility between the old CI script and the current system. I'll look into it.

We need to figure how to fix the code...

mouse07410 commented 2 years ago

After merging #650, all tests (unittests and integration) passed on one machine with OSXFuse v4.2.3. A few integration tests failed on two other boxes - all are Macs (OSXFuse v4.4.0). So, I suspect the FUSE version. In any case, my fork has #650 merged.

Failing tests are in integration/reverse, and seem to deal with extended file attributes over symlink. I probably won't be able to do anything about this problem. At least, encfs successfully builds again, and passes most of the tests (including those that I do care about).

@stevenChuCP thanks for pointing me at #650.

stevenChuCP commented 2 years ago

@mouse07410 I've tried to build with g++-11 and it worked without changing the codes.

What do you think is the better solution to resolve this issue?

mouse07410 commented 2 years ago

I've tried to build with g++-11 and it worked without changing the codes

First, are you saying that this way it passed all the integration tests? Did you mean GCC v11, or -std=gnu++11?

Second, I think it's important for the code to work with both GCC and Clang. Also, did you try to build it and run integration tests with GCC (well, g++) v12?

stevenChuCP commented 2 years ago

Did you mean GCC v11

Yes, it was GCC v11. I also tried GCC v12, it build successfully. Although both of them did not pass the integration tests.

Failing tests are in integration/reverse

I'm also failing at this step. I have OSXFuse 4.2.5 installed on my Mac.

mouse07410 commented 2 years ago

Failing tests are in integration/reverse

I'm also failing at this step. I have OSXFuse 4.2.5 installed on my Mac.

In that case, I will keep the #650 merged in my fork. Being able to build with all reasonable C++ compilers (G++ and Clang) is more important to me than keeping the code unchanged.

I installed OSXFuse 4.4.0, with the same results - apparently, something with symlinking xattr is broken (thats seems to be the scope of the failure), but I don't know how to go about fixing it. Perhaps, if/when @vgough is back, he can shed some light on this. In the meanwhile, patched code works, though it fails some tests.

mouse07410 commented 2 years ago

I wonder if this very useful package is still maintained?

m-urban commented 9 months ago

In case someone finds this thread in 2024: Compilation (and execution) still succeed on macOS Sonoma 14.3.1 and Apple Silicon (M2 in my case) with macFUSE 4.6.0, when compiled with GCC 13. Clang (from Xcode 15) continues to fail with the above problem, as does the "reverse" integration test.

Installation nevertheless worked as per my notes:

  1. brew install cmake gcc macfuse openssl
  2. Enable macFUSE kernel extension for macOS using the recovery system and its Startup Security Utility
  3. Clone and go to encfs source directory
  4. mkdir build && cd build
  5. Compiling with clang fails, so let's make sure to use GCC instead: export CXX=/opt/homebrew/Cellar/gcc/13.2.0/bin/g++-13
  6. The FUSE library is automatically found after installation in /usr/local/ but OpenSSL evidently isn't, so set OPENSSL_ROOT_DIR: cmake -DOPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl/ ..
  7. make
  8. make unittests
  9. make test (fails)
    1. make integration (normal.t.pl test suite succeeds, reverse.t.pl fails)
    2. make install (installs into /usr/local by default, override with -DCMAKE_INSTALL_PREFIX=/some/other/path)