relan / exfat

Free exFAT file system implementation
GNU General Public License v2.0
789 stars 179 forks source link

I want to compile mkexfatfs tool to run on ARM architecture. What should I do? #137

Closed coolyanghao closed 3 years ago

coolyanghao commented 4 years ago

I tried to change the cross compilation tool, but I made a compilation error.

error message:

geek@ubuntu:~/exfat-master/mkfs$ make
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I. -I../libexfat  -I../libexfat   -g -O2 -MT mkexfatfs-cbm.o -MD -MP -MF .deps/mkexfatfs-cbm.Tpo -c -o mkexfatfs-cbm.o `test -f 'cbm.c' || echo './'`cbm.c
In file included from ../libexfat/exfat.h:31:0,
                 from mkexfat.h:26,
                 from cbm.h:26,
                 from cbm.c:23:
../libexfat/compiler.h:58:29: error: static assertion failed: "sizeof(off_t) == 8"
 #define STATIC_ASSERT(cond) _Static_assert(cond, #cond)
                             ^
../libexfat/exfat.h:72:1: note: in expansion of macro 'STATIC_ASSERT'
 STATIC_ASSERT(sizeof(off_t) == 8);
 ^~~~~~~~~~~~~
Makefile:462: recipe for target 'mkexfatfs-cbm.o' failed
make: *** [mkexfatfs-cbm.o] Error 1

My environment

host_cpu:x86
host_os:ubuntu16.04
Compiler:arm-linux-gnueabihf-gcc

target_cpu: arm(imx6)
target_kernel: Linux apalis-imx6 4.9.144

My change

$ geek@ubuntu:~/exfat-master/mkfs$ vim Makefile
-  CC = gcc
+ CC = arm-linux-gnueabihf-gcc

I want to compile mkexfatfs tool to run on ARM architecture. What should I do?

relan commented 4 years ago

Your target platform has 32-bit off_t. You have the following options:

  1. Find a way to make off_t a 64-bit type. Something like _FILE_OFFSET_BITS=64 define on 32-bit GNU/Linux.
  2. Replace all occurences of off_t in the fuse-exfat code with some other 64-bit type, like off64_t.
  3. If you don't need to work with filesystems larger than 2 GB, just remove this static assert.