Skip to content

Generic Persisted Keypair implementation fails to compile under Windows + GNU toolchain #7

@yutotakano

Description

@yutotakano

Hi. I'm trying to compile and link to libdave using the Mingw GNU toolchain (gcc, g++) using the generic persisted keypair implementation. I'm aware there is a Windows-native one, but I just want to make sure that the generic implementation works as well.

There are two issues in persisted_key_pair_generic.cpp that prevent successful compilation currently:

  • 'class std::basic_ostream<char>' has no member named 'str'

    • Line 97 has the following code, which apparently compiles fine with MSVC, but won't with gcc. This is likely due to different standard library implementations. This is apparently a common issue and the recommended fix seems to be either to static_cast before calling .str() on it, or to expand it into multiple lines with typed variables.
      curstr = (std::stringstream() << ifs.rdbuf()).str();
      if (!ifs) {
  • _S_IREAD and _S_IWRITE not declared in scope

    • Line 120 has the following code, which fails to compile due to a missing include for <sys/stat.h> under _WIN32. I haven't tested compiling this with MSVC, but this seems like a generic issue that would affect not just the GNU toolchain.
      #ifdef _WIN32
      int fd = _wopen(tmpfile.c_str(), _O_WRONLY | _O_CREAT | _O_TRUNC, _S_IREAD | _S_IWRITE);
      #else

Could this be reproduced and investigated? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions