While trying to build libgphoto2 2.5.30 using llvm-mingw inside an MSYS2 shell the build failed with an error:
error: call to undeclared function 'ftruncate'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] in gphoto-file.c and also the same error in other places but with usleep instead of ftruncate.
Adding #include <unistd.h> in gphoto-file.c and also greping the source for usleep usage and adding the include to the files makes the build not fail. I've attached libgphoto2-add-unistd.patch for the relevant changes.
I've noticed that at least gphoto2-port-portability.h includes unistd.h but not on Windows. I'm not sure who usually provides usleep there.
I'm not sure if this is a libgphoto2 issue or if llvm-mingw is to blame here as it might behave differently from other MinGW based compilers (I've used gcc in the past).
While trying to build libgphoto2 2.5.30 using llvm-mingw inside an MSYS2 shell the build failed with an error:
error: call to undeclared function 'ftruncate'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
ingphoto-file.c
and also the same error in other places but withusleep
instead offtruncate
.Adding
#include <unistd.h>
ingphoto-file.c
and alsogrep
ing the source forusleep
usage and adding the include to the files makes the build not fail. I've attached libgphoto2-add-unistd.patch for the relevant changes.I've noticed that at least
gphoto2-port-portability.h
includesunistd.h
but not on Windows. I'm not sure who usually providesusleep
there.I'm not sure if this is a libgphoto2 issue or if
llvm-mingw
is to blame here as it might behave differently from other MinGW based compilers (I've used gcc in the past).