Skip to content

uClibc build fails due to ambiguous type; possible fix presented #1833

@akater

Description

@akater

On my uClibc(-ng)-based system, uintmax_t is said to be ambiguous, and ledger won't compile due to this. With the following patch applied, ledger compiles and works fine for me. However, I have next to 0 experience with C++ programming, and I came up with this “solution” by grepping around in my /usr/include for 1 minute or so and making wild guesses, so I don't even feel comfortable forking and making a pull request. Just want you to be aware of the issue and of possible solution. I'll provide feedback about the system in question if needed, of course.

--- a/src/journal.h
+++ b/src/journal.h
@@ -78,7 +78,7 @@
   struct fileinfo_t
   {
     optional<path> filename;
-    uintmax_t      size;
+    boost::uintmax_t      size;
     datetime_t     modtime;
     bool           from_stream;
 

--- a/src/filters.h
+++ b/src/filters.h
@@ -371,7 +371,7 @@
 public:
   anonymize_posts(post_handler_ptr handler)
     : item_handler<post_t>(handler), next_comm_id(0), last_xact(NULL),
-      rnd_gen(static_cast<unsigned int>(static_cast<uintmax_t>(std::time(0)))),
+      rnd_gen(static_cast<unsigned int>(static_cast<boost::uintmax_t>(std::time(0)))),
       integer_range(1, 2000000000L),
       integer_gen(rnd_gen, integer_range) {
     TRACE_CTOR(anonymize_posts, "post_handler_ptr");


--- a/src/filters.cc
+++ b/src/filters.cc
@@ -253,7 +253,7 @@
     xact.copy_details(*post.xact);
 
     std::ostringstream buf;
-    buf << reinterpret_cast<uintmax_t>(post.xact->payee.c_str())
+    buf << reinterpret_cast<boost::uintmax_t>(post.xact->payee.c_str())
         << integer_gen() << post.xact->payee.c_str();
 
   sha.reset();

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