Skip to content
This repository was archived by the owner on Jun 14, 2022. It is now read-only.
This repository was archived by the owner on Jun 14, 2022. It is now read-only.

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

Description

@chesamo

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
  1. Attempt to correct: $ cmake -D_FILE_OFFSET_BITS=64 ..
  2. 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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions