dex4er / fakechroot

gives a fake chroot environment
GNU Lesser General Public License v2.1
295 stars 73 forks source link

Compilation error:chroot.c:38:45: error: '_STAT_VER' undeclared (first use in this function) #105

Open duerpei opened 2 years ago

duerpei commented 2 years ago

I’m try to cross complier fakechroot for arrch64 in ubuntu, I run the follow commands : $ ./autogen.sh $ ./configure --host=aarch64 $ make

I meet the follow error: chroot.c: In function 'chroot': chroot.c:38:45: error: '_STAT_VER' undeclared (first use in this function) 38 | # define STAT(path, sb) nextcall(xstat64)(_STAT_VER, path, sb) | ^~~~~ chroot.c:108:19: note: in expansion of macro 'STAT' 108 | if ((status = STAT(path, &sb)) != 0) { | ^~~~ chroot.c:38:45: note: each undeclared identifier is reported only once for each function it appears in 38 | # define STAT(path, sb) nextcall(xstat64)(_STAT_VER, path, sb) | ^~~~~ chroot.c:108:19: note: in expansion of macro 'STAT' 108 | if ((status = STAT(path, &sb)) != 0) { | ^~~~ make[2]: [Makefile:905: chroot.lo] Error 1 make[2]: Leaving directory '/compile/duep/cross-compile/fakechroot/src' make[1]: [Makefile:449: all-recursive] Error 1 make[1]: Leaving directory '/compile/duep/cross-compile/fakechroot' make: *** [Makefile:379: all] Error 2

I search it in google and I I found a issue similar to mine : https://github.com/criblio/appscope/issues/307 https://github.com/search?l=Diff&q=_STAT_VER&type=Code https://github.com/criblio/appscope/commit/bbbe4e21cbca67db78f10c96ac747e3959b214c8 It seems to be a bug from glibc. After reading the content in the above link, I think we should avoid using STAT VER

Does anyone have any similar problems or suggestions on this problem. Anyway thank you very much

josch commented 2 years ago

Fixed by this: https://github.com/dex4er/fakechroot/pull/85/commits/693a3597ea7fccfb62f357503ff177bd3e3d5a89#diff-9c810d4a3b460bbc810ddccbed00e5f631ad4e5c208029149644b354c2597bff

pradt2 commented 5 months ago

Hi, I have the same problem on the latest Fedora (glibc 2.39):

make[2]: Entering directory '/home/p/Workspaces/c/fakechroot/src'
  CC       chroot.lo
chroot.c:108:19: error: use of undeclared identifier '_STAT_VER'
  108 |     if ((status = STAT(path, &sb)) != 0) {
      |                   ^
chroot.c:38:45: note: expanded from macro 'STAT'
   38 | # define STAT(path, sb) nextcall(__xstat64)(_STAT_VER, path, sb)
      |                                             ^
1 error generated.
synalice commented 2 weeks ago

Fixed by this: 693a359#diff-9c810d4a3b460bbc810ddccbed00e5f631ad4e5c208029149644b354c2597bff

I think your link is a somewhat broken. Here is this the origin of this commit: link.

synalice commented 2 weeks ago

Btw, can someone explain the reason for why this error occurs in the first place? I assume this has something to do with the version of glibc?