Opened 2 years ago

Last modified 2 years ago

#65361 new defect

encfs 1.9.5_2: error: no matching constructor for initialization of 'std::shared_ptr<AbstractCipherKey>'

Reported by: MichaelJFischer Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: Cc: mouse07410 (Mouse), mascguy (Christopher Nielsen)
Port: encfs

Description (last modified by kencu (Ken))

~> sudo port install encfs
--->  Computing dependencies for encfs
--->  Fetching archive for encfs
--->  Attempting to fetch encfs-1.9.5_2.darwin_21.x86_64.tbz2 from https://packages.macports.org/encfs
--->  Attempting to fetch encfs-1.9.5_2.darwin_21.x86_64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/encfs
--->  Attempting to fetch encfs-1.9.5_2.darwin_21.x86_64.tbz2 from https://mse.uk.packages.macports.org/encfs
--->  Fetching distfiles for encfs
--->  Verifying checksums for encfs
--->  Extracting encfs
--->  Configuring encfs
--->  Building encfs                                     
Error: Failed to build encfs: command execution failed   
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_fuse_encfs/encfs/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port encfs failed

Attachments (1)

main.log (214.7 KB) - added by MichaelJFischer 2 years ago.
Log file /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_fuse_encfs/encfs/main.log

Download all attachments as: .zip

Change History (11)

Changed 2 years ago by MichaelJFischer

Attachment: main.log added

Log file /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_fuse_encfs/encfs/main.log

comment:1 Changed 2 years ago by MichaelJFischer

A copy of the binary encfs @1.9.5_2 that I built in January 2022 on another MAC runs correctly on the machine where the build now fails, so I know the installation of macfuse (on which encfs depends) works.

comment:2 Changed 2 years ago by kencu (Ken)

at first glance, this looks like an error generated by an increasingly-strict clang compiler.

usually, the best thing to do with these is bump them upstream as they probably need to tweak their code, or maybe they have already fixed it in a version that hasn't been released as yet.

1282	:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_fuse_encfs/encfs/work/encfs-1.9.5/encfs/NullCipher.cpp:81:36: error: no matching constructor for initialization of 'std::shared_ptr<AbstractCipherKey>'
1283	:info:build std::shared_ptr<AbstractCipherKey> gNullKey(new NullKey(), NullDestructor());
1284	:info:build                                    ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1285	:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX12.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
1286	:info:build     template <class _Dp> shared_ptr(nullptr_t __p, _Dp __d);
1287	:info:build                          ^

comment:3 Changed 2 years ago by kencu (Ken)

Description: modified (diff)

comment:4 Changed 2 years ago by kencu (Ken)

Summary: encfs 1.9.5_2: build failureencfs 1.9.5_2: error: no matching constructor for initialization of 'std::shared_ptr<AbstractCipherKey>'

comment:5 Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: mouse07410 added

comment:6 Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:7 Changed 2 years ago by mouse07410 (Mouse)

No, it is not fixed upstream (yet?). The last commit to the upstream repo was in 2020. So, I'm afraid, we might have to do it ourselves. :-( Unless the upstream maintainers respond? GitHub issue was submitted today.

comment:8 Changed 2 years ago by michaellass (Michael Lass)

As a temporary workaround to get encfs to build, one can add the following line to the Portfile:

configure.compiler macports-clang-12

Reference to the upstream bug report: https://github.com/vgough/encfs/issues/652

comment:9 Changed 2 years ago by mouse07410 (Mouse)

configure.compiler macports-clang-12

Is the point here to use Macports clang, as opposed to Xcode clang? Or ro use macports-clang-12, as opposed to, e.g., macports-clang-14?

Answered my own question: it has to be Macports clang-12, newer compilers fail with the given error.

Upstream has not reacted so far, and the last commit in the upstream repo was in 2020.

I'm afraid it's up to us (this community) to provide a workaround/fix that allows building with clang-13 or newer. If I knew how to fix it, I'd propose it already.

Last edited 2 years ago by mouse07410 (Mouse) (previous) (diff)

comment:10 Changed 2 years ago by mouse07410 (Mouse)

Here's the fix:

diff --git a/encfs/NullCipher.cpp b/encfs/NullCipher.cpp
index 50dadff..5e1a472 100644
--- a/encfs/NullCipher.cpp
+++ b/encfs/NullCipher.cpp
@@ -76,7 +76,7 @@ class NullDestructor {
   NullDestructor &operator=(const NullDestructor &) = delete; // copy assignment
   NullDestructor& operator=(NullDestructor&& other) = delete; // move assignment
 
-  void operator()(NullKey *&) {}
+  void operator()(NullKey *) {}
 };
 std::shared_ptr<AbstractCipherKey> gNullKey(new NullKey(), NullDestructor());
 
diff --git a/encfs/main.cpp b/encfs/main.cpp
index 71dfd71..26b4a68 100644
--- a/encfs/main.cpp
+++ b/encfs/main.cpp
@@ -28,6 +28,10 @@
 #include <pthread.h>
 #include <sstream>
 #include <string>
+#ifdef __APPLE__
+#include <sys/mount.h>
+#include <sys/param.h>
+#endif
 #ifdef __CYGWIN__
 #include <sys/cygwin.h>
 #endif
Note: See TracTickets for help on using tickets.