hfiref0x / LightFTP

Small x86-32/x64 FTP Server
BSD 2-Clause "Simplified" License
232 stars 83 forks source link

Error when running on 32bits machine #24

Closed tylzh97 closed 2 years ago

tylzh97 commented 2 years ago

Hello, I compile LightFTP in Ubuntu 16.04 x86, but i can't run it correctly with hint: off_t is not 64 bits long

image

how could i fix it?

UldisRinkevichs commented 2 years ago

I was unable to reproduce this bug using latest LTS live i386 iso from https://releases.ubuntu.com/xenial/ inside virtualbox steps to build: sudo apt-get update sudo apt-get install libgnutls28-dev libgnutls30 cd -> to Debug directory make clean make ./fftp 3 2 1

Please check your packages and build environment.

tylzh97 commented 2 years ago

I was unable to reproduce this bug using latest LTS live i386 iso from https://releases.ubuntu.com/xenial/ inside virtualbox steps to build: sudo apt-get update sudo apt-get install libgnutls28-dev libgnutls30 cd -> to Debug directory make clean make ./fftp 3 2 1

Please check your packages and build environment.


Based on your steps , I figured out the reason that i am using the old branch 5980ea1 of this project .

The problem is LightFTP/Source/Debug/subdir.mk:29:

gcc -std=c99 -O0 -g3 -Wall -pthread -c -fmessage-length=0 -fno-ident -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"

In main.c:80, there is a check sizeof(off_t)==8, for this reason -D_FILE_OFFSET_BITS=64 flag is necessary. Edit subdir.mk:29 like following will fix this:

gcc -std=c99 -D_FILE_OFFSET_BITS=64 -O0 -g3 -Wall -pthread -c -fmessage-length=0 -fno-ident -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"