tihmstar / futurerestore

A hacked up idevicerestore wrapper, which allows specifying SEP and Baseband for restoring
GNU Lesser General Public License v3.0
865 stars 272 forks source link

struct errors in socket.c from idevicerestore #319

Closed Merculous closed 3 years ago

Merculous commented 4 years ago

Ubuntu 18.04.4 libipatcher: yes (32 and 64)

Before, I had to add the header "<linux/limits.h>" to ipsw.c also in idevicerestore.

If this may cause any issues later on, I do have liboffsetfinder64 compiled without mach-o related functions.

socket.c: In function ‘socket_connect_unix’:
socket.c:131:7: warning: implicit declaration of function ‘S_ISSOCK’; did you mean ‘S_ISLNK’? [-Wimplicit-function-declaration]
  if (!S_ISSOCK(fst.st_mode)) {
       ^~~~~~~~
       S_ISLNK
socket.c: In function ‘socket_connect’:
socket.c:236:18: error: storage size of ‘hints’ isn’t known
  struct addrinfo hints;
                  ^~~~~
socket.c:260:30: error: invalid application of ‘sizeof’ to incomplete type ‘struct addrinfo’
  memset(&hints, '\0', sizeof(struct addrinfo));
                              ^~~~~~
socket.c:268:8: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
  res = getaddrinfo(addr, portstr, &hints, &result);
        ^~~~~~~~~~~
socket.c:270:54: warning: implicit declaration of function ‘gai_strerror’; did you mean ‘strerror’? [-Wimplicit-function-declaration]
   fprintf(stderr, "%s: getaddrinfo: %s\n", __func__, gai_strerror(res));
                                                      ^~~~~~~~~~~~
                                                      strerror
socket.c:270:38: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=]
   fprintf(stderr, "%s: getaddrinfo: %s\n", __func__, gai_strerror(res));
                                     ~^               ~~~~~~~~~~~~~~~~~
                                     %d
socket.c:274:39: error: dereferencing pointer to incomplete type ‘struct addrinfo’
  for (rp = result; rp != NULL; rp = rp->ai_next) {
                                       ^~
socket.c:320:2: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
  freeaddrinfo(result);
  ^~~~~~~~~~~~
Makefile:731: recipe for target 'libidevicerestore_la-socket.lo' failed
make[4]: *** [libidevicerestore_la-socket.lo] Error 1
make[4]: Leaving directory '/home/merculous/Documents/futurerestore/external/idevicerestore/src'
Makefile:435: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/merculous/Documents/futurerestore/external/idevicerestore'
Makefile:367: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/merculous/Documents/futurerestore/external/idevicerestore'
Makefile:427: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/merculous/Documents/futurerestore'
Makefile:359: recipe for target 'all' failed
make: *** [all] Error 2
Merculous commented 4 years ago

Ok, I thought I fixed it but I'm still getting this error.

Merculous commented 4 years ago

Found a fix. At this page adding "#define _POSIX_C_SOURCE 200112L" to socket.c in devicerestore fixed it.

Merculous commented 4 years ago

So, in conclusion, not sure if these are the exact needed headers but adding the headers below will then compile: <linux/limits.h> in ipsw.c "#define _POSIX_C_SOURCE 200112L" in socket.c Add these to idevicerestore in "external/idevicerestore/src"

lpuv commented 3 years ago

@Merculous it doesn't work anymore ):

Merculous commented 3 years ago

This is fixed with the changes mentioned in #302. That will make it compile. This wasn't a good fix and the pr referenced is the correct way of doing it.