[poppler] gfile.cc fails to build on macos due to statbuf.st_mtim
Jeroen Ooms
jeroen at berkeley.edu
Fri Feb 9 20:08:39 UTC 2018
After recent changes (after 0.62) the master branch no longer builds
on macos. The issue is that the statbuf struct does not have an
"st_mtim" field on macos:
[ 0%] Building CXX object CMakeFiles/poppler.dir/goo/gfile.cc.o
/Users/jeroen/Desktop/popplergit/goo/gfile.cc:690:34: error: no member
named 'st_mtim' in 'stat'
modifiedTimeOnOpen = statbuf.st_mtim;
~~~~~~~ ^
/Users/jeroen/Desktop/popplergit/goo/gfile.cc:698:49: error: no member
named 'st_mtim' in 'stat'
return modifiedTimeOnOpen.tv_sec != statbuf.st_mtim.tv_sec ||
modifiedTimeOnOpen.tv_nsec != statbuf.st_mtim.tv_nsec;
~~~~~~~ ^
/Users/jeroen/Desktop/popplergit/goo/gfile.cc:698:105: error: no
member named 'st_mtim' in 'stat'
return modifiedTimeOnOpen.tv_sec != statbuf.st_mtim.tv_sec ||
modifiedTimeOnOpen.tv_nsec != statbuf.st_mtim.tv_nsec;
~~~~~~~ ^
3 errors generated.
We need to use the st_mtime field instead. Note that on Linux, stat.h
defines st_mtime as st_mtim.tv_sec:
/usr/include/bits/stat.h:# define st_mtime st_mtim.tv_sec
So I think the fix is something like this:
https://github.com/jeroen/poppler-mirror/commit/8e4dc30f73d963432f629e73c0e1f4723b47f936
More information about the poppler
mailing list