sergeyklay / pcloud-console-client

A simple console client for pCloud cloud storage.
https://pcloud.com
BSD 3-Clause "New" or "Revised" License
23 stars 10 forks source link

[BUG] Compiling on arm64/aarch64: error Please add -D_FILE_OFFSET_BITS=64 to your compile flags! #87

Closed EmberHeartshine closed 3 years ago

EmberHeartshine commented 3 years ago

Following the instructions here, I'm trying to compile this on an Oracle Cloud Ampere system. The system is running Ubuntu 20.04.

$ uname -a
20.04.1-Ubuntu SMP Fri Jul 16 00:56:44 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

Steps to reproduce:

  1. Follow the "Getting Started" instructions up to CMake.
  2. $ cmake ..
  3. Observe the following output:
    Scanning dependencies of target logger
    [  1%] Building C object src/logger/CMakeFiles/logger.dir/logger.c.o
    [  3%] Linking C static library ../../lib/liblogger.a
    [  3%] Built target logger
    Scanning dependencies of target psync
    [  4%] Building C object src/psync/CMakeFiles/psync.dir/pcompat.c.o
    [  6%] Building C object src/psync/CMakeFiles/psync.dir/pstringcompat.c.o
    [  7%] Building C object src/psync/CMakeFiles/psync.dir/psynclib.c.o
    [  9%] Building C object src/psync/CMakeFiles/psync.dir/plocks.c.o
    [ 10%] Building C object src/psync/CMakeFiles/psync.dir/plibs.c.o
    ... [snip] ...
    [ 64%] Building C object src/psync/CMakeFiles/psync.dir/pdeviceid.c.o
    [ 66%] Building C object src/psync/CMakeFiles/psync.dir/pfs.c.o
    In file included from /usr/include/fuse/fuse.h:26,
                 from /home/ubuntu/pcloud-console-client/src/psync/pfs.c:13:
    /usr/include/fuse/fuse_common.h:33:2: error: #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
    33 | #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
      |  ^~~~~
    make[2]: *** [src/psync/CMakeFiles/psync.dir/build.make:583: src/psync/CMakeFiles/psync.dir/pfs.c.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:1060: src/psync/CMakeFiles/psync.dir/all] Error 2
    make: *** [Makefile:141: all] Error 2
  4. Attempt to correct: $ cmake -D_FILE_OFFSET_BITS=64 ..
  5. Observe the following output:
    [  3%] Built target logger
    [  4%] Building C object src/psync/CMakeFiles/psync.dir/pfs.c.o
    In file included from /usr/include/fuse/fuse.h:26,
                 from /home/ubuntu/pcloud-console-client/src/psync/pfs.c:13:
    /usr/include/fuse/fuse_common.h:33:2: error: #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
    33 | #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
      |  ^~~~~
    make[2]: *** [src/psync/CMakeFiles/psync.dir/build.make:583: src/psync/CMakeFiles/psync.dir/pfs.c.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:1060: src/psync/CMakeFiles/psync.dir/all] Error 2
    make: *** [Makefile:141: all] Error 2

I'm not as incredibly familiar with C/C++ as I used to be, so I went hunting and I found this page. The second suggestion ended up working:

$ git diff
diff --git a/src/psync/pfs.c b/src/psync/pfs.c
index ad6c706..711ed83 100644
--- a/src/psync/pfs.c
+++ b/src/psync/pfs.c
@@ -10,6 +10,7 @@
  */

 #include <pthread.h>
+#define _FILE_OFFSET_BITS  64
 #include <fuse.h>
 #include <errno.h>
 #include <string.h>

HOWEVER this seems kludgy as all heck, so I didn't want to just make the change and open a PR since I'm not familiar with the codebase. Perhaps there's a more elegant solution?

EmberHeartshine commented 3 years ago

One of the changes in this PR from the upstream may help.

sergeyklay commented 3 years ago

Hmm... Interesting! I'll try to sort out ASAP.

sergeyklay commented 3 years ago

Fixed in the master branch. Feel free to open a new issue if the problem appears again. Thank you for contributing, and for helping make pCloud Console Client better!